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, the COMPLEX one πŸ’œ
  • subroutine dggglm (n, m, p, a, lda, b, ldb, d, x, y, work, lwork, info) β€” DGGGLM, the DOUBLE PRECISION one πŸ’–
  • subroutine sggglm (n, m, p, a, lda, b, ldb, d, x, y, work, lwork, info) β€” SGGGLM, the REAL one 🌸
  • subroutine zggglm (n, m, p, a, lda, b, ldb, d, x, y, work, lwork, info) β€” ZGGGLM, the COMPLEX*16 one πŸ¦‹

πŸŽ€ 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. The CTRTRS 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 β€” INTEGER. The number of rows of the matrices A and B. N >= 0.
  • M β€” INTEGER. The number of columns of the matrix A. 0 <= M <= N.
  • P β€” INTEGER. The number of columns of the matrix B. P >= N-M.
  • A β€” 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.
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,N).
  • B β€” 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.
  • LDB β€” INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • D β€” COMPLEX array, dimension (N). On entry, D is the left hand side of the GLM equation. On exit, D is destroyed. πŸ’€ she's gone, she served her purpose.
  • X β€” COMPLEX array, dimension (M).
  • Y β€” COMPLEX array, dimension (P). On exit, X and Y are the solutions of the GLM problem. πŸŽ‰
  • WORK β€” COMPLEX array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
  • LWORK β€” INTEGER. The 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.

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: 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.

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. The DTRTRS 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 β€” INTEGER. The number of rows of the matrices A and B. N >= 0.
  • M β€” INTEGER. The number of columns of the matrix A. 0 <= M <= N.
  • P β€” INTEGER. The number of columns of the matrix B. P >= N-M.
  • A β€” DOUBLE 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.
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,N).
  • B β€” DOUBLE 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.
  • LDB β€” INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • D β€” DOUBLE PRECISION array, dimension (N). On entry, D is the left hand side of the GLM equation. On exit, D is destroyed. πŸ’€ gone but not forgotten.
  • X β€” DOUBLE PRECISION array, dimension (M).
  • Y β€” DOUBLE PRECISION array, dimension (P). On exit, X and Y are the solutions of the GLM problem. 🌟
  • WORK β€” DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
  • LWORK
  • LWORK β€” okay bestie, LWORK is INTEGER. It’s the dimension of the array WORK, and it has to satisfy LWORK >= max(1,N+M+P). For optimum performance, use LWORK >= M+min(N,P)+max(N,P)*NB, where NB is an upper bound for the optimal blocksizes for DGEQRF, SGERQF, DORMQR and SORMRQ. 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. πŸ’…
  • INFO β€” INFO is INTEGER, and it’s literally the vibe check at the end:
    • = 0: successful exit. slay.
    • < 0: if INFO = -i, the i-th argument had an illegal value. rude.
    • = 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. πŸ’€

πŸ’– 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 β€” N is INTEGER. The number of rows of the matrices A and B. N >= 0.
  • M β€” M is INTEGER. The number of columns of the matrix A. 0 <= M <= N.
  • P β€” P is INTEGER. The number of columns of the matrix B. P >= N-M.
  • A β€” A is REAL 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.
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,N).
  • B β€” B is REAL 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.
  • LDB β€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • D β€” D is REAL array, dimension (N). On entry, D is the left hand side of the GLM equation. On exit, D is destroyed. rip.
  • X β€” X is REAL array, dimension (M).
  • Y β€” Y is REAL array, dimension (P). On exit, X and Y are the solutions of the GLM problem. main character solutions fr fr.
  • WORK β€” WORK is REAL array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
  • LWORK β€” LWORK is INTEGER. The 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. 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.
  • INFO β€” INFO is INTEGER:
    • = 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.

πŸ’– 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 β€” N is INTEGER. The number of rows of the matrices A and B. N >= 0.
  • M β€” M is INTEGER. The number of columns of the matrix A. 0 <= M <= N.
  • P β€” P is INTEGER. The number of columns of the matrix B. P >= N-M.
  • A β€” A is COMPLEX*16 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.
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,N).
  • B β€” B is COMPLEX*16 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.
  • LDB β€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • D β€” D is COMPLEX*16 array, dimension (N). On entry, D is the left hand side of the GLM equation. On exit, D is destroyed.
  • X β€” X is COMPLEX*16 array, dimension (M).
  • Y β€” COMPLEX*16 array, dimension (P). On exit, X and Y are literally the solutions of the GLM problem πŸ’– like that's the whole payoff, bestie.
  • WORK β€” COMPLEX*16 array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, then WORK(1) gives you the optimal LWORK back. it's giving "the workspace snitches on its own ideal size" ✨
  • LWORK β€” INTEGER. This is the dimension of the array WORK. The floor is LWORK >= 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: if INFO = -i, the i-th argument had an illegal value. not me pointing fingers πŸ™ˆ
    • = 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.
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