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
CGEQRorCGELQ. β¨
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 ifTRANS = '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.
- if
- on entry, the matrix B of right hand side vectors, stored columnwise; B is M-by-NRHS if
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
LWORKfor details.
- on exit, if
LWORKβLWORK is INTEGER, the dimension of the array WORK.LWORK >= 1.- if
LWORK = -1or-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 inWORK(1). - if
LWORK = -2, the routine calculates minimal size of WORK and returns this value inWORK(1). π§ so yes, you can ask her "how much room do you need?" before you commit. iconic.
- if
INFOβINFO is INTEGER= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value> 0: ifINFO = 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
DGEQRorDGELQ. β¨
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 ifTRANS = '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.
- if
- on entry, the matrix B of right hand side vectors, stored columnwise; B is M-by-NRHS if
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
LWORKfor details.
- on exit, if
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βINTEGERenergy π the dimension of theWORKarray.LWORK >= 1. IfLWORK = -1or-2, then a workspace query is assumed. IfLWORK = -1, the routine calculates optimal size ofWORKfor the optimal performance and returns this value inWORK(1). IfLWORK = -2, the routine calculates minimal size ofWORKand returns this value inWORK(1). π«ΆINFOβINTEGER. Vibe check:= 0: successful exit β¨;< 0: ifINFO = -i, the i-th argument had an illegal value π;> 0: ifINFO = i, the i-th diagonal element of the triangular factor ofAis exactly zero, so thatAdoes 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 thatAhas 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 ofAis 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:
- If
TRANS = 'N'andm >= n: find the least squares solution of an overdetermined system, i.e., solve the least squares problem
minimize || B - A*X ||.
- If
TRANS = 'N'andm < n: find the minimum norm solution of an underdetermined systemA * X = B. - If
TRANS = 'T'andm >= n: find the minimum norm solution of an undetermined systemA**T * X = B. - If
TRANS = 'T'andm < 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βTRANSisCHARACTER*1.= 'N': the linear system involvesA;= 'T': the linear system involvesA**T. πMβMisINTEGER. The number of rows of the matrixA.M >= 0.NβNisINTEGER. The number of columns of the matrixA.N >= 0.NRHSβNRHSisINTEGER. The number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >=0.AβAisREALarray, dimension(LDA,N). On entry, theM-by-NmatrixA. On exit,Ais overwritten by details of its QR or LQ factorization as returned bySGEQRorSGELQ. β¨LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).BβBisREALarray, dimension(LDB,NRHS). On entry, the matrixBof right hand side vectors, stored columnwise;BisM-by-NRHSifTRANS = 'N', orN-by-NRHSifTRANS = 'T'. On exit, ifINFO = 0,Bis overwritten by the solution vectors, stored columnwise:- if
TRANS = 'N'andm >= n, rows1tonofBcontain the least squares solution vectors. - if
TRANS = 'N'andm < n, rows1toNofBcontain the minimum norm solution vectors; - if
TRANS = 'T'andm >= n, rows1toMofBcontain the minimum norm solution vectors; - if
TRANS = 'T'andm < n, rows1toMofBcontain the least squares solution vectors.
- if
LDBβLDBisINTEGER. The leading dimension of the arrayB.LDB >= MAX(1,M,N).WORKβ (workspace)REALarray, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)contains optimal (or either minimal or optimal, if query was assumed)LWORK. SeeLWORKfor details.LWORKβLWORKisINTEGER. The dimension of the arrayWORK.LWORK >= 1. IfLWORK = -1or-2, then a workspace query is assumed. IfLWORK = -1, the routine calculates optimal size ofWORKfor the optimal performance and returns this value inWORK(1). IfLWORK = -2, the routine calculates minimal size ofWORKand returns this value inWORK(1). π«ΆINFOβINFOisINTEGER.= 0: successful exit β¨;< 0: ifINFO = -i, the i-th argument had an illegal value π;> 0: ifINFO = i, the i-th diagonal element of the triangular factor ofAis exactly zero, so thatAdoes 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 thatAhas 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 ofAis 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:
- If
TRANS = 'N'andm >= n: find the least squares solution of an overdetermined system, i.e., solve the least squares problem
minimize || B - A*X ||.
- If
TRANS = 'N'andm < n: find the minimum norm solution of an underdetermined systemA * X = B. - If
TRANS = 'C'andm >= n: find the minimum norm solution of an undetermined systemA**T * X = B. - If
TRANS = 'C'andm < 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βTRANSisCHARACTER*1.= 'N': the linear system involvesA;= 'C': the linear system involvesA**H. πMβMisINTEGER. The number of rows of the matrixA.M >= 0.NβNisINTEGER. The number of columns of the matrixA.N >= 0.NRHSβNRHSisINTEGER. The number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >=0.AβAisCOMPLEX*16array, dimension(LDA,N). On entry, theM-by-NmatrixA. On exit,Ais overwritten by details of its QR or LQ factorization as returned byZGEQRorZGELQ. β¨LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).BβBisCOMPLEX*16array, dimension(LDB,NRHS). On entry, the matrixBof right hand side vectors, stored columnwise;BisM-by-NRHSifTRANS = 'N', orN-by-NRHSifTRANS = 'C'. On exit, ifINFO = 0,Bis overwritten by the solution vectors, stored columnwise:- if
TRANS = 'N'andm >= n, rows1tonofBcontain the least squares solution vectors. - if
TRANS = 'N'andm < n, rows1toNofBcontain the minimum norm solution vectors; - if
TRANS = 'C'andm >= n, rows1toMofBcontain the minimum norm solution vectors; - if
TRANS = 'C'andm < n, rows1toMofBcontain the least squares solution vectors.
- if
LDBβLDBisINTEGER. The leading dimension of the arrayB.LDB >= MAX(1,M,N).WORKβWORKβ okay so bestie, this is the(workspace) COMPLEX*16 array, dimension (MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)contains optimal (or either minimal or optimal, if query was assumed)LWORK. SeeLWORKfor details. πLWORKβLWORK is INTEGER. It's the dimension of the arrayWORK.LWORK >= 1. IfLWORK = -1or-2, then a workspace query is assumed. IfLWORK = -1, the routine calculates optimal size ofWORKfor the optimal performance and returns this value inWORK(1). IfLWORK = -2, the routine calculates minimal size ofWORKand returns this value inWORK(1). β¨INFOβINFO is INTEGERINFO = 0: successful exitINFO < 0: ifINFO = -i, thei-th argument had an illegal valueINFO > 0: ifINFO = i, thei-th diagonal element of the triangular factor ofAis exactly zero, so thatAdoes 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
- 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