variantsGEcomputational(3)
๐ variantsGEcomputational(3) ๐
okay bestie, this is variantsGEcomputational(3) from LAPACK โ the page all about the Variants Computational routines. it's a long one so we're doing this in parts, stay with me ๐ซถ
๐ธ NAME ๐ธ
variantsGEcomputational โ Variants Computational routines โจ
โจ SYNOPSIS โจ
๐ง Functions ๐ง
subroutine cgetrf (M, N, A, LDA, IPIV, INFO)โ CGETRF VARIANT: Crout Level 3 BLAS version of the algorithm. ๐subroutine dgetrf (M, N, A, LDA, IPIV, INFO)โ DGETRF VARIANT: Crout Level 3 BLAS version of the algorithm. ๐subroutine sgetrf (M, N, A, LDA, IPIV, INFO)โ SGETRF VARIANT: Crout Level 3 BLAS version of the algorithm. ๐subroutine zgetrf (M, N, A, LDA, IPIV, INFO)โ ZGETRF VARIANT: Crout Level 3 BLAS version of the algorithm. ๐subroutine cgeqrf (M, N, A, LDA, TAU, WORK, LWORK, INFO)โ CGEQRF VARIANT: left-looking Level 3 BLAS version of the algorithm. ๐subroutine dgeqrf (M, N, A, LDA, TAU, WORK, LWORK, INFO)โ DGEQRF VARIANT: left-looking Level 3 BLAS version of the algorithm. ๐subroutine sgeqrf (M, N, A, LDA, TAU, WORK, LWORK, INFO)โ SGEQRF VARIANT: left-looking Level 3 BLAS version of the algorithm. ๐subroutine zgeqrf (M, N, A, LDA, TAU, WORK, LWORK, INFO)โ ZGEQRF VARIANT: left-looking Level 3 BLAS of the algorithm. ๐
๐ฆ Detailed Description ๐ฆ
This is the group of Variants Computational routines. periodt. ๐
๐ Function Documentation ๐
๐ subroutine cgeqrf (integer M, integer N, complex, dimension( lda, * ) A, integer LDA, complex, dimension( * ) TAU, complex, dimension( * ) WORK, integer LWORK, integer INFO) ๐
CGEQRF VARIANT: left-looking Level 3 BLAS version of the algorithm. no cap, this is the one that goes left-looking. โจ
๐ Purpose:
CGEQRF computes a QR factorization of a real M-by-N matrix A:
A = Q * R.
This is the left-looking Level 3 BLAS version of the algorithm. ๐
๐ Parameters
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.
A
A is COMPLEX array, dimension (LDA,N) On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix R (R is upper triangular if m >= n); the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors (see Further Details).
LDA
LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TAU
TAU is COMPLEX array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).
WORK
WORK is COMPLEX 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 >= 1 if MIN(M,N) = 0, otherwise the dimension can be divided into three parts.
- The part for the triangular factor T. If the very last T is not bigger than any of the rest, then this part is
NB x ceiling(K/NB), otherwise,NB x (K-NT), whereK = min(M,N)andNTis the dimension of the very last T. - The part for the very last T when T is bigger than any of the rest T. The size of this part is
NT x NT, whereNT = K - ceiling ((K-NX)/NB) x NB, whereK = min(M,N),NXis calculated by
NX = MAX( 0, ILAENV( 3, 'CGEQRF', ' ', M, N, -1, -1 ) )
- The part for
dlarfbis of sizemax((N-M)*K, (N-M)*NB, K*NB, NB*NB)
So LWORK = part1 + part2 + part3 ๐
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
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ Date
December 2016
๐ Further Details
The matrix Q is represented as a product of elementary reflectors
Q = H(1) H(2) . . . H(k), where k = min(m,n).
Each H(i) has the form
H(i) = I - tau * v * v'
where tau is a real scalar, and v is a real vector with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i).
๐ subroutine cgetrf (integer M, integer N, complex, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, integer INFO) ๐
CGETRF VARIANT: Crout Level 3 BLAS version of the algorithm. CGETRF VARIANT: iterative version of Sivan Toledo's recursive LU algorithm
CGETRF VARIANT: left-looking Level 3 BLAS version of the algorithm.
yeah bestie, this one's got THREE whole variants living in it. iconic. ๐
๐ Purpose: (the Crout Level 3 BLAS one)
CGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This is the Crout Level 3 BLAS version of the algorithm. ๐
๐ Parameters
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.
A
A is COMPLEX array, dimension (LDA,N) On entry, the M-by-N matrix to be factored. On exit, the factors L and U from the factorization A = P*L*U; the unit diagonal elements of L are not stored.
LDA
LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
IPIV
IPIV is INTEGER array, dimension (min(M,N)) The pivot indices; for 1 <= i <= min(M,N), row i of the matrix was interchanged with row IPIV(i).
INFO
INFO is INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value > 0: if INFO = i, U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations. ๐จ
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ Date
December 2016
๐ Purpose: (the left-looking Level 3 BLAS one)
CGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This is the left-looking Level 3 BLAS version of the algorithm. ๐
๐ Parameters
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.
A
A is COMPLEX array, dimension (LDA,N) On entry, the M-by-N matrix to be factored. On exit, the factors L and U from the factorization A = P*L*U; the unit diagonal elements of L are not stored.
LDA
LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
IPIV
IPIV is INTEGER array, dimension (min(M,N)) The pivot indices; for 1 <= i <= min(M,N), row i of the matrix was interchanged with row IPIV(i).
INFO
INFO is INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value > 0: if INFO = i, U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations. ๐จ
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ Date
December 2016
๐ Purpose: (the iterative Sivan Toledo one, and yes she's a whole vibe)
CGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This code implements an iterative version of Sivan Toledo's recursive LU algorithm[1]. For square matrices, this iterative versions should be within a factor of two of the optimum number of memory transfers. ๐ฅ
The pattern is as follows, with the large blocks of U being updated in one call to DTRSM, and the dotted lines denoting sections that have had all pending permutations applied:
1 2 3 4 5 6 7 8
+-+-+---+-------+------
| |1| | |
|.+-+ 2 | |
| | | | |
|.|.+-+-+ 4 |
| | | |1| |
| | |.+-+ |
| | | | | |
|.|.|.|.+-+-+---+ 8
| | | | | |1| |
| | | | |.+-+ 2 |
| | | | | | | |
| | | | |.|.+-+-+
| | | | | | | |1|
| | | | | | |.+-+
| | | | | | | | |
|.|.|.|.|.|.|.|.+-----
| | | | | | | | |
The 1-2-1-4-1-2-1-8-... pattern is the position of the last 1 bit in the binary expansion of the current column. Each Schur update is applied as soon as the necessary portion of U is available. ๐ง
[1] Toledo, S. 1997. Locality of Reference in LU Decomposition with Partial Pivoting. SIAM J. Matrix Anal. Appl. 18, 4 (Oct. 1997), 1065-1081. http://dx.doi.org/10.1137/S0895479896297744
๐ Parameters
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.
A
A is COMPLEX array, dimension (LDA,N) On entry, the M-by-N matrix to be factored. On exit, the factors L and U from the factorization A = P*L*U; the unit diagonal elements of L are not stored.
LDALDAโINTEGER, the leading dimension of the arrayA. Rule of thumb:LDA >= max(1,M). No negotiating ๐IPIVโ anINTEGERarray, dimension(min(M,N)), and it's literally the receipt of every swap ๐ these are the pivot indices; for1 <= i <= min(M,N), rowiof the matrix was interchanged with rowIPIV(i).INFOโINTEGER, the final vibe check:
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
> 0: if INFO = i, U(i,i) is exactly zero. The factorization
has been completed, but the factor U is exactly
singular, and division by zero will occur if it is used
to solve a system of equations.
Heads up bestie: anINFO = i > 0meansU(i,i)is exactly zero โ the factorization finished, sure, but the factorUis exactly singular, and if you go use it to solve a system of equations, division by zero is gonna happen. Not a drill. ๐ญ
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Date ๐
December 2016
subroutine dgeqrf (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer LWORK, integer INFO)
DGEQRF VARIANT: left-looking Level 3 BLAS version of the algorithm.
Purpose โจ
DGEQRF computes a QR factorization of a real M-by-N matrix A:
A = Q * R.
This is the left-looking Level 3 BLAS version of the algorithm. Obsessed, honestly.
Parameters ๐ซถ
MโINTEGER. The number of rows of the matrixA.M >= 0.NโINTEGER. The number of columns of the matrixA.N >= 0.AโDOUBLE PRECISIONarray, dimension(LDA,N). On entry, the M-by-N matrixA. On exit, the elements on and above the diagonal of the array contain themin(M,N)-by-Nupper trapezoidal matrixR(Ris upper triangular ifm >= n); the elements below the diagonal, with the arrayTAU, represent the orthogonal matrixQas a product ofmin(m,n)elementary reflectors (see Further Details). It's giving glow-up ๐LDAโINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).TAUโDOUBLE PRECISIONarray, dimension(min(M,N)). The scalar factors of the elementary reflectors (see Further Details).WORKโDOUBLE PRECISIONarray, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. She's an overachiever โจLWORKโINTEGER. The dimension of the arrayWORK.LWORK >= 1ifMIN(M,N) = 0, otherwise the dimension can be divided into three parts:- The part for the triangular factor
T. If the very lastTis not bigger than any of the rest, then this part isNB x ceiling(K/NB), otherwise,NB x (K-NT), whereK = min(M,N)andNTis the dimension of the very lastT. - The part for the very last
TwhenTis bigger than any of the restT. The size of this part isNT x NT, whereNT = K - ceiling ((K-NX)/NB) x NB, whereK = min(M,N),NXis calculated byNX = MAX( 0, ILAENV( 3, 'DGEQRF', ' ', M, N, -1, -1 ) ). - The part for
dlarfbis of sizemax((N-M)*K, (N-M)*NB, K*NB, NB*NB).
- The part for the triangular factor
So LWORK = part1 + part2 + part3. Math girlies, this one's for you ๐
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. Sneaky but iconic.
INFOโ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.
Date ๐
December 2016
Further Details ๐
The matrix Q is represented as a product of elementary reflectors
Q = H(1) H(2) . . . H(k), where k = min(m,n).
Each H(i) has the form
H(i) = I - tau * v * v'
where tau is a real scalar, and v is a real vector with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i). That's the whole lore ๐ฆ
subroutine dgetrf (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, integer INFO)
DGETRF VARIANT: Crout Level 3 BLAS version of the algorithm. DGETRF VARIANT: iterative version of Sivan Toledo's recursive LU algorithm
DGETRF VARIANT: left-looking Level 3 BLAS version of the algorithm.
Three variants in one coat, she contains multitudes. ๐ง
Purpose ๐ฅ (Crout Level 3 BLAS version)
DGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This is the Crout Level 3 BLAS version of the algorithm.
Parameters ๐ซถ
MโINTEGER. The number of rows of the matrixA.M >= 0.NโINTEGER. The number of columns of the matrixA.N >= 0.AโDOUBLE PRECISIONarray, dimension(LDA,N). On entry, the M-by-N matrix to be factored. On exit, the factorsLandUfrom the factorizationA = P*L*U; the unit diagonal elements ofLare not stored. (She's minimal, she's efficient ๐ )LDAโINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).IPIVโINTEGERarray, dimension(min(M,N)). The pivot indices; for1 <= i <= min(M,N), rowiof the matrix was interchanged with rowIPIV(i).INFOโINTEGER:= 0: successful exit ๐ธ< 0: ifINFO = -i, the i-th argument had an illegal value ๐> 0: ifINFO = i,U(i,i)is exactly zero. The factorization has been completed, but the factorUis exactly singular, and division by zero will occur if it is used to solve a system of equations. Trauma. ๐ญ
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Date ๐
December 2016
Purpose โจ (left-looking Level 3 BLAS version)
DGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This is the left-looking Level 3 BLAS version of the algorithm.
Parameters ๐ซถ
MโINTEGER. The number of rows of the matrixA.M >= 0.NโINTEGER. The number of columns of the matrixA.N >= 0.AโDOUBLE PRECISIONarray, dimension(LDA,N). On entry, the M-by-N matrix to be factored. On exit, the factorsLandUfrom the factorizationA = P*L*U; the unit diagonal elements ofLare not stored.LDAโINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).IPIVโINTEGERarray, dimension(min(M,N)). The pivot indices; for1 <= i <= min(M,N), rowiof the matrix was interchanged with rowIPIV(i).INFOโINTEGER:= 0: successful exit ๐ธ< 0: ifINFO = -i, the i-th argument had an illegal value ๐> 0: ifINFO = i,U(i,i)is exactly zero. The factorization has been completed, but the factorUis exactly singular, and division by zero will occur if it is used to solve a system of equations.
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Date ๐
December 2016
Purpose ๐ (iterative version of Sivan Toledo's recursive LU algorithm)
DGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This code implements an iterative version of Sivan Toledo's recursive LU algorithm[1]. For square matrices, this iterative versions should be within a factor of two of the optimum number of memory transfers. Lowkey a flex ๐ฅ
The pattern is as follows, with the large blocks of U being updated in one call to DTRSM, and the dotted lines denoting sections that have had all pending permutations applied:
1 2 3 4 5 6 7 8
+-+---+---+-------+------
| |1| | |
|.+-+ 2 | |
| | | | |
|.|.+-+-+ 4 |
| | | |1| |
| | |.+-+ |
| | | | | |
|.|.|.|.+-+-+---+ 8
| | | | | |1| |
| | | | |.+-+ 2 |
| | | | | | | |
| | | | |.|.+-+-+
| | | | | | | |1|
| | | | | | |.+-+
| | | | | | | | |
|.|.|.|.|.|.|.|.+-----
| | | | | | | | |
The 1-2-1-4-1-2-1-8-... pattern is the position of the last 1 bit in the binary expansion of the current column. Each Schur update is applied as soon as the necessary portion of U is available. It's giving fractal energy, she ate ๐
[1] Toledo, S. 1997. Locality of Reference in LU Decomposition with Partial Pivoting. SIAM J. Matrix Anal. Appl. 18, 4 (Oct. 1997), 1065-1081. http://dx.doi.org/10.1137/S0895479896297744
Parameters ๐ซถ
MโINTEGER. The number of rows of the matrixA.M >= 0.NโINTEGER. The number of columns of the matrixA.N >= 0.AโDOUBLE PRECISIONarray, dimension(LDA,N). On entry, the M-by-N matrix to be factored. On exit, the factorsLandUfrom the factorizationA = P*L*U; the unit diagonal elements ofLare not stored.LDAโINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).IPIVIPIVโIPIVis INTEGER array, dimension(min(M,N))โ the pivot indices, bestie. For1 <= i <= min(M,N), row i of the matrix got swapped with rowIPIV(i). That's the tea. ๐INFOโINFOis INTEGER, and here's the vibe check:= 0: successful exit โจ< 0: ifINFO = -i, the i-th argument had an illegal value (not me being dramatic, that's literally what it means ๐)> 0: ifINFO = i,U(i,i)is exactly zero. The factorization has been completed, but the factorUis exactly singular, and division by zero will occur if it is used to solve a system of equations. So likeโฆ genuinely do not do that. ๐
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ Date
December 2016
๐ sgeqrf โ the QR one, she's iconic
subroutine sgeqrf (integer M, integer N, real, dimension( lda, * ) A,
integer LDA, real, dimension( * ) TAU, real, dimension( * ) WORK,
integer LWORK, integer INFO)
SGEQRF VARIANT: left-looking Level 3 BLAS version of the algorithm.
โจ Purpose
SGEQRF computes a QR factorization of a real M-by-N matrix A:
A = Q * R.
This is the left-looking Level 3 BLAS version of the algorithm. She's the glow-up edition, periodt. ๐
๐ธ Parameters
MโMis INTEGER. The number of rows of the matrixA.M >= 0.NโNis INTEGER. The number of columns of the matrixA.N >= 0.AโAis REAL array, dimension(LDA,N).- On entry, the M-by-N matrix
A. - 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, with the arrayTAU, represent the orthogonal matrixQas a product ofmin(m,n)elementary reflectors (see Further Details).
- On entry, the M-by-N matrix
LDAโLDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).TAUโTAUis REAL array, dimension(min(M,N)). The scalar factors of the elementary reflectors (see Further Details). She's little but she matters ๐ซถWORKโWORKis REAL array, dimension(MAX(1,LWORK)).- On exit, if
INFO = 0,WORK(1)returns the optimalLWORK.
- On exit, if
LWORKโLWORKis INTEGER.
The dimension of the array WORK. LWORK >= 1 if MIN(M,N) = 0, otherwise the dimension can be divided into three parts. Yes, three. She's got layers, like an onion, or a group chat. ๐ง
- The part for the triangular factor
T. If the very lastTis not bigger than any of the rest, then this part isNB x ceiling(K/NB), otherwise,NB x (K-NT), whereK = min(M,N)andNTis the dimension of the very lastT - The part for the very last
TwhenTis bigger than any of the restT. The size of this part isNT x NT, whereNT = K - ceiling ((K-NX)/NB) x NB, whereK = min(M,N),NXis calculated by
NX = MAX( 0, ILAENV( 3, 'SGEQRF', ' ', M, N, -1, -1 ) )
- The part for
dlarfbis of sizemax((N-M)*K, (N-M)*NB, K*NB, NB*NB)
So LWORK = part1 + part2 + part3
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. It's giving "just asking, no commitment" energy. ๐
INFOโINFOis 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.
๐ Date
December 2016
๐ Further Details
The matrix Q is represented as a product of elementary reflectors
Q = H(1) H(2) . . . H(k), where k = min(m,n).
Each H(i) has the form
H(i) = I - tau * v * v'
where tau is a real scalar, and v is a real vector with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i).
๐ฆ sgetrf โ the LU one, and she contains multitudes
subroutine sgetrf (integer M, integer N, real, dimension( lda, * ) A,
integer LDA, integer, dimension( * ) IPIV, integer INFO)
SGETRF VARIANT: Crout Level 3 BLAS version of the algorithm. SGETRF VARIANT: iterative version of Sivan Toledo's recursive LU algorithm
SGETRF VARIANT: left-looking Level 3 BLAS version of the algorithm.
Three variants. One name. Main character energy fr fr.
โจ Purpose (the Crout one)
SGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This is the Crout Level 3 BLAS version of the algorithm.
๐ธ Parameters
MโMis INTEGER. The number of rows of the matrixA.M >= 0.NโNis INTEGER. The number of columns of the matrixA.N >= 0.AโAis REAL array, dimension(LDA,N).- On entry, the M-by-N matrix to be factored.
- On exit, the factors
LandUfrom the factorizationA = P*L*U; the unit diagonal elements ofLare not stored. (They're implied. She's subtle like that. ๐ )
LDAโLDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).IPIVโIPIVis INTEGER array, dimension(min(M,N)). The pivot indices; for1 <= i <= min(M,N), row i of the matrix was interchanged with rowIPIV(i).INFOโINFOis INTEGER.= 0: successful exit โจ< 0: ifINFO = -i, the i-th argument had an illegal value> 0: ifINFO = i,U(i,i)is exactly zero. The factorization has been completed, but the factorUis exactly singular, and division by zero will occur if it is used to solve a system of equations. Again. Do not. ๐ญ
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ Date
December 2016
โจ Purpose (the left-looking one)
SGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This is the left-looking Level 3 BLAS version of the algorithm.
๐ธ Parameters
MโMis INTEGER. The number of rows of the matrixA.M >= 0.NโNis INTEGER. The number of columns of the matrixA.N >= 0.AโAis REAL array, dimension(LDA,N).- On entry, the M-by-N matrix to be factored.
- On exit, the factors
LandUfrom the factorizationA = P*L*U; the unit diagonal elements ofLare not stored.
LDAโLDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).IPIVโIPIVis INTEGER array, dimension(min(M,N)). The pivot indices; for1 <= i <= min(M,N), row i of the matrix was interchanged with rowIPIV(i).INFOโINFOis INTEGER.= 0: successful exit โจ< 0: ifINFO = -i, the i-th argument had an illegal value> 0: ifINFO = i,U(i,i)is exactly zero. The factorization has been completed, but the factorUis exactly singular, and division by zero will occur if it is used to solve a system of equations.
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ Date
December 2016
โจ Purpose (the iterative Toledo one โ this is the lore drop)
SGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This code implements an iterative version of Sivan Toledo's recursive LU algorithm[1]. For square matrices, this iterative versions should be within a factor of two of the optimum number of memory transfers.
The pattern is as follows, with the large blocks of U being updated in one call to STRSM, and the dotted lines denoting sections that have had all pending permutations applied:
1 2 3 4 5 6 7 8
+-+-+---+-------+------
| |1| | |
|.+-+ 2 | |
| | | | |
|.|.+-+-+ 4 |
| | | |1| |
| | |.+-+ |
| | | | | |
|.|.|.|.+-+-+---+ 8
| | | | | |1| |
| | | | |.+-+ 2 |
| | | | | | | |
| | | | |.|.+-+-+
| | | | | | | |1|
| | | | | | |.+-+
| | | | | | | | |
|.|.|.|.|.|.|.|.+-----
| | | | | | | | |
The 1-2-1-4-1-2-1-8-... pattern is the position of the last 1 bit in the binary expansion of the current column. Each Schur update is applied as soon as the necessary portion of U is available. Not me reading a bit pattern like it's a horoscope but honestly? Slay. โญ
[1] Toledo, S. 1997. Locality of Reference in LU Decomposition with Partial Pivoting. SIAM J. Matrix Anal. Appl. 18, 4 (Oct. 1997), 1065-1081. http://dx.doi.org/10.1137/S0895479896297744
๐ธ Parameters
MโMis INTEGER. The number of rows of the matrixA.M >= 0.NโNis INTEGER. The number of columns of the matrixA.N >= 0.AโAis REAL array, dimension(LDA,N).- On entry, the M-by-N matrix to be factored.
- On exit, the factors
LandUfrom the factorizationA = P*L*U; the unit diagonal elements ofLare not stored.
LDAโLDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).IPIVโIPIVis INTEGER array, dimension(min(M,N)). The pivot indices; for1 <= i <= min(M,N), row i of the matrix was interchanged with rowIPIV(i).INFOINFOโ this one's anINTEGER, bestie, and it's the vibe check at the end:= 0โ slay, successful exit โจ< 0โ ifINFO = -i, then the i-th argument was giving illegal value energy and we're not okay with that ๐> 0โ ifINFO = i, thenU(i,i)is exactly zero. The factorization finished, but the factorUis exactly singular, and division by zero is gonna happen the second you try to use it to solve a system of equations. Not a drill, fr fr ๐ญ
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016
subroutine zgeqrf (integer M, integer N, complex*16, dimension( lda, * ) A, integer LDA, complex*16, dimension( * ) TAU, complex*16, dimension( * ) WORK, integer LWORK, integer INFO)
ZGEQRF VARIANT: left-looking Level 3 BLAS of the algorithm. ๐
Purpose:
ZGEQRF computes a QR factorization of a real M-by-N matrix A:
A = Q * R.
This is the left-looking Level 3 BLAS version of the algorithm. She's the upgraded edition, periodt ๐
Parameters
M
M is INTEGER The number of rows of the matrix A. M >= 0. No negatives, we don't do that here ๐
โโ๏ธ
N
N is INTEGER The number of columns of the matrix A. N >= 0.
A
A is COMPLEX*16 array, dimension (LDA,N) On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix R (R is upper triangular if m >= n); the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors (see Further Details). She transforms, she serves, she leaves receipts โจ
LDA
LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TAU
TAU is COMPLEX*16 array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details). Little scalars, big responsibilities ๐
WORK
WORK is COMPLEX*16 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 >= 1 if MIN(M,N) = 0, otherwise the dimension can be divided into three parts. Yes bestie, three whole parts, buckle up ๐ธ
- The part for the triangular factor T. If the very last T is not bigger than any of the rest, then this part is
NB x ceiling(K/NB), otherwise,NB x (K-NT), whereK = min(M,N)andNTis the dimension of the very last T - The part for the very last T when T is bigger than any of the rest T. The size of this part is
NT x NT, whereNT = K - ceiling ((K-NX)/NB) x NB, whereK = min(M,N),NXis calculated by
NX = MAX( 0, ILAENV( 3, 'ZGEQRF', ' ', M, N, -1, -1 ) )
- The part for
dlarfbis of sizemax((N-M)*K, (N-M)*NB, K*NB, NB*NB)
So LWORK = part1 + part2 + part3 ๐งฎ
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. Sneaky little query mode, iykyk ๐
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.
Date
December 2016
Further Details
The matrix Q is represented as a product of elementary reflectors
Q = H(1) H(2) . . . H(k), where k = min(m,n).
Each H(i) has the form
H(i) = I - tau * v * v'
where tau is a real scalar, and v is a real vector with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i). It's giving math poetry, honestly ๐ฆ
subroutine zgetrf (integer M, integer N, complex*16, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, integer INFO)
ZGETRF VARIANT: Crout Level 3 BLAS version of the algorithm. ZGETRF VARIANT: iterative version of Sivan Toledo's recursive LU algorithm
ZGETRF VARIANT: left-looking Level 3 BLAS version of the algorithm. โ yes, all three of them, she contains multitudes ๐
Purpose:
ZGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This is the Crout Level 3 BLAS version of the algorithm. โจ
Parameters
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.
A
A is COMPLEX*16 array, dimension (LDA,N) On entry, the M-by-N matrix to be factored. On exit, the factors L and U from the factorization A = P*L*U; the unit diagonal elements of L are not stored. She keeps her secrets ๐คซ
LDA
LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
IPIV
IPIV is INTEGER array, dimension (min(M,N)) The pivot indices; for 1 <= i <= min(M,N), row i of the matrix was interchanged with row IPIV(i). The swaps! The drama! ๐
INFO
INFO is INTEGER
= 0โ successful exit โจ< 0โ ifINFO = -i, the i-th argument had an illegal value> 0โ ifINFO = i,U(i,i)is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations. Do not proceed. She's giving singular energy and it's dangerous. ๐
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016
Purpose:
ZGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This is the left-looking Level 3 BLAS version of the algorithm. ๐
Parameters
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.
A
A is COMPLEX*16 array, dimension (LDA,N) On entry, the M-by-N matrix to be factored. On exit, the factors L and U from the factorization A = P*L*U; the unit diagonal elements of L are not stored.
LDA
LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
IPIV
IPIV is INTEGER array, dimension (min(M,N)) The pivot indices; for 1 <= i <= min(M,N), row i of the matrix was interchanged with row IPIV(i).
INFO
INFO is INTEGER
= 0โ successful exit ๐ซถ< 0โ ifINFO = -i, the i-th argument had an illegal value> 0โ ifINFO = i,U(i,i)is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations. Same warning, same stakes, no cap. ๐ญ
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016
Purpose:
ZGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This code implements an iterative version of Sivan Toledo's recursive LU algorithm[1]. For square matrices, this iterative versions should be within a factor of two of the optimum number of memory transfers. Okay so that's lowkey iconic โ within a factor of two of optimal, she's efficient AND humble ๐
The pattern is as follows, with the large blocks of U being updated in one call to DTRSM, and the dotted lines denoting sections that have had all pending permutations applied:
1 2 3 4 5 6 7 8
+-+-+---+-------+------
| |1| | |
|.+-+ 2 | |
| | | | |
|.|.+-+-+ 4 |
| | | |1| |
| | |.+-+ |
| | | | | |
|.|.|.|.+-+-+---+ 8
| | | | | |1| |
| | | | |.+-+ 2 |
| | | | | | | |
| | | | |.|.+-+-+
| | | | | | | |1|
| | | | | | |.+-+
| | | | | | | | |
|.|.|.|.|.|.|.|.+-----
| | | | | | | | |
The 1-2-1-4-1-2-1-8-... pattern is the position of the last 1 bit in the binary expansion of the current column. Each Schur update is applied as soon as the necessary portion of U is available. It's giving โจbinaryโจ and honestly? obsessed ๐ง
[1] Toledo, S. 1997. Locality of Reference in LU Decomposition with Partial Pivoting. SIAM J. Matrix Anal. Appl. 18, 4 (Oct. 1997), 1065-1081. http://dx.doi.org/10.1137/S0895479896297744
Parameters
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.
A
A is COMPLEX*16 array, dimension (LDA,N) On entry, the M-by-N matrix to be factored. On exit, the factors L and U from the factorization A = P*L*U; the unit diagonal elements of L are not stored.
LDA
LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
IPIV
IPIV is INTEGER array, dimension (min(M,N)) The pivot indices; for 1 <= i <= min(M,N), row i of the matrix was interchanged with row IPIV(i).
INFO
INFO is INTEGER, bestie โ it's literally the lil report card the routine hands back so you know how the whole thing went down. Here's how to read it:
= 0โ slay!! successful exit. Everything worked, nothing is on fire, go live your life. โจ< 0โ okay so ifINFO = -i, that means the i-th argument had an illegal value. Translation: you passed it something cursed and it's side-eyeing you. Go check argument number i. ๐ซถ> 0โ and ifINFO = i, thenU(i,i)is exactly zero. The factorization has been completed, but the factorUis exactly singular, and division by zero will occur if it is used to solve a system of equations. Not a drill, not a vibe, it's giving math crimes ๐ โ do not go solving anything with this.
๐ Author ๐
The absolute icons who brought you this:
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ Date ๐
December 2016 โ yes bestie, she's been iconic for a minute. ๐
Author: Generated automatically by Doxygen for LAPACK from the source code. (so if you were about to @ me about the formatting, it was literally the robot, not me ๐)
Version 3.11.0 ยท Sun Nov 27 2022 โ and that's the whole page, bestie! Go forth and factor responsibly. ๐ฆ๐ periodt.
๐ฆ where this page comes from
- debian bookworm: liblapack-doc 3.11.0-2 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms