ggglm(3)
π ggglm β Gauss-Markov linear model
okay bestie, welcome to ggglm(3) from the Library Functions Manual (section 3, we're in library-functions territory, put some respect on it π«Ά). This is the LAPACK girlie that solves the general Gauss-Markov linear model. She's four subroutines in a trench coat β one for each of your favorite precisions β and she's lowkey iconic.
β¨ SYNOPSIS β¨
Functions
subroutine cggglm (n, m, p, a, lda, b, ldb, d, x, y, work, lwork, info)β CGGGLM, theCOMPLEXone πsubroutine dggglm (n, m, p, a, lda, b, ldb, d, x, y, work, lwork, info)β DGGGLM, theDOUBLE PRECISIONone πsubroutine sggglm (n, m, p, a, lda, b, ldb, d, x, y, work, lwork, info)β SGGGLM, theREALone πΈsubroutine zggglm (n, m, p, a, lda, b, ldb, d, x, y, work, lwork, info)β ZGGGLM, theCOMPLEX*16one π¦
π Detailed Description
π₯ Function Documentation
π§ subroutine cggglm
subroutine cggglm (integer n, integer m, integer p, complex, dimension( lda, * ) a, integer lda, complex, dimension( ldb, * ) b, integer ldb, complex, dimension( * ) d, complex, dimension( * ) x, complex, dimension( * ) y, complex, dimension( * ) work, integer lwork, integer info)
CGGGLM
Purpose
Obsessed with her honestly. CGGGLM solves a general Gauss-Markov linear model (GLM) problem:
minimize || y ||_2 subject to d = A*x + B*y
x
where A is an N-by-M matrix, B is an N-by-P matrix, and d is a given N-vector. The routine assumes that M <= N <= M+P, and that
rank(A) = M and rank( A B ) = N.
Under these assumptions the constrained equation is always consistent, and there's a unique solution x plus a minimal 2-norm solution y β periodt. That solution is obtained using a generalized QR factorization of the matrices (A, B) given by
A = Q*(R), B = Q*T*Z.
(0)
And like, in particular: if matrix B is square nonsingular, then the problem GLM is equivalent to the following weighted linear least squares problem
minimize || inv(B)*(d-A*x) ||_2
x
where inv(B) denotes the inverse of B.
β οΈ main character warning, listen up bestie: callers of this subroutine should note that the singularity / rank-deficiency checks implemented in this subroutine are rudimentary. TheCTRTRSsubroutine called by this subroutine only signals a failure due to singularity if the problem is exactly singular. It is conceivable for one (or more) of the factors involved in the generalized QR factorization of the pair(A, B)to be subnormally close to singularity without this subroutine signalling an error. The solutions computed for such almost-rank-deficient problems may be less accurate due to a loss of numerical precision. π
Parameters
NβINTEGER. The number of rows of the matricesAandB.N >= 0.MβINTEGER. The number of columns of the matrixA.0 <= M <= N.PβINTEGER. The number of columns of the matrixB.P >= N-M.AβCOMPLEXarray, dimension(LDA,M). On entry, the N-by-M matrixA. On exit, the upper triangular part of the arrayAcontains the M-by-M upper triangular matrixR.LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).BβCOMPLEXarray, dimension(LDB,P). On entry, the N-by-P matrixB. On exit, ifN <= P, the upper triangle of the subarrayB(1:N,P-N+1:P)contains the N-by-N upper triangular matrixT; ifN > P, the elements on and above the(N-P)th subdiagonal contain the N-by-P upper trapezoidal matrixT.LDBβINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).DβCOMPLEXarray, dimension(N). On entry,Dis the left hand side of the GLM equation. On exit,Dis destroyed. π she's gone, she served her purpose.XβCOMPLEXarray, dimension(M).YβCOMPLEXarray, dimension(P). On exit,XandYare the solutions of the GLM problem. πWORKβCOMPLEXarray, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKβINTEGER. The dimension of the arrayWORK.LWORK >= max(1,N+M+P). For optimum performance,LWORK >= M+min(N,P)+max(N,P)*NB, whereNBis an upper bound for the optimal blocksizes forCGEQRF,CGERQF,CUNMQRandCUNMRQ.
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. (she's minding her business β¨)
INFOβINTEGER.= 0: successful exit. slay π< 0: ifINFO = -i, the i-th argument had an illegal value.= 1: the upper triangular factorRassociated withAin the generalized QR factorization of the pair(A, B)is exactly singular, so thatrank(A) < M; the least squares solution could not be computed.= 2: the bottom(N-M)by(N-M)part of the upper trapezoidal factorTassociated withBin the generalized QR factorization of the pair(A, B)is exactly singular, so thatrank( A B ) < N; the least squares solution could not be computed.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 193 of file cggglm.f.
π¦ subroutine dggglm
subroutine dggglm (integer n, integer m, integer p, double precision, dimension( lda, * ) a, integer lda, double precision, dimension( ldb, * ) b, integer ldb, double precision, dimension( * ) d, double precision, dimension( * ) x, double precision, dimension( * ) y, double precision, dimension( * ) work, integer lwork, integer info)
DGGGLM
Purpose
Same problem, double the precision, double the fun π DGGGLM solves a general Gauss-Markov linear model (GLM) problem:
minimize || y ||_2 subject to d = A*x + B*y
x
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, and
rank(A) = M and rank( A B ) = N.
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 by
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
minimize || inv(B)*(d-A*x) ||_2
x
where inv(B) denotes the inverse of B.
β οΈ ngl bestie, read this twice: callers of this subroutine should note that the singularity / rank-deficiency checks implemented in this subroutine are rudimentary. TheDTRTRSsubroutine called by this subroutine only signals a failure due to singularity if the problem is exactly singular. It is conceivable for one (or more) of the factors involved in the generalized QR factorization of the pair(A, B)to be subnormally close to singularity without this subroutine signalling an error. The solutions computed for such almost-rank-deficient problems may be less accurate due to a loss of numerical precision. π
Parameters
NβINTEGER. The number of rows of the matricesAandB.N >= 0.MβINTEGER. The number of columns of the matrixA.0 <= M <= N.PβINTEGER. The number of columns of the matrixB.P >= N-M.AβDOUBLE PRECISIONarray, dimension(LDA,M). On entry, the N-by-M matrixA. On exit, the upper triangular part of the arrayAcontains the M-by-M upper triangular matrixR.LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).BβDOUBLE PRECISIONarray, dimension(LDB,P). On entry, the N-by-P matrixB. On exit, ifN <= P, the upper triangle of the subarrayB(1:N,P-N+1:P)contains the N-by-N upper triangular matrixT; ifN > P, the elements on and above the(N-P)th subdiagonal contain the N-by-P upper trapezoidal matrixT.LDBβINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).DβDOUBLE PRECISIONarray, dimension(N). On entry,Dis the left hand side of the GLM equation. On exit,Dis destroyed. π gone but not forgotten.XβDOUBLE PRECISIONarray, dimension(M).YβDOUBLE PRECISIONarray, dimension(P). On exit,XandYare the solutions of the GLM problem. πWORKβDOUBLE PRECISIONarray, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKLWORKβ okay bestie,LWORKisINTEGER. Itβs the dimension of the arrayWORK, and it has to satisfyLWORK >= max(1,N+M+P). For optimum performance, useLWORK >= M+min(N,P)+max(N,P)*NB, whereNBis an upper bound for the optimal blocksizes forDGEQRF,SGERQF,DORMQRandSORMRQ. IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. πINFOβINFOisINTEGER, and itβs literally the vibe check at the end:= 0: successful exit. slay.< 0: ifINFO = -i, the i-th argument had an illegal value. rude.= 1: the upper triangular factorRassociated withAin the generalized QR factorization of the pair(A, B)is exactly singular, so thatrank(A) < M; the least squares solution could not be computed. π= 2: the bottom(N-M)by(N-M)part of the upper trapezoidal factorTassociated withBin the generalized QR factorization of the pair(A, B)is exactly singular, so thatrank( A B ) < N; the least squares solution could not be computed. π
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Definition at line 193 of file dggglm.f.
π¦ SGGGLM β the sggglm subroutine π¦
subroutine sggglm (integer n, integer m, integer p, real, dimension( lda, * ) a, integer lda, real, dimension( ldb, * ) b, integer ldb, real, dimension( * ) d, real, dimension( * ) x, real, dimension( * ) y, real, dimension( * ) work, integer lwork, integer info)
SGGGLM
β¨ Purpose β¨
SGGGLM solves a general Gauss-Markov linear model (GLM) problem:
minimize || y ||_2 subject to d = A*x + B*y
x
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, and
rank(A) = M and rank( A B ) = N.
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 by
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
minimize || inv(B)*(d-A*x) ||_2
x
where inv(B) denotes the inverse of B.
β οΈ Callers of this subroutine should note that the singularity/rank-deficiency checks implemented in this subroutine are rudimentary. The STRTRS subroutine called by this subroutine only signals a failure due to singularity if the problem is exactly singular.
π«Ά It is conceivable for one (or more) of the factors involved in the generalized QR factorization of the pair (A, B) to be subnormally close to singularity without this subroutine signalling an error. The solutions computed for such almost-rank-deficient problems may be less accurate due to a loss of numerical precision.
π Parameters π
NβNisINTEGER. The number of rows of the matricesAandB.N >= 0.MβMisINTEGER. The number of columns of the matrixA.0 <= M <= N.PβPisINTEGER. The number of columns of the matrixB.P >= N-M.AβAisREAL array, dimension (LDA,M). On entry, theN-by-MmatrixA. On exit, the upper triangular part of the arrayAcontains theM-by-Mupper triangular matrixR.LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).BβBisREAL array, dimension (LDB,P). On entry, theN-by-PmatrixB. On exit, ifN <= P, the upper triangle of the subarrayB(1:N,P-N+1:P)contains theN-by-Nupper triangular matrixT; ifN > P, the elements on and above the(N-P)th subdiagonal contain theN-by-Pupper trapezoidal matrixT.LDBβLDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).DβDisREAL array, dimension (N). On entry,Dis the left hand side of the GLM equation. On exit,Dis destroyed. rip.XβXisREAL array, dimension (M).YβYisREAL array, dimension (P). On exit,XandYare the solutions of the GLM problem. main character solutions fr fr.WORKβWORKisREAL array, dimension (MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKβLWORKisINTEGER. The dimension of the arrayWORK.LWORK >= max(1,N+M+P). For optimum performance,LWORK >= M+min(N,P)+max(N,P)*NB, whereNBis an upper bound for the optimal blocksizes forSGEQRF,SGERQF,SORMQRandSORMRQ. IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA.INFOβINFOisINTEGER:= 0: successful exit.< 0: ifINFO = -i, the i-th argument had an illegal value.= 1: the upper triangular factorRassociated withAin the generalized QR factorization of the pair(A, B)is exactly singular, so thatrank(A) < M; the least squares solution could not be computed.= 2: the bottom(N-M)by(N-M)part of the upper trapezoidal factorTassociated withBin the generalized QR factorization of the pair(A, B)is exactly singular, so thatrank( A B ) < N; the least squares solution could not be computed.
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Definition at line 193 of file sggglm.f.
π ZGGGLM β the zggglm subroutine π
subroutine zggglm (integer n, integer m, integer p, complex*16, dimension( lda, * ) a, integer lda, complex*16, dimension( ldb, * ) b, integer ldb, complex*16, dimension( * ) d, complex*16, dimension( * ) x, complex*16, dimension( * ) y, complex*16, dimension( * ) work, integer lwork, integer info)
ZGGGLM
β¨ Purpose β¨
ZGGGLM solves a general Gauss-Markov linear model (GLM) problem:
minimize || y ||_2 subject to d = A*x + B*y
x
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, and
rank(A) = M and rank( A B ) = N.
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 by
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
minimize || inv(B)*(d-A*x) ||_2
x
where inv(B) denotes the inverse of B.
β οΈ Callers of this subroutine should note that the singularity/rank-deficiency checks implemented in this subroutine are rudimentary. The ZTRTRS subroutine called by this subroutine only signals a failure due to singularity if the problem is exactly singular.
π«Ά It is conceivable for one (or more) of the factors involved in the generalized QR factorization of the pair (A, B) to be subnormally close to singularity without this subroutine signalling an error. The solutions computed for such almost-rank-deficient problems may be less accurate due to a loss of numerical precision.
π Parameters π
NβNisINTEGER. The number of rows of the matricesAandB.N >= 0.MβMisINTEGER. The number of columns of the matrixA.0 <= M <= N.PβPisINTEGER. The number of columns of the matrixB.P >= N-M.AβAisCOMPLEX*16 array, dimension (LDA,M). On entry, theN-by-MmatrixA. On exit, the upper triangular part of the arrayAcontains theM-by-Mupper triangular matrixR.LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).BβBisCOMPLEX*16 array, dimension (LDB,P). On entry, theN-by-PmatrixB. On exit, ifN <= P, the upper triangle of the subarrayB(1:N,P-N+1:P)contains theN-by-Nupper triangular matrixT; ifN > P, the elements on and above the(N-P)th subdiagonal contain theN-by-Pupper trapezoidal matrixT.LDBβLDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).DβDisCOMPLEX*16 array, dimension (N). On entry,Dis the left hand side of the GLM equation. On exit,Dis destroyed.XβXisCOMPLEX*16 array, dimension (M).YβCOMPLEX*16array, dimension(P). On exit,XandYare literally the solutions of the GLM problem π like that's the whole payoff, bestie.WORKβCOMPLEX*16array, dimension(MAX(1,LWORK)). On exit, ifINFO = 0, thenWORK(1)gives you the optimalLWORKback. it's giving "the workspace snitches on its own ideal size" β¨LWORKβINTEGER. This is the dimension of the arrayWORK. The floor isLWORK >= max(1,N+M+P)β do not go under it, bestie, that's the vibe check π«Ά
For optimum performance, though? You want 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. fancy stuff, iykyk π
And 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. queen behavior honestly π
INFOβINTEGER, the receipts π= 0: successful exit. slay π< 0: ifINFO = -i, the i-th argument had an illegal value. not me pointing fingers π= 1: the upper triangular factorRassociated withAin the generalized QR factorization of the pair(A, B)is exactly singular, so thatrank(A) < M; the least squares solution could not be computed. π= 2: the bottom(N-M)by(N-M)part of the upper trapezoidal factorTassociated withBin the generalized QR factorization of the pair(A, B)is exactly singular, so thatrank( A B ) < N; the least squares solution could not be computed.
both of those last two are the "sorry bestie, it's singular" endings β the math just said no π
πΈ Author πΈ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Definition at line 193 of file zggglm.f. iconic, no cap β¨
π¦ Author π¦
Generated automatically by Doxygen for LAPACK from the source code. it's literally a bot-authored author section and i respect the honesty π«‘
and that's the whole page, bestie!! this one's from LAPACK, Version 3.12.0, and it's the ggglm(3) page β go forth and solve your generalized linear models the correct way ππ·π
π¦ where this page comes from
- arch rolling: lapack-doc 3.12.1-2 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms