ggglm#
Functions
-
void sggglm(const INT n, const INT m, const INT p, f32 *restrict A, const INT lda, f32 *restrict B, const INT ldb, f32 *restrict D, f32 *restrict X, f32 *restrict Y, f32 *restrict work, const INT lwork, INT *info)#
SGGGLM solves a general Gauss-Markov linear model (GLM) problem:
where A is an N-by-M matrix, B is an N-by-P matrix, and d is a given N-vector. It is assumed that M <= N <= M+P, andminimize || y ||_2 subject to d = A*x + B*y x
Under these assumptions, the constrained equation is always consistent, and there is a unique solution x and a minimal 2-norm solution y, which is obtained using a generalized QR factorization of the matrices (A, B) given byrank(A) = M and rank( A B ) = N.
A = Q*(R), B = Q*T*Z. (0)
In particular, if matrix B is square nonsingular, then the problem GLM is equivalent to the following weighted linear least squares problem
where inv(B) denotes the inverse of B.minimize || inv(B)*(d-A*x) ||_2 x
On exit, X and Y are the solutions of the GLM problem.
If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued by xerbla.
Parameters
innThe number of rows of the matrices A and B. n >= 0.
inmThe number of columns of the matrix A. 0 <= m <= n.
inpThe number of columns of the matrix B. p >= n-m.
inoutADouble precision array, dimension (lda, m). On entry, the N-by-M matrix A. On exit, the upper triangular part of the array A contains the M-by-M upper triangular matrix R.
inldaThe leading dimension of the array A. lda >= max(1, n).
inoutBDouble precision array, dimension (ldb, p). On entry, the N-by-P matrix B. On exit, if n <= p, the upper triangle of the subarray B(1:n, p-n+1:p) contains the N-by-N upper triangular matrix T; if n > p, the elements on and above the (n-p)th subdiagonal contain the N-by-P upper trapezoidal matrix T.
inldbThe leading dimension of the array B. ldb >= max(1, n).
inoutDDouble precision array, dimension (n). On entry, D is the left hand side of the GLM equation. On exit, D is destroyed.
outXDouble precision array, dimension (m).
outYDouble precision array, dimension (p).
outworkDouble precision array, dimension (max(1, lwork)). On exit, if info = 0, work[0] returns the optimal lwork.
inlworkThe dimension of the array work. lwork >= max(1, n+m+p). For optimum performance, lwork >= m+min(n,p)+max(n,p)*NB, where NB is an upper bound for the optimal blocksizes for SGEQRF, SGERQF, SORMQR and SORMRQ.
outinfo= 0: successful exit.
< 0: if info = -i, the i-th argument had an illegal value.
= 1: the upper triangular factor R associated with A in the generalized QR factorization of the pair (A, B) is exactly singular, so that rank(A) < M; the least squares solution could not be computed.
= 2: the bottom (N-M) by (N-M) part of the upper trapezoidal factor T associated with B in the generalized QR factorization of the pair (A, B) is exactly singular, so that rank( A B ) < N; the least squares solution could not be computed.
void sggglm(
const INT n,
const INT m,
const INT p,
f32* restrict A,
const INT lda,
f32* restrict B,
const INT ldb,
f32* restrict D,
f32* restrict X,
f32* restrict Y,
f32* restrict work,
const INT lwork,
INT* info
);
Functions
-
void dggglm(const INT n, const INT m, const INT p, f64 *restrict A, const INT lda, f64 *restrict B, const INT ldb, f64 *restrict D, f64 *restrict X, f64 *restrict Y, f64 *restrict work, const INT lwork, INT *info)#
DGGGLM solves a general Gauss-Markov linear model (GLM) problem:
where A is an N-by-M matrix, B is an N-by-P matrix, and d is a given N-vector. It is assumed that M <= N <= M+P, andminimize || y ||_2 subject to d = A*x + B*y x
Under these assumptions, the constrained equation is always consistent, and there is a unique solution x and a minimal 2-norm solution y, which is obtained using a generalized QR factorization of the matrices (A, B) given byrank(A) = M and rank( A B ) = N.
A = Q*(R), B = Q*T*Z. (0)
In particular, if matrix B is square nonsingular, then the problem GLM is equivalent to the following weighted linear least squares problem
where inv(B) denotes the inverse of B.minimize || inv(B)*(d-A*x) ||_2 x
On exit, X and Y are the solutions of the GLM problem.
If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued by xerbla.
Parameters
innThe number of rows of the matrices A and B. n >= 0.
inmThe number of columns of the matrix A. 0 <= m <= n.
inpThe number of columns of the matrix B. p >= n-m.
inoutADouble precision array, dimension (lda, m). On entry, the N-by-M matrix A. On exit, the upper triangular part of the array A contains the M-by-M upper triangular matrix R.
inldaThe leading dimension of the array A. lda >= max(1, n).
inoutBDouble precision array, dimension (ldb, p). On entry, the N-by-P matrix B. On exit, if n <= p, the upper triangle of the subarray B(1:n, p-n+1:p) contains the N-by-N upper triangular matrix T; if n > p, the elements on and above the (n-p)th subdiagonal contain the N-by-P upper trapezoidal matrix T.
inldbThe leading dimension of the array B. ldb >= max(1, n).
inoutDDouble precision array, dimension (n). On entry, D is the left hand side of the GLM equation. On exit, D is destroyed.
outXDouble precision array, dimension (m).
outYDouble precision array, dimension (p).
outworkDouble precision array, dimension (max(1, lwork)). On exit, if info = 0, work[0] returns the optimal lwork.
inlworkThe dimension of the array work. lwork >= max(1, n+m+p). For optimum performance, lwork >= m+min(n,p)+max(n,p)*NB, where NB is an upper bound for the optimal blocksizes for DGEQRF, DGERQF, DORMQR and DORMRQ.
outinfo= 0: successful exit.
< 0: if info = -i, the i-th argument had an illegal value.
= 1: the upper triangular factor R associated with A in the generalized QR factorization of the pair (A, B) is exactly singular, so that rank(A) < M; the least squares solution could not be computed.
= 2: the bottom (N-M) by (N-M) part of the upper trapezoidal factor T associated with B in the generalized QR factorization of the pair (A, B) is exactly singular, so that rank( A B ) < N; the least squares solution could not be computed.
void dggglm(
const INT n,
const INT m,
const INT p,
f64* restrict A,
const INT lda,
f64* restrict B,
const INT ldb,
f64* restrict D,
f64* restrict X,
f64* restrict Y,
f64* restrict work,
const INT lwork,
INT* info
);
Functions
-
void cggglm(const INT n, const INT m, const INT p, c64 *restrict A, const INT lda, c64 *restrict B, const INT ldb, c64 *restrict D, c64 *restrict X, c64 *restrict Y, c64 *restrict work, const INT lwork, INT *info)#
CGGGLM solves a general Gauss-Markov linear model (GLM) problem:
where A is an N-by-M matrix, B is an N-by-P matrix, and d is a given N-vector. It is assumed that M <= N <= M+P, andminimize || y ||_2 subject to d = A*x + B*y x
Under these assumptions, the constrained equation is always consistent, and there is a unique solution x and a minimal 2-norm solution y, which is obtained using a generalized QR factorization of the matrices (A, B) given byrank(A) = M and rank( A B ) = N.
A = Q*(R), B = Q*T*Z. (0)
In particular, if matrix B is square nonsingular, then the problem GLM is equivalent to the following weighted linear least squares problem
where inv(B) denotes the inverse of B.minimize || inv(B)*(d-A*x) ||_2 x
On exit, X and Y are the solutions of the GLM problem.
If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued by xerbla.
Parameters
innThe number of rows of the matrices A and B. n >= 0.
inmThe number of columns of the matrix A. 0 <= m <= n.
inpThe number of columns of the matrix B. p >= n-m.
inoutASingle complex array, dimension (lda, m). On entry, the N-by-M matrix A. On exit, the upper triangular part of the array A contains the M-by-M upper triangular matrix R.
inldaThe leading dimension of the array A. lda >= max(1, n).
inoutBSingle complex array, dimension (ldb, p). On entry, the N-by-P matrix B. On exit, if n <= p, the upper triangle of the subarray B(1:n, p-n+1:p) contains the N-by-N upper triangular matrix T; if n > p, the elements on and above the (n-p)th subdiagonal contain the N-by-P upper trapezoidal matrix T.
inldbThe leading dimension of the array B. ldb >= max(1, n).
inoutDSingle complex array, dimension (n). On entry, D is the left hand side of the GLM equation. On exit, D is destroyed.
outXSingle complex array, dimension (m).
outYSingle complex array, dimension (p).
outworkSingle complex array, dimension (max(1, lwork)). On exit, if info = 0, work[0] returns the optimal lwork.
inlworkThe dimension of the array work. lwork >= max(1, n+m+p). For optimum performance, lwork >= m+min(n,p)+max(n,p)*NB, where NB is an upper bound for the optimal blocksizes for CGEQRF, CGERQF, CUNMQR and CUNMRQ.
outinfo= 0: successful exit.
< 0: if info = -i, the i-th argument had an illegal value.
= 1: the upper triangular factor R associated with A in the generalized QR factorization of the pair (A, B) is exactly singular, so that rank(A) < M; the least squares solution could not be computed.
= 2: the bottom (N-M) by (N-M) part of the upper trapezoidal factor T associated with B in the generalized QR factorization of the pair (A, B) is exactly singular, so that rank( A B ) < N; the least squares solution could not be computed.
void cggglm(
const INT n,
const INT m,
const INT p,
c64* restrict A,
const INT lda,
c64* restrict B,
const INT ldb,
c64* restrict D,
c64* restrict X,
c64* restrict Y,
c64* restrict work,
const INT lwork,
INT* info
);
Functions
-
void zggglm(const INT n, const INT m, const INT p, c128 *restrict A, const INT lda, c128 *restrict B, const INT ldb, c128 *restrict D, c128 *restrict X, c128 *restrict Y, c128 *restrict work, const INT lwork, INT *info)#
ZGGGLM solves a general Gauss-Markov linear model (GLM) problem:
where A is an N-by-M matrix, B is an N-by-P matrix, and d is a given N-vector. It is assumed that M <= N <= M+P, andminimize || y ||_2 subject to d = A*x + B*y x
Under these assumptions, the constrained equation is always consistent, and there is a unique solution x and a minimal 2-norm solution y, which is obtained using a generalized QR factorization of the matrices (A, B) given byrank(A) = M and rank( A B ) = N.
A = Q*(R), B = Q*T*Z. (0)
In particular, if matrix B is square nonsingular, then the problem GLM is equivalent to the following weighted linear least squares problem
where inv(B) denotes the inverse of B.minimize || inv(B)*(d-A*x) ||_2 x
On exit, X and Y are the solutions of the GLM problem.
If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued by xerbla.
Parameters
innThe number of rows of the matrices A and B. n >= 0.
inmThe number of columns of the matrix A. 0 <= m <= n.
inpThe number of columns of the matrix B. p >= n-m.
inoutADouble complex array, dimension (lda, m). On entry, the N-by-M matrix A. On exit, the upper triangular part of the array A contains the M-by-M upper triangular matrix R.
inldaThe leading dimension of the array A. lda >= max(1, n).
inoutBDouble complex array, dimension (ldb, p). On entry, the N-by-P matrix B. On exit, if n <= p, the upper triangle of the subarray B(1:n, p-n+1:p) contains the N-by-N upper triangular matrix T; if n > p, the elements on and above the (n-p)th subdiagonal contain the N-by-P upper trapezoidal matrix T.
inldbThe leading dimension of the array B. ldb >= max(1, n).
inoutDDouble complex array, dimension (n). On entry, D is the left hand side of the GLM equation. On exit, D is destroyed.
outXDouble complex array, dimension (m).
outYDouble complex array, dimension (p).
outworkDouble complex array, dimension (max(1, lwork)). On exit, if info = 0, work[0] returns the optimal lwork.
inlworkThe dimension of the array work. lwork >= max(1, n+m+p). For optimum performance, lwork >= m+min(n,p)+max(n,p)*NB, where NB is an upper bound for the optimal blocksizes for ZGEQRF, ZGERQF, ZUNMQR and ZUNMRQ.
outinfo= 0: successful exit.
< 0: if info = -i, the i-th argument had an illegal value.
= 1: the upper triangular factor R associated with A in the generalized QR factorization of the pair (A, B) is exactly singular, so that rank(A) < M; the least squares solution could not be computed.
= 2: the bottom (N-M) by (N-M) part of the upper trapezoidal factor T associated with B in the generalized QR factorization of the pair (A, B) is exactly singular, so that rank( A B ) < N; the least squares solution could not be computed.
void zggglm(
const INT n,
const INT m,
const INT p,
c128* restrict A,
const INT lda,
c128* restrict B,
const INT ldb,
c128* restrict D,
c128* restrict X,
c128* restrict Y,
c128* restrict work,
const INT lwork,
INT* info
);