getsls(3)

πŸ’– getsls(3) πŸ’–

okay so bestie, welcome to getsls β€” aka least squares using tall-skinny QR/LQ. this is a Library Functions Manual girly and she is THOROUGH. buckle up, we're going through the whole thing together πŸŽ€


✨ NAME ✨

getsls β€” getsls: least squares using tall-skinny QR/LQ πŸ’…


🌸 SYNOPSIS 🌸

πŸ¦‹ Functions πŸ¦‹

cgetsls

subroutine cgetsls (trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info)

CGETSLS

dgetsls

subroutine dgetsls (trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info)

DGETSLS

sgetsls

subroutine sgetsls (trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info)

SGETSLS

zgetsls

subroutine zgetsls (trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info)

ZGETSLS


🌈 Detailed Description 🌈

yeah so this section is literally just the heading in the original β€” the real tea is all down in Function Documentation πŸ‘‡ keep scrolling bestie, it's giving everything.


πŸ‘‘ Function Documentation πŸ‘‘

πŸ“ subroutine cgetsls (character trans, integer m, integer n, integer nrhs, complex, dimension( lda, * ) a, integer lda, complex, dimension( ldb, * ) b, integer ldb, complex, dimension( * ) work, integer lwork, integer info)

CGETSLS ✨

πŸ’œ Purpose:

!> !> CGETSLS solves overdetermined or underdetermined complex linear systems !> involving an M-by-N matrix A, using a tall skinny QR or short wide LQ !> factorization of A. !> !> It is assumed that A has full rank, and only a rudimentary protection !> against rank-deficient matrices is provided. This subroutine only detects !> exact rank-deficiency, where a diagonal element of the triangular factor !> of A is exactly zero. !> !> It is conceivable for one (or more) of the diagonal elements of the triangular !> factor of A to be subnormally tiny numbers without this subroutine signalling !> an error. The solutions computed for such almost-rank-deficient matrices may !> be less accurate due to a loss of numerical precision. !> !> !> The following options are provided: !> !> 1. If TRANS = 'N' and m >= n: find the least squares solution of !> an overdetermined system, i.e., solve the least squares problem !> minimize || B - A*X ||. !> !> 2. If TRANS = 'N' and m < n: find the minimum norm solution of !> an underdetermined system A * X = B. !> !> 3. If TRANS = 'C' and m >= n: find the minimum norm solution of !> an undetermined system AT * X = B. !> !> 4. If TRANS = 'C' and m < n: find the least squares solution of !> an overdetermined system, i.e., solve the least squares problem !> minimize || B - AT * X ||. !> !> Several right hand side vectors b and solution vectors x can be !> handled in a single call; they are stored as the columns of the !> M-by-NRHS right hand side matrix B and the N-by-NRHS solution !> matrix X. !>

okay so translating the vibe: you hand her a matrix A and a stack of right-hand-side vectors, and she comes back with the least-squares or minimum-norm solution depending on which of the four cases above you landed in. and yes 🫢 β€” multiple RHS at once, stored columnwise in B, solution comes back columnwise too. main character energy, honestly.

⚠️ but listen: she assumes A has full rank, and her rank-deficiency protection is rudimentary β€” she only catches the case where a diagonal element of the triangular factor is exactly zero. subnormally tiny numbers? she will NOT flag them, and your answer may be less accurate because of lost numerical precision. no cap, that's a real caveat πŸ’€

🌸 Parameters

  • TRANS β€” TRANS is CHARACTER*1
    • = 'N': the linear system involves A;
    • = 'C': the linear system involves A**H.
  • M β€” M is INTEGER, the number of rows of the matrix A. M >= 0.
  • N β€” N is INTEGER, the number of columns of the matrix A. N >= 0.
  • NRHS β€” NRHS is INTEGER, the number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >=0.
  • A β€” A is COMPLEX array, dimension (LDA,N)
    • on entry, the M-by-N matrix A.
    • on exit, A is overwritten by details of its QR or LQ factorization as returned by CGEQR or CGELQ. ✨
  • LDA β€” LDA is INTEGER, the leading dimension of the array A. LDA >= max(1,M).
  • B β€” B is COMPLEX array, dimension (LDB,NRHS)
    • on entry, the matrix B of right hand side vectors, stored columnwise; B is M-by-NRHS if TRANS = 'N', or N-by-NRHS if TRANS = 'C'.
    • on exit, if INFO = 0, B is overwritten by the solution vectors, stored columnwise:
      • if TRANS = 'N' and m >= n, rows 1 to n of B contain the least squares solution vectors.
      • if TRANS = 'N' and m < n, rows 1 to N of B contain the minimum norm solution vectors;
      • if TRANS = 'C' and m >= n, rows 1 to M of B contain the minimum norm solution vectors;
      • if TRANS = 'C' and m < n, rows 1 to M of B contain the least squares solution vectors.
  • LDB β€” LDB is INTEGER, the leading dimension of the array B. LDB >= MAX(1,M,N).
  • WORK β€” (workspace) COMPLEX array, dimension (MAX(1,LWORK))
    • on exit, if INFO = 0, WORK(1) contains optimal (or either minimal or optimal, if query was assumed) LWORK.
    • see LWORK for details.
  • LWORK β€” LWORK is INTEGER, the dimension of the array WORK. LWORK >= 1.
    • if LWORK = -1 or -2, then a workspace query is assumed.
    • if LWORK = -1, the routine calculates optimal size of WORK for the optimal performance and returns this value in WORK(1).
    • if LWORK = -2, the routine calculates minimal size of WORK and returns this value in WORK(1). 🧚 so yes, you can ask her "how much room do you need?" before you commit. iconic.
  • INFO β€” INFO is INTEGER
    • = 0: successful exit πŸŽ‰
    • < 0: if INFO = -i, the i-th argument had an illegal value
    • > 0: if INFO = i, the i-th diagonal element of the triangular factor of A is exactly zero, so that A does not have full rank; 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 169 of file cgetsls.f.


πŸ“ subroutine dgetsls (character trans, integer m, integer n, integer nrhs, double precision, dimension( lda, * ) a, integer lda, double precision, dimension( ldb, * ) b, integer ldb, double precision, dimension( * ) work, integer lwork, integer info)

DGETSLS ✨

πŸ’œ Purpose:

!> !> DGETSLS solves overdetermined or underdetermined real linear systems !> involving an M-by-N matrix A, using a tall skinny QR or short wide LQ !> factorization of A. !> !> It is assumed that A has full rank, and only a rudimentary protection !> against rank-deficient matrices is provided. This subroutine only detects !> exact rank-deficiency, where a diagonal element of the triangular factor !> of A is exactly zero. !> !> It is conceivable for one (or more) of the diagonal elements of the triangular !> factor of A to be subnormally tiny numbers without this subroutine signalling !> an error. The solutions computed for such almost-rank-deficient matrices may !> be less accurate due to a loss of numerical precision. !> !> !> The following options are provided: !> !> 1. If TRANS = 'N' and m >= n: find the least squares solution of !> an overdetermined system, i.e., solve the least squares problem !> minimize || B - A*X ||. !> !> 2. If TRANS = 'N' and m < n: find the minimum norm solution of !> an underdetermined system A * X = B. !> !> 3. If TRANS = 'T' and m >= n: find the minimum norm solution of !> an undetermined system AT * X = B. !> !> 4. If TRANS = 'T' and m < n: find the least squares solution of !> an overdetermined system, i.e., solve the least squares problem !> minimize || B - AT * X ||. !> !> Several right hand side vectors b and solution vectors x can be !> handled in a single call; they are stored as the columns of the !> M-by-NRHS right hand side matrix B and the N-by-NRHS solution !> matrix X. !>

same four-case situation as her complex sister, except this is the real version β€” so the transpose flag is 'T', not 'C'. do NOT mix those up bestie, i'm serious πŸ™ˆ

⚠️ same warning, same energy: full rank assumed, rank-deficiency detection is rudimentary, she only sees an exactly zero diagonal element of the triangular factor. subnormally tiny-but-not-zero entries slip right past her and your solution accuracy can suffer from lost numerical precision. πŸ’€

🌸 Parameters

  • TRANS β€” TRANS is CHARACTER*1
    • = 'N': the linear system involves A;
    • = 'T': the linear system involves A**T.
  • M β€” M is INTEGER, the number of rows of the matrix A. M >= 0.
  • N β€” N is INTEGER, the number of columns of the matrix A. N >= 0.
  • NRHS β€” NRHS is INTEGER, the number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >=0.
  • A β€” A is DOUBLE PRECISION array, dimension (LDA,N)
    • on entry, the M-by-N matrix A.
    • on exit, A is overwritten by details of its QR or LQ factorization as returned by DGEQR or DGELQ. ✨
  • LDA β€” LDA is INTEGER, the leading dimension of the array A. LDA >= max(1,M).
  • B β€” B is DOUBLE PRECISION array, dimension (LDB,NRHS)
    • on entry, the matrix B of right hand side vectors, stored columnwise; B is M-by-NRHS if TRANS = 'N', or N-by-NRHS if TRANS = 'T'.
    • on exit, if INFO = 0, B is overwritten by the solution vectors, stored columnwise:
      • if TRANS = 'N' and m >= n, rows 1 to n of B contain the least squares solution vectors.
      • if TRANS = 'N' and m < n, rows 1 to N of B contain the minimum norm solution vectors;
      • if TRANS = 'T' and m >= n, rows 1 to M of B contain the minimum norm solution vectors;
      • if TRANS = 'T' and m < n, rows 1 to M of B contain the least squares solution vectors.
  • LDB β€” LDB is INTEGER, the leading dimension of the array B. LDB >= MAX(1,M,N).
  • WORK β€” (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
    • on exit, if INFO = 0, WORK(1) contains optimal (or either minimal or optimal, if query was assumed) LWORK.
    • see LWORK for details.
  • LWORK β€” okay so this parameter's story is still unfolding and we are picking it up right where it leaves off β€” more in the next part, bestie πŸ’–
  • LWORK β€” INTEGER energy πŸ’… the dimension of the WORK array. LWORK >= 1. If LWORK = -1 or -2, then a workspace query is assumed. If LWORK = -1, the routine calculates optimal size of WORK for the optimal performance and returns this value in WORK(1). If LWORK = -2, the routine calculates minimal size of WORK and returns this value in WORK(1). 🫢
  • INFO β€” INTEGER. Vibe check: = 0: successful exit ✨; < 0: if INFO = -i, the i-th argument had an illegal value 😭; > 0: if INFO = i, the i-th diagonal element of the triangular factor of A is exactly zero, so that A does not have full rank; 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 169 of file dgetsls.f.


🌟 subroutine sgetsls 🌟

subroutine sgetsls (character trans, integer m, integer n, integer nrhs,
    real, dimension( lda, * ) a, integer lda, real, dimension( ldb, * ) b,
    integer ldb, real, dimension( * ) work, integer lwork, integer info)

SGETSLS

πŸ’– Purpose

Okay bestie, SGETSLS solves overdetermined or underdetermined real linear systems involving an M-by-N matrix A, using a tall skinny QR or short wide LQ factorization of A. Yes, the matrix shape really said β€œchoose your fighter” ✨

It is assumed that A has full rank, and only a rudimentary protection against rank-deficient matrices is provided. This subroutine only detects exact rank-deficiency, where a diagonal element of the triangular factor of A is exactly zero. 😭
It is conceivable for one (or more) of the diagonal elements of the triangular factor of A to be subnormally tiny numbers without this subroutine signalling an error. The solutions computed for such almost-rank-deficient matrices may be less accurate due to a loss of numerical precision. πŸ’€

The following options are provided:

  1. If TRANS = 'N' and m >= n: find the least squares solution of an overdetermined system, i.e., solve the least squares problem
minimize || B - A*X ||.
  1. If TRANS = 'N' and m < n: find the minimum norm solution of an underdetermined system A * X = B.
  2. If TRANS = 'T' and m >= n: find the minimum norm solution of an undetermined system A**T * X = B.
  3. If TRANS = 'T' and m < n: find the least squares solution of an overdetermined system, i.e., solve the least squares problem
minimize || B - A**T * X ||.

Several right hand side vectors b and solution vectors x can be handled in a single call; they are stored as the columns of the M-by-NRHS right hand side matrix B and the N-by-NRHS solution matrix X.

πŸŽ€ Parameters

  • TRANS β€” TRANS is CHARACTER*1. = 'N': the linear system involves A; = 'T': the linear system involves A**T. πŸŒ€
  • M β€” M is INTEGER. The number of rows of the matrix A. M >= 0.
  • N β€” N is INTEGER. The number of columns of the matrix A. N >= 0.
  • NRHS β€” NRHS is INTEGER. The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >=0.
  • A β€” A is REAL array, dimension (LDA,N). On entry, the M-by-N matrix A. On exit, A is overwritten by details of its QR or LQ factorization as returned by SGEQR or SGELQ. ✨
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B β€” B is REAL array, dimension (LDB,NRHS). On entry, the matrix B of right hand side vectors, stored columnwise; B is M-by-NRHS if TRANS = 'N', or N-by-NRHS if TRANS = 'T'. On exit, if INFO = 0, B is overwritten by the solution vectors, stored columnwise:
    • if TRANS = 'N' and m >= n, rows 1 to n of B contain the least squares solution vectors.
    • if TRANS = 'N' and m < n, rows 1 to N of B contain the minimum norm solution vectors;
    • if TRANS = 'T' and m >= n, rows 1 to M of B contain the minimum norm solution vectors;
    • if TRANS = 'T' and m < n, rows 1 to M of B contain the least squares solution vectors.
  • LDB β€” LDB is INTEGER. The leading dimension of the array B. LDB >= MAX(1,M,N).
  • WORK β€” (workspace) REAL array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) contains optimal (or either minimal or optimal, if query was assumed) LWORK. See LWORK for details.
  • LWORK β€” LWORK is INTEGER. The dimension of the array WORK. LWORK >= 1. If LWORK = -1 or -2, then a workspace query is assumed. If LWORK = -1, the routine calculates optimal size of WORK for the optimal performance and returns this value in WORK(1). If LWORK = -2, the routine calculates minimal size of WORK and returns this value in WORK(1). 🫢
  • INFO β€” INFO is INTEGER. = 0: successful exit ✨; < 0: if INFO = -i, the i-th argument had an illegal value 😭; > 0: if INFO = i, the i-th diagonal element of the triangular factor of A is exactly zero, so that A does not have full rank; 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 169 of file sgetsls.f.


🌈 subroutine zgetsls 🌈

subroutine zgetsls (character trans, integer m, integer n, integer nrhs,
    complex*16, dimension( lda, * ) a, integer lda, complex*16, dimension(
    ldb, * ) b, integer ldb, complex*16, dimension( * ) work, integer lwork,
    integer info)

ZGETSLS

πŸ’– Purpose

Bestie, ZGETSLS is the complex-valued version and it solves overdetermined or underdetermined complex linear systems involving an M-by-N matrix A, using a tall skinny QR or short wide LQ factorization of A. The math is serving looks ✨

It is assumed that A has full rank, and only a rudimentary protection against rank-deficient matrices is provided. This subroutine only detects exact rank-deficiency, where a diagonal element of the triangular factor of A is exactly zero. 😭
It is conceivable for one (or more) of the diagonal elements of the triangular factor of A to be subnormally tiny numbers without this subroutine signalling an error. The solutions computed for such almost-rank-deficient matrices may be less accurate due to a loss of numerical precision. πŸ’€

The following options are provided:

  1. If TRANS = 'N' and m >= n: find the least squares solution of an overdetermined system, i.e., solve the least squares problem
minimize || B - A*X ||.
  1. If TRANS = 'N' and m < n: find the minimum norm solution of an underdetermined system A * X = B.
  2. If TRANS = 'C' and m >= n: find the minimum norm solution of an undetermined system A**T * X = B.
  3. If TRANS = 'C' and m < n: find the least squares solution of an overdetermined system, i.e., solve the least squares problem
minimize || B - A**T * X ||.

Several right hand side vectors b and solution vectors x can be handled in a single call; they are stored as the columns of the M-by-NRHS right hand side matrix B and the N-by-NRHS solution matrix X.

πŸŽ€ Parameters

  • TRANS β€” TRANS is CHARACTER*1. = 'N': the linear system involves A; = 'C': the linear system involves A**H. πŸŒ€
  • M β€” M is INTEGER. The number of rows of the matrix A. M >= 0.
  • N β€” N is INTEGER. The number of columns of the matrix A. N >= 0.
  • NRHS β€” NRHS is INTEGER. The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >=0.
  • A β€” A is COMPLEX*16 array, dimension (LDA,N). On entry, the M-by-N matrix A. On exit, A is overwritten by details of its QR or LQ factorization as returned by ZGEQR or ZGELQ. ✨
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B β€” B is COMPLEX*16 array, dimension (LDB,NRHS). On entry, the matrix B of right hand side vectors, stored columnwise; B is M-by-NRHS if TRANS = 'N', or N-by-NRHS if TRANS = 'C'. On exit, if INFO = 0, B is overwritten by the solution vectors, stored columnwise:
    • if TRANS = 'N' and m >= n, rows 1 to n of B contain the least squares solution vectors.
    • if TRANS = 'N' and m < n, rows 1 to N of B contain the minimum norm solution vectors;
    • if TRANS = 'C' and m >= n, rows 1 to M of B contain the minimum norm solution vectors;
    • if TRANS = 'C' and m < n, rows 1 to M of B contain the least squares solution vectors.
  • LDB β€” LDB is INTEGER. The leading dimension of the array B. LDB >= MAX(1,M,N).
  • WORK β€”
  • WORK β€” okay so bestie, this is the (workspace) COMPLEX*16 array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) contains optimal (or either minimal or optimal, if query was assumed) LWORK. See LWORK for details. πŸ’…
  • LWORK β€” LWORK is INTEGER. It's the dimension of the array WORK. LWORK >= 1. If LWORK = -1 or -2, then a workspace query is assumed. If LWORK = -1, the routine calculates optimal size of WORK for the optimal performance and returns this value in WORK(1). If LWORK = -2, the routine calculates minimal size of WORK and returns this value in WORK(1). ✨
  • INFO β€” INFO is INTEGER
    • INFO = 0: successful exit
    • INFO < 0: if INFO = -i, the i-th argument had an illegal value
    • INFO > 0: if INFO = i, the i-th diagonal element of the triangular factor of A is exactly zero, so that A does not have full rank; the least squares solution could not be computed.
Real talk: that INFO > 0 case is the β€œno full rank, no least squares solution” situation β€” it's giving error, not slay. 😭

Author

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

Definition at line 169 of file zgetsls.f.

Author

Generated automatically by Doxygen for LAPACK from the source code.


That's the whole page, bestie β€” footer source/version deets: LAPACK, Version 3.12.0, getsls(3); the date is MIA in this copy and I'm not inventing one. πŸ«ΆπŸ’–

πŸ“¦ where this page comes from