SRC/sgeqr.f(3)
β¨ SRC/sgeqr.f β¨
okay bestie, this page is from the <pink>LAPACK</pink> manual, and it's literally the glow-up guide for sgeqr π
a Fortran subroutine that does QR factorization and hands you back the Q data structure like a little gift π
πΈ NAME πΈ
SRC/sgeqr.f β no cap, that's the whole name. It's giving "file path as a title" energy and honestly? iconic.
π¦ SYNOPSIS π¦
Functions/Subroutines
subroutine sgeqr (m, n, a, lda, t, tsize, work, lwork, info)β the one, the only,SGEQRβ¨
π Function/Subroutine Documentation π
subroutine sgeqr (integer m, integer n, real, dimension( lda, * ) a, integer
lda, real, dimension( * ) t, integer tsize, real, dimension( * ) work,
integer lwork, integer info)
SGEQR β she's the main character fr fr π
π Purpose π
!>
!> SGEQR computes a QR factorization of a real M-by-N matrix A:
!>
!> A = Q * ( R ),
!> ( 0 )
!>
!> where:
!>
!> Q is a M-by-M orthogonal matrix;
!> R is an upper-triangular N-by-N matrix;
!> 0 is a (M-N)-by-N zero matrix, if M > N.
!>
!>
so basically A gets factored into Q times that stacked ( R ) over ( 0 ) situation, and yes the zero block is only a thing when M > N π«Ά
π§ Parameters π§
okay let's go through the whole squad one by one, no skipping, we don't do that here π
MβM is INTEGER. The number of rows of the matrixA.M >= 0. that's it that's the row count bestie πNβN is INTEGER. The number of columns of the matrixA.N >= 0. the column count, we love a non-negative queen πΈAβA is REAL array, dimension (LDA,N). On entry, the M-by-N matrixA. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrixR(Ris upper triangular ifM >= N); the elements below the diagonal are used to store part of the data structure to representQ. okay so she comes in as your matrix and leaves as R up top + sneaky Q data down below, highkey efficient β¨LDAβLDA is INTEGER. The leading dimension of the arrayA.LDA >= max(1,M). respect the leading dimension or else πTβT is REAL array, dimension (MAX(5,TSIZE)). On exit, ifINFO = 0,T(1)returns optimal (or either minimal or optimal, if query is assumed)TSIZE. SeeTSIZEfor details. RemainingTcontains part of the data structure used to representQ. If one wants to apply or constructQ, then one needs to keepT(in addition toA) and pass it to further subroutines. π keepT! like genuinely do not throw her away, she's part of the Q lore, she travels withAto the next subroutine, iykykTSIZEβTSIZE is INTEGER. IfTSIZE >= 5, the dimension of the arrayT. IfTSIZE = -1or-2, then a workspace query is assumed. The routine only calculates the sizes of theTandWORKarrays, returns these values as the first entries of theTandWORKarrays, and no error message related toTorWORKis issued byXERBLA. IfTSIZE = -1, the routine calculates optimal size ofTfor the optimum performance and returns this value inT(1). IfTSIZE = -2, the routine calculates minimal size ofTand returns this value inT(1). so-1is the "give me the optimal slay" option and-2is the "give me the minimal slay" option, choose your vibe πWORKβ(workspace) REAL 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. π«Ά note that theWORKarray itself can be yeeted after exit β she's just scratch, no feelings attachedLWORKβLWORK is INTEGER. The dimension of the arrayWORK.LWORK >= 1. IfLWORK = -1or-2, then a workspace query is assumed. The routine only calculates the sizes of theTandWORKarrays, returns these values as the first entries of theTandWORKarrays, and no error message related toTorWORKis issued byXERBLA. 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). yes the-1/-2query thing applies here too, she's consistent πINFOβINFO is INTEGER.= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value π
β Author β
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
the whole academic friend group co-signed this one, we stan π
π Further Details π
!>
!> The goal of the interface is to give maximum freedom to the developers for
!> creating any QR factorization algorithm they wish. The triangular
!> (trapezoidal) R has to be stored in the upper part of A. The lower part of A
!> and the array T can be used to store any relevant information for applying or
!> constructing the Q factor. The WORK array can safely be discarded after exit.
!>
!> Caution: One should not expect the sizes of T and WORK to be the same from one
!> LAPACK implementation to the other, or even from one execution to the other.
!> A workspace query (for T and WORK) is needed at each execution. However,
!> for a given execution, the size of T and WORK are fixed and will not change
!> from one query to the next.
!>
!>
the whole point of this interface is maximum freedom for developers to build whatever QR algorithm they want β R (triangular/trapezoidal) lives in the upper part of A, the lower part of A plus T hold whatever they need for Q, and WORK can be safely discarded after exit π§
β οΈ Caution, for real: do not expect the sizes ofTandWORKto match between LAPACK implementations, or even between one execution and the next π you need a workspace query (for bothTandWORK) at each execution. that said, for a given execution, the sizes ofTandWORKare fixed and won't change from one query to the next, so at least she's loyal within a run π«Ά
π Further Details particular to this LAPACK implementation: π
!>
!> These details are particular for this LAPACK implementation. Users should not
!> take them for granted. These details may change in the future, and are not likely
!> true for another LAPACK implementation. These details are relevant if one wants
!> to try to understand the code. They are not part of the interface.
!>
!> In this version,
!>
!> T(2): row block size (MB)
!> T(3): column block size (NB)
!> T(6:TSIZE): data structure needed for Q, computed by
!> SLATSQR or SGEQRT
!>
!> Depending on the matrix dimensions M and N, and row and column
!> block sizes MB and NB returned by ILAENV, SGEQR will use either
!> SLATSQR (if the matrix is tall-and-skinny) or SGEQRT to compute
!> the QR factorization.
!>
!>
okay so this section is implementation tea β it's specific to this LAPACK build, don't take it for granted bestie, it might change in the future and it's probably not true for another LAPACK implementation π³ these details are only relevant if you want to actually understand the code β they are not part of the interface.
in this version:
T(2): row block size (MB)T(3): column block size (NB)T(6:TSIZE): data structure needed forQ, computed bySLATSQRorSGEQRT
and depending on the matrix dimensions M and N, and row and column block sizes MB and NB returned by ILAENV, SGEQR will use either SLATSQR (if the matrix is tall-and-skinny π¦) or SGEQRT to compute the QR factorization. she picks her algorithm based on your matrix's body type, lowkey iconic π
π Definition at line 174 of file sgeqr.f. π
line one-seven-four, if you were wondering where to find her in the source π
π Author π
Generated automatically by Doxygen for LAPACK from the source code. the robots wrote the docs, we just added the sparkle β¨
LAPACK β Version 3.12.0 β SRC/sgeqr.f(3)
and that's the whole page bestie π«Ά sgeqr said "I'll factor your QR, I'll keep my data in T, and I will absolutely make you do a workspace query every single execution" and honestly? respect the boundaries. mwah π
π¦ 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