complex16HEsolve(3)
π complex16HEsolve β LAPACK π
okay so bestie, welcome to complex16HEsolve(3), the LAPACK page that's literally a whole friend group of complex16 solve drivers. it's giving β¨main character energyβ¨ and it comes in SIX parts, so buckle up, we're only doing part one rn π
πΈ NAME πΈ
complex16HEsolve β complex16 π¦
β¨ SYNOPSIS β¨
π«Ά Functions
subroutine zhesv
subroutine zhesv (UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, LWORK, INFO)
ZHESV computes the solution to system of linear equations A * X = B for HE matrices
subroutine zhesv_aa
subroutine zhesv_aa (UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, LWORK, INFO)
ZHESV_AA computes the solution to system of linear equations A * X = B for HE matrices
subroutine zhesv_aa_2stage
subroutine zhesv_aa_2stage (UPLO, N, NRHS, A, LDA, TB, LTB, IPIV, IPIV2, B, LDB, WORK, LWORK, INFO)
ZHESV_AA_2STAGE computes the solution to system of linear equations A * X = B for HE matrices
subroutine zhesv_rk
subroutine zhesv_rk (UPLO, N, NRHS, A, LDA, E, IPIV, B, LDB, WORK, LWORK, INFO)
ZHESV_RK computes the solution to system of linear equations A * X = B for SY matrices
subroutine zhesv_rook
subroutine zhesv_rook (UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, LWORK, INFO)
ZHESV_ROOK computes the solution to a system of linear equations A * X = B for HE matrices using the bounded Bunch-Kaufman ('rook') diagonal pivoting method
subroutine zhesvx
subroutine zhesvx (FACT, UPLO, N, NRHS, A, LDA, AF, LDAF, IPIV, B, LDB, X, LDX, RCOND, FERR, BERR, WORK, LWORK, RWORK, INFO)
ZHESVX computes the solution to system of linear equations A * X = B for HE matrices
subroutine zhesvxx
subroutine zhesvxx (FACT, UPLO, N, NRHS, A, LDA, AF, LDAF, IPIV, EQUED, S, B, LDB, X, LDX, RCOND, RPVGRW, BERR, N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, RWORK, INFO)
ZHESVXX computes the solution to system of linear equations A * X = B for HE matrices
π« Detailed Description π«
no cap, this is just the whole squad of complex16 solve driver functions for HE matrices. the entire group chat π«Ά
π₯ Function Documentation π₯
π
subroutine zhesv
subroutine zhesv (character UPLO, integer N, integer NRHS, complex*16,
dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV,
complex*16, dimension( ldb, * ) B, integer LDB, complex*16, dimension( *
) WORK, integer LWORK, integer INFO)
ZHESV computes the solution to system of linear equations A * X = B for HE matrices
π Purpose
ok so ZHESV computes the solution to a complex system of linear equations
A * X = B,
where A is an N-by-N Hermitian matrix and X and B are N-by-NRHS matrices. iconic behavior honestly π
the diagonal pivoting method is used to factor A as
A = U * D * U**H, if UPLO = 'U', or
A = L * D * L**H, if UPLO = 'L',
where U (or L) is a product of permutation and unit upper (lower) triangular matrices, and D is Hermitian and block diagonal with 1-by-1 and 2-by-2 diagonal blocks. the factored form of A is then used to solve the system of equations A * X = B. slay β¨
π Parameters
UPLOβ isCHARACTER*1= 'U': Upper triangle of A is stored;= 'L': Lower triangle of A is stored.
Nβ isINTEGER. the number of linear equations, i.e., the order of the matrix A.N >= 0.NRHSβ isINTEGER. the number of right hand sides, i.e., the number of columns of the matrix B.NRHS >= 0.Aβ isCOMPLEX*16array, dimension(LDA,N).- on entry, the Hermitian matrix A. if
UPLO = 'U', the leading N-by-N upper triangular part of A contains the upper triangular part of the matrix A, and the strictly lower triangular part of A is not referenced. ifUPLO = 'L', the leading N-by-N lower triangular part of A contains the lower triangular part of the matrix A, and the strictly upper triangular part of A is not referenced. - on exit, if
INFO = 0, the block diagonal matrix D and the multipliers used to obtain the factor U or L from the factorizationA = U*D*U**HorA = L*D*L**Has computed byZHETRF.
- on entry, the Hermitian matrix A. if
LDAβ isINTEGER. the leading dimension of the array A.LDA >= max(1,N).IPIVβ isINTEGERarray, dimension(N). details of the interchanges and the block structure of D, as determined byZHETRF. ifIPIV(k) > 0, then rows and columns k andIPIV(k)were interchanged, andD(k,k)is a 1-by-1 diagonal block. ifUPLO = 'U'andIPIV(k) = IPIV(k-1) < 0, then rows and columns k-1 and-IPIV(k)were interchanged andD(k-1:k,k-1:k)is a 2-by-2 diagonal block. ifUPLO = 'L'andIPIV(k) = IPIV(k+1) < 0, then rows and columns k+1 and-IPIV(k)were interchanged andD(k:k+1,k:k+1)is a 2-by-2 diagonal block. it's giving bookkeeping πBβ isCOMPLEX*16array, dimension(LDB,NRHS).- on entry, the N-by-NRHS right hand side matrix B.
- on exit, if
INFO = 0, the N-by-NRHS solution matrix X.
LDBβ isINTEGER. the leading dimension of the array B.LDB >= max(1,N).WORKβ isCOMPLEX*16array, dimension(MAX(1,LWORK)). on exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKβ isINTEGER. the length of WORK.LWORK >= 1, and for best performanceLWORK >= max(1,N*NB), where NB is the optimal blocksize forZHETRF.- for
LWORK < N, TRS will be done with Level BLAS 2 - for
LWORK >= N, TRS will be done with Level BLAS 3
- for
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. so don't come for it π«Ά
INFOβ isINTEGER= 0: successful exit β¨< 0: ifINFO = -i, the i-th argument had an illegal value π> 0: ifINFO = i,D(i,i)is exactly zero. the factorization has been completed, but the block diagonal matrix D is exactly singular, so the solution could not be computed. π
π Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π
subroutine zhesv_aa
subroutine zhesv_aa (character UPLO, integer N, integer NRHS, complex*16,
dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV,
complex*16, dimension( ldb, * ) B, integer LDB, complex*16, dimension( *
) WORK, integer LWORK, integer INFO)
ZHESV_AA computes the solution to system of linear equations A * X = B for HE matrices
π Purpose
ZHESV_AA computes the solution to a complex system of linear equations
A * X = B,
where A is an N-by-N Hermitian matrix and X and B are N-by-NRHS matrices. same vibe, different algorithm π¦
Aasen's algorithm is used to factor A as
A = U**H * T * U, if UPLO = 'U', or
A = L * T * L**H, if UPLO = 'L',
where U (or L) is a product of permutation and unit upper (lower) triangular matrices, and T is Hermitian and tridiagonal. the factored form of A is then used to solve the system of equations A * X = B. periodt π
π Parameters
UPLOβ isCHARACTER*1= 'U': Upper triangle of A is stored;= 'L': Lower triangle of A is stored.
Nβ isINTEGER. the number of linear equations, i.e., the order of the matrix A.N >= 0.NRHSβ isINTEGER. the number of right hand sides, i.e., the number of columns of the matrix B.NRHS >= 0.Aβ isCOMPLEX*16array, dimension(LDA,N).- on entry, the Hermitian matrix A. if
UPLO = 'U', the leading N-by-N upper triangular part of A contains the upper triangular part of the matrix A, and the strictly lower triangular part of A is not referenced. ifUPLO = 'L', the leading N-by-N lower triangular part of A contains the lower triangular part of the matrix A, and the strictly upper triangular part of A is not referenced. - on exit, if
INFO = 0, the tridiagonal matrix T and the multipliers used to obtain the factor U or L from the factorizationA = U**H*T*UorA = L*T*L**Has computed byZHETRF_AA.
- on entry, the Hermitian matrix A. if
LDAβ isINTEGER. the leading dimension of the array A.LDA >= max(1,N).IPIVβ isINTEGERarray, dimension(N). on exit, it contains the details of the interchanges, i.e., the row and column k of A were interchanged with the row and columnIPIV(k). noted πBβ isCOMPLEX*16array, dimension(LDB,NRHS).- on entry, the N-by-NRHS right hand side matrix B.
- on exit, if
INFO = 0, the N-by-NRHS solution matrix X.
LDBβ isINTEGER. the leading dimension of the array B.LDB >= max(1,N).WORKβ isCOMPLEX*16array, dimension(MAX(1,LWORK)). on exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKβ isINTEGER. the length of WORK.LWORK >= MAX(1,2*N,3*N-2), and for best performanceLWORK >= max(1,N*NB), where NB is the optimal blocksize forZHETRF. (yes bestie, this one wants a bigger workspace than plain old ZHESV, lowkey iconic of it)
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β isINTEGER= 0: successful exit β¨< 0: ifINFO = -i, the i-th argument had an illegal value π> 0: ifINFO = i,D(i,i)is exactly zero. the factorization has been completed, but the block diagonal matrix D is exactly singular, so the solution could not be computed. π
π Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine zhesv_aa_2stage π
subroutine zhesv_aa_2stage (character UPLO, integer N, integer NRHS,
complex*16, dimension( lda, * ) A, integer LDA, complex*16, dimension( *
) TB, integer LTB, integer, dimension( * ) IPIV, integer, dimension( * )
IPIV2, complex*16, dimension( ldb, * ) B, integer LDB, complex*16,
dimension( * ) WORK, integer LWORK, integer INFO)
okay so bestie, ZHESV_AA_2STAGE computes the solution to system of linear equations A * X = B for HE matrices. it's giving solver energy fr fr.
β¨ Purpose β¨
so basically ZHESV_AA_2STAGE computes the solution to a complex system of linear equations
A * X = B,
where A is an N-by-N Hermitian matrix and X and B are N-by-NRHS matrices. π
Aasen's 2-stage algorithm is used to factor A as
A = U**H * T * U, if UPLO = 'U', or
A = L * T * L**H, if UPLO = 'L',
where U (or L) is a product of permutation and unit upper (lower) triangular matrices, and T is Hermitian and band. The matrix T is then LU-factored with partial pivoting. The factored form of A is then used to solve the system of equations A * X = B.
This is the blocked version of the algorithm, calling Level 3 BLAS. level 3 blas?? we love a blocked queen π
πΈ Parameters πΈ
UPLOβUPLOisCHARACTER*1= 'U': Upper triangle ofAis stored;= 'L': Lower triangle ofAis stored.
NβNisINTEGER. The order of the matrixA.N >= 0.NRHSβNRHSisINTEGER. The number of right hand sides, i.e., the number of columns of the matrixB.NRHS >= 0.AβAisCOMPLEX*16array, dimension(LDA,N). On entry, the hermitian matrixA. IfUPLO = 'U', the leadingN-by-Nupper triangular part ofAcontains the upper triangular part of the matrixA, and the strictly lower triangular part ofAis not referenced. IfUPLO = 'L', the leadingN-by-Nlower triangular part ofAcontains the lower triangular part of the matrixA, and the strictly upper triangular part ofAis not referenced. On exit,Lis stored below (or above) the subdiagonal blocks, whenUPLOis'L'(or'U'). π¦LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).TBβTBisCOMPLEX*16array, dimension(LTB). On exit, details of the LU factorization of the band matrix. πLTBβLTBisINTEGER. The size of the arrayTB.LTB >= 4*N, internally used to selectNBsuch thatLTB >= (3*NB+1)*N. IfLTB = -1, then a workspace query is assumed; the routine only calculates the optimal size ofLTB, returns this value as the first entry ofTB, and no error message related toLTBis issued byXERBLA. (yes bestie,-1is the "just tell me how much room i need" move π)IPIVβIPIVisINTEGERarray, dimension(N). On exit, it contains the details of the interchanges, i.e., the row and columnkofAwere interchanged with the row and columnIPIV(k).IPIV2βIPIV2isINTEGERarray, dimension(N). On exit, it contains the details of the interchanges, i.e., the row and columnkofTwere interchanged with the row and columnIPIV(k).BβBisCOMPLEX*16array, dimension(LDB,NRHS). On entry, the right hand side matrixB. On exit, the solution matrixX. the glow-up from B to X is real β¨LDBβLDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).WORKβWORKisCOMPLEX*16workspace of sizeLWORK.LWORKβLWORKisINTEGER. The size ofWORK.LWORK >= N, internally used to selectNBsuch thatLWORK >= N*NB. IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA.INFOβINFOisINTEGER= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = i, band LU factorization failed on i-th column. bestie that's a yikes, the factorization did NOT slay
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
subroutine zhesv_rk π
subroutine zhesv_rk (character UPLO, integer N, integer NRHS, complex*16,
dimension( lda, * ) A, integer LDA, complex*16, dimension( * ) E,
integer, dimension( * ) IPIV, complex*16, dimension( ldb, * ) B, integer
LDB, complex*16, dimension( * ) WORK, integer LWORK, integer INFO)
ZHESV_RK computes the solution to system of linear equations A * X = B for SY matrices. another solver, another slay. π
β¨ Purpose β¨
ZHESV_RK computes the solution to a complex system of linear equations A * X = B, where A is an N-by-N Hermitian matrix and X and B are N-by-NRHS matrices.
The bounded Bunch-Kaufman (rook) diagonal pivoting method is used to factor A as
A = P*U*D*(U**H)*(P**T), if UPLO = 'U', or
A = P*L*D*(L**H)*(P**T), if UPLO = 'L',
where U (or L) is unit upper (or lower) triangular matrix, U**H (or L**H) is the conjugate of U (or L), P is a permutation matrix, P**T is the transpose of P, and D is Hermitian and block diagonal with 1-by-1 and 2-by-2 diagonal blocks. rook pivoting, the main character of pivoting strategies, no cap
ZHETRF_RK is called to compute the factorization of a complex Hermitian matrix. The factored form of A is then used to solve the system of equations A * X = B by calling BLAS3 routine ZHETRS_3.
πΈ Parameters πΈ
UPLOβUPLOisCHARACTER*1. Specifies whether the upper or lower triangular part of the Hermitian matrixAis stored:= 'U': Upper triangle ofAis stored;= 'L': Lower triangle ofAis stored.
NβNisINTEGER. The number of linear equations, i.e., the order of the matrixA.N >= 0.NRHSβNRHSisINTEGER. The number of right hand sides, i.e., the number of columns of the matrixB.NRHS >= 0.AβAisCOMPLEX*16array, dimension(LDA,N). On entry, the Hermitian matrixA.- If
UPLO = 'U': the leadingN-by-Nupper triangular part ofAcontains the upper triangular part of the matrixA, and the strictly lower triangular part ofAis not referenced. - If
UPLO = 'L': the leadingN-by-Nlower triangular part ofAcontains the lower triangular part of the matrixA, and the strictly upper triangular part ofAis not referenced.
- If
On exit, if INFO = 0, diagonal of the block diagonal matrix D and factors U or L as computed by ZHETRF_RK:
- a) ONLY diagonal elements of the Hermitian block diagonal matrix
Don the diagonal ofA, i.e.D(k,k) = A(k,k); (superdiagonal (or subdiagonal) elements ofDare stored on exit in arrayE), and - b) If
UPLO = 'U': factorUin the superdiagonal part ofA. IfUPLO = 'L': factorLin the subdiagonal part ofA.
For more info see the description of ZHETRF_RK routine. π¦
LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).EβEisCOMPLEX*16array, dimension(N). On exit, contains the output computed by the factorization routineZHETRF_RK, i.e. the superdiagonal (or subdiagonal) elements of the Hermitian block diagonal matrixDwith 1-by-1 or 2-by-2 diagonal blocks, where- If
UPLO = 'U':E(i) = D(i-1,i),i=2:N,E(1)is set to0; - If
UPLO = 'L':E(i) = D(i+1,i),i=1:N-1,E(N)is set to0.
- If
NOTE: For 1-by-1 diagonal blockD(k), where1 <= k <= N, the elementE(k)is set to0in bothUPLO = 'U'orUPLO = 'L'cases. (yes both. it's zero either way, she does not discriminate π)
For more info see the description of ZHETRF_RK routine.
IPIVβIPIVisINTEGERarray, dimension(N). Details of the interchanges and the block structure ofD, as determined byZHETRF_RK. For more info see the description ofZHETRF_RKroutine.BβBisCOMPLEX*16array, dimension(LDB,NRHS). On entry, theN-by-NRHSright hand side matrixB. On exit, ifINFO = 0, theN-by-NRHSsolution matrixX. she ate and left no crumbs β¨LDBβLDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).WORKβWORKisCOMPLEX*16array, dimension( MAX(1,LWORK) ). Work array used in the factorization stage. On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKβLWORKisINTEGER. The length ofWORK.LWORK >= 1. For best performance of factorization stageLWORK >= max(1,N*NB), whereNBis the optimal blocksize forZHETRF_RK. IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray for factorization stage, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. (again with the-1vibe check π)INFOβINFOisINTEGER= 0: successful exit π< 0: IfINFO = -k, the k-th argument had an illegal value> 0: IfINFO = k, the matrixAis singular, because:- If
UPLO = 'U': columnkin the upper triangular part ofAcontains all zeros. - If
UPLO = 'L': columnkin the lower triangular part ofAcontains all zeros.
- If
Therefore D(k,k) is exactly zero, and superdiagonal elements of column k of U (or subdiagonal elements of column k of L) are all zeros. The factorization has been completed, but the block diagonal matrix D is exactly singular, and division by zero will occur if it is used to solve a system of equations.
β οΈ bestie LISTEN.INFO > 0meansDis exactly singular and if you go ahead and try to solve with it, you are dividing by zero. the factorization "finished" but it did NOT finish finish. do not pass go. do not collect your solution. π
β οΈ NOTE:INFOonly stores the first occurrence of a singularity, any subsequent occurrence of singularity is not stored inINFOeven though the factorization always completes.
π Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
πΈ Contributors
- December 2016, Igor Kozachenko, Computer Science Division, University of California, Berkeley
- September 2007, Sven Hammarling, Nicholas J. Higham, Craig Lucas, School of Mathematics, University of Manchester
β¨ subroutine zhesv_rook
subroutine zhesv_rook (character UPLO, integer N, integer NRHS, complex*16,
dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV,
complex*16, dimension( ldb, * ) B, integer LDB, complex*16, dimension( *
) WORK, integer LWORK, integer INFO)
okay so ZHESV_ROOK computes the solution to a system of linear equations A * X = B for HE matrices using the bounded Bunch-Kaufman ('rook') diagonal pivoting method π
iconic behavior honestly
π― Purpose
ZHESV_ROOK computes the solution to a complex system of linear equations
A * X = B,
where A is an N-by-N Hermitian matrix and X and B are N-by-NRHS matrices.
The bounded Bunch-Kaufman ('rook') diagonal pivoting method is used to factor A as
A = U * D * U**T, if UPLO = 'U', or
A = L * D * L**T, if UPLO = 'L',
where U (or L) is a product of permutation and unit upper (lower) triangular matrices, and D is Hermitian and block diagonal with 1-by-1 and 2-by-2 diagonal blocks.
ZHETRF_ROOK is called to compute the factorization of a complex Hermitian matrix A using the bounded Bunch-Kaufman ('rook') diagonal pivoting method.
The factored form of A is then used to solve the system of equations A * X = B by calling ZHETRS_ROOK (uses BLAS 2).
π Parameters
UPLOβ isCHARACTER*1= 'U': Upper triangle ofAis stored;= 'L': Lower triangle ofAis stored.
Nβ isINTEGER. The number of linear equations, i.e., the order of the matrixA.N >= 0.NRHSβ isINTEGER. The number of right hand sides, i.e., the number of columns of the matrixB.NRHS >= 0.Aβ isCOMPLEX*16array, dimension(LDA,N). On entry, the Hermitian matrixA. IfUPLO = 'U', the leading N-by-N upper triangular part ofAcontains the upper triangular part of the matrixA, and the strictly lower triangular part ofAis not referenced. IfUPLO = 'L', the leading N-by-N lower triangular part ofAcontains the lower triangular part of the matrixA, and the strictly upper triangular part ofAis not referenced.
On exit, if INFO = 0, the block diagonal matrix D and the multipliers used to obtain the factor U or L from the factorization A = U*D*U**H or A = L*D*L**H as computed by ZHETRF_ROOK.
LDAβ isINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).IPIVβ isINTEGERarray, dimension(N). Details of the interchanges and the block structure ofD.
If UPLO = 'U':
- Only the last
KBelements ofIPIVare set. - If
IPIV(k) > 0, then rows and columnskandIPIV(k)were interchanged andD(k,k)is a 1-by-1 diagonal block. - If
IPIV(k) < 0andIPIV(k-1) < 0, then rows and columnskand-IPIV(k)were interchanged and rows and columnsk-1and-IPIV(k-1)were interchanged,D(k-1:k,k-1:k)is a 2-by-2 diagonal block.
If UPLO = 'L':
- Only the first
KBelements ofIPIVare set. - If
IPIV(k) > 0, then rows and columnskandIPIV(k)were interchanged andD(k,k)is a 1-by-1 diagonal block. - If
IPIV(k) < 0andIPIV(k+1) < 0, then rows and columnskand-IPIV(k)were interchanged and rows and columnsk+1and-IPIV(k+1)were interchanged,D(k:k+1,k:k+1)is a 2-by-2 diagonal block.
Bβ isCOMPLEX*16array, dimension(LDB,NRHS). On entry, the N-by-NRHS right hand side matrixB. On exit, ifINFO = 0, the N-by-NRHS solution matrixX.LDBβ isINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).WORKβ isCOMPLEX*16array, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKβ isINTEGER. The length ofWORK.LWORK >= 1, and for best performanceLWORK >= max(1,N*NB), whereNBis the optimal blocksize forZHETRF_ROOK.
for LWORK < N, TRS will be done with Level BLAS 2
for LWORK >= N, TRS will be done with Level BLAS 3
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β isINTEGER.= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: ifINFO = i,D(i,i)is exactly zero. The factorization has been completed, but the block diagonal matrixDis exactly singular, so the solution could not be computed.
π Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
- November 2013, Igor Kozachenko, Computer Science Division, University of California, Berkeley
- September 2007, Sven Hammarling, Nicholas J. Higham, Craig Lucas, School of Mathematics, University of Manchester.
β¨ subroutine zhesvx
subroutine zhesvx (character FACT, character UPLO, integer N, integer NRHS,
complex*16, dimension( lda, * ) A, integer LDA, complex*16, dimension(
ldaf, * ) AF, integer LDAF, integer, dimension( * ) IPIV, complex*16,
dimension( ldb, * ) B, integer LDB, complex*16, dimension( ldx, * ) X,
integer LDX, double precision RCOND, double precision, dimension( * )
FERR, double precision, dimension( * ) BERR, complex*16, dimension( * )
WORK, integer LWORK, double precision, dimension( * ) RWORK, integer
INFO)
ZHESVX computes the solution to system of linear equations A * X = B for HE matrices π«Ά
π― Purpose
ZHESVX uses the diagonal pivoting factorization to compute the solution to a complex system of linear equations A * X = B, where A is an N-by-N Hermitian matrix and X and B are N-by-NRHS matrices.
Error bounds on the solution and a condition estimate are also provided.
π Description
The following steps are performed:
- If
FACT = 'N', the diagonal pivoting method is used to factorA. The form of the factorization is
A = U * D * U**H, if UPLO = 'U', or
A = L * D * L**H, if UPLO = 'L',
where U (or L) is a product of permutation and unit upper (lower) triangular matrices, and D is Hermitian and block diagonal with 1-by-1 and 2-by-2 diagonal blocks.
- If some
D(i,i)=0, so thatDis exactly singular, then the routine returns withINFO = i. Otherwise, the factored form ofAis used to estimate the condition number of the matrixA. If the reciprocal of the condition number is less than machine precision,INFO = N+1is returned as a warning, but the routine still goes on to solve forXand compute error bounds as described below. - The system of equations is solved for
Xusing the factored form ofA. - Iterative refinement is applied to improve the computed solution matrix and calculate error bounds and backward error estimates for it.
π Parameters
FACTβ isCHARACTER*1. Specifies whether or not the factored form ofAhas been supplied on entry.= 'F': On entry,AFandIPIVcontain the factored form ofA.A,AFandIPIVwill not be modified.= 'N': The matrixAwill be copied toAFand factored.
UPLOβ isCHARACTER*1.= 'U': Upper triangle ofAis stored;= 'L': Lower triangle ofAis stored.
Nβ isINTEGER. The number of linear equations, i.e., the order of the matrixA.N >= 0.NRHSβ isINTEGER. The number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >= 0.Aβ isCOMPLEX*16array, dimension(LDA,N). The Hermitian matrixA. IfUPLO = 'U', the leading N-by-N upper triangular part ofAcontains the upper triangular part of the matrixA, and the strictly lower triangular part ofAis not referenced. IfUPLO = 'L', the leading N-by-N lower triangular part ofAcontains the lower triangular part of the matrixA, and the strictly upper triangular part ofAis not referenced.LDAβ isINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).AFβ isCOMPLEX*16array, dimension(LDAF,N). IfFACT = 'F', thenAFis an input argument and on entry contains the block diagonal matrixDand the multipliers used to obtain the factorUorLfrom the factorizationA = U*D*U**HorA = L*D*L**Has computed byZHETRF.
If FACT = 'N', then AF is an output argument and on exit returns the block diagonal matrix D and the multipliers used to obtain the factor U or L from the factorization A = U*D*U**H or A = L*D*L**H.
LDAFβ isINTEGER. The leading dimension of the arrayAF.LDAF >= max(1,N).IPIVIPIVβINTEGERarray, dimension(N).
So if FACT = 'F', then IPIV is an input argument, and on entry it's carrying the details of the interchanges and the block structure of D, exactly as determined by ZHETRF. π
- If
IPIV(k) > 0, then rows and columnskandIPIV(k)were interchanged andD(k,k)is a 1-by-1 diagonal block. - If
UPLO = 'U'andIPIV(k) = IPIV(k-1) < 0, then rows and columnsk-1and-IPIV(k)were interchanged andD(k-1:k,k-1:k)is a 2-by-2 diagonal block. - If
UPLO = 'L'andIPIV(k) = IPIV(k+1) < 0, then rows and columnsk+1and-IPIV(k)were interchanged andD(k:k+1,k:k+1)is a 2-by-2 diagonal block.
And if FACT = 'N', then IPIV is an output argument instead, and on exit it contains details of the interchanges and the block structure of D, as determined by ZHETRF. Same tea, different direction, bestie.
BβCOMPLEX*16array, dimension(LDB,NRHS). The N-by-NRHS right hand side matrix B. That's it, that's the whole vibe. π«ΆLDBβINTEGER. The leading dimension of the array B.LDB >= max(1,N). Respect the bound or XERBLA will come for you.XβCOMPLEX*16array, dimension(LDX,NRHS). IfINFO = 0orINFO = N+1, this is the N-by-NRHS solution matrix X. β¨ the moment we've all been waiting for β¨LDXβINTEGER. The leading dimension of the array X.LDX >= max(1,N).RCONDβDOUBLE PRECISION. The estimate of the reciprocal condition number of the matrix A. IfRCONDis less than the machine precision (in particular, ifRCOND = 0), the matrix is singular to working precision. This condition is indicated by a return code ofINFO > 0. so likeβ¦ if this is teeny tiny, bestie, the matrix is not okay πFERRβDOUBLE PRECISIONarray, dimension(NRHS). The estimated forward error bound for each solution vectorX(j)(the j-th column of the solution matrix X). IfXTRUEis the true solution corresponding toX(j),FERR(j)is an estimated upper bound for the magnitude of the largest element in(X(j) - XTRUE)divided by the magnitude of the largest element inX(j). The estimate is as reliable as the estimate forRCOND, and is almost always a slight overestimate of the true error. she's dramatic but she's honestBERRβDOUBLE PRECISIONarray, dimension(NRHS). The componentwise relative backward error of each solution vectorX(j)(i.e., the smallest relative change in any element of A or B that makesX(j)an exact solution). iconic little receiptWORKβCOMPLEX*16array, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. πLWORKβINTEGER. The length ofWORK.LWORK >= max(1,2*N), and for best performance, whenFACT = 'N',LWORK >= max(1,2*N,N*NB), whereNBis the optimal blocksize forZHETRF.
IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. Cute, right? It's the "just asking, not committing" mode. π
RWORKβDOUBLE PRECISIONarray, dimension(N). (yes bestie that's literally all it says, don't come for me)INFOβINTEGER. The final verdict, fr fr:= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value π> 0: ifINFO = i, and i is<= N:D(i,i)is exactly zero. The factorization has been completed but the factor D is exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned. π= N+1: D is nonsingular, butRCONDis less than machine precision, meaning that the matrix is singular to working precision. Nevertheless, the solution and error bounds are computed because there are a number of situations where the computed solution can be more accurate than the value ofRCONDwould suggest. plot twist!!
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Four absolute legends, one routine. Respect. π
π¦ subroutine zhesvxx π¦
subroutine zhesvxx (character FACT, character UPLO, integer N, integer NRHS,
complex*16, dimension( lda, * ) A, integer LDA, complex*16, dimension(
ldaf, * ) AF, integer LDAF, integer, dimension( * ) IPIV, character
EQUED, double precision, dimension( * ) S, complex*16, dimension( ldb, *
) B, integer LDB, complex*16, dimension( ldx, * ) X, integer LDX, double
precision RCOND, double precision RPVGRW, double precision, dimension( *
) BERR, integer N_ERR_BNDS, double precision, dimension( nrhs, * )
ERR_BNDS_NORM, double precision, dimension( nrhs, * ) ERR_BNDS_COMP,
integer NPARAMS, double precision, dimension( * ) PARAMS, complex*16,
dimension( * ) WORK, double precision, dimension( * ) RWORK, integer
INFO)
ZHESVXX computes the solution to system of linear equations A * X = B for HE matrices. β¨
π Purpose:
ZHESVXX uses the diagonal pivoting factorization to compute the solution to a complex*16 system of linear equations A * X = B, where A is an N-by-N Hermitian matrix and X and B are N-by-NRHS matrices. hermitian girlies rise πΈ
If requested, both normwise and maximum componentwise error bounds are returned. ZHESVXX will return a solution with a tiny guaranteed error (O(eps) where eps is the working machine precision) unless the matrix is very ill-conditioned, in which case a warning is returned. Relevant condition numbers also are calculated and returned. π₯
ZHESVXX accepts user-provided factorizations and equilibration factors; see the definitions of the FACT and EQUED options. Solving with refinement and using a factorization from a previous ZHESVXX call will also produce a solution with either O(eps) errors or warnings, but we cannot make that claim for general user-provided factorizations and equilibration factors if they differ from what ZHESVXX would itself produce. no cap, that caveat is load-bearing
π Description:
The following steps are performed, bestie, in this exact order:
- If
FACT = 'E', double precision scaling factors are computed to equilibrate the system:
diag(S)*A*diag(S) *inv(diag(S))*X = diag(S)*B
Whether or not the system will be equilibrated depends on the scaling of the matrix A, but if equilibration is used, A is overwritten by diag(S)*A*diag(S) and B by diag(S)*B. OVERWRITTEN. as in, gone. as in, that was your A.
- If
FACT = 'N'or'E', the LU decomposition is used to factor the matrix A (after equilibration ifFACT = 'E') as
A = U * D * U**T, if UPLO = 'U', or
A = L * D * L**T, if UPLO = 'L',
where U (or L) is a product of permutation and unit upper (lower) triangular matrices, and D is Hermitian and block diagonal with 1-by-1 and 2-by-2 diagonal blocks. π
- If some
D(i,i)=0, so that D is exactly singular, then the routine returns withINFO = i. Otherwise, the factored form of A is used to estimate the condition number of the matrix A (see argumentRCOND). If the reciprocal of the condition number is less than machine precision, the routine still goes on to solve for X and compute error bounds as described below. she keeps going even when it's bad. main character energy. - The system of equations is solved for X using the factored form of A.
- By default (unless
PARAMS(LA_LINRX_ITREF_I)is set to zero), the routine will use iterative refinement to try to get a small error and error bounds. Refinement calculates the residual to at least twice the working precision. π₯ - If equilibration was used, the matrix X is premultiplied by
diag(R)so that it solves the original system before equilibration.
Some optional parameters are bundled in the PARAMS array. These settings determine how refinement is performed, but often the defaults are acceptable. If the defaults are acceptable, users can pass NPARAMS = 0 which prevents the source code from accessing the PARAMS argument. defaults girlies, this one's for you π«Ά
π Parameters
FACTβCHARACTER*1. Specifies whether or not the factored form of the matrix A is supplied on entry, and if not, whether the matrix A should be equilibrated before it is factored.= 'F': On entry,AFandIPIVcontain the factored form of A. IfEQUEDis not'N', the matrix A has been equilibrated with scaling factors given byS.A,AF, andIPIVare not modified.= 'N': The matrix A will be copied toAFand factored.= 'E': The matrix A will be equilibrated if necessary, then copied toAFand factored.
UPLOβCHARACTER*1.= 'U': Upper triangle of A is stored;= 'L': Lower triangle of A is stored.
NβINTEGER. The number of linear equations, i.e., the order of the matrix A.N >= 0.NRHSβINTEGER. The number of right hand sides, i.e., the number of columns of the matrices B and X.NRHS >= 0.AβCOMPLEX*16array, dimension(LDA,N). The Hermitian matrix A. IfUPLO = 'U', the leading N-by-N upper triangular part of A contains the upper triangular part of the matrix A, and the strictly lower triangular part of A is not referenced. IfUPLO = 'L', the leading N-by-N lower triangular part of A contains the lower triangular part of the matrix A, and the strictly upper triangular part of A is not referenced.
On exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by diag(S)*A*diag(S). π
LDAβINTEGER. The leading dimension of the array A.LDA >= max(1,N).AFAFβCOMPLEX*16 array, dimension (LDAF,N)
bestie, AF is doing a lot depending on what FACT is set to:
- If
FACT = 'F', thenAFis an input argument, and on entry it contains the block diagonal matrixDand the multipliers used to obtain the factorUorLfrom the factorizationA = U*D*U**HorA = L*D*L**Has computed byZHETRF. - If
FACT = 'N', thenAFis an output argument, and on exit it returns the block diagonal matrixDand the multipliers used to obtain the factorUorLfrom the factorizationA = U*D*U**HorA = L*D*L**H.
LDAFβINTEGER
The leading dimension of the array AF. LDAF >= max(1,N). no cap, it's gotta be at least that big.
IPIVβINTEGER array, dimension (N)
If FACT = 'F', then IPIV is an input argument and on entry it contains details of the interchanges and the block structure of D, as determined by ZHETRF.
- If
IPIV(k) > 0, then rows and columnskandIPIV(k)were interchanged andD(k,k)is a 1-by-1 diagonal block. - If
UPLO = 'U'andIPIV(k) = IPIV(k-1) < 0, then rows and columnsk-1and-IPIV(k)were interchanged andD(k-1:k,k-1:k)is a 2-by-2 diagonal block. - If
UPLO = 'L'andIPIV(k) = IPIV(k+1) < 0, then rows and columnsk+1and-IPIV(k)were interchanged andD(k:k+1,k:k+1)is a 2-by-2 diagonal block.
If FACT = 'N', then IPIV is an output argument, and on exit it contains details of the interchanges and the block structure of D, as determined by ZHETRF. π«Ά
EQUEDβCHARACTER*1
Specifies the form of equilibration that was done. (equilibration era π )
= 'N': No equilibration (always true ifFACT = 'N').= 'Y': Both row and column equilibration, i.e.,Ahas been replaced bydiag(S) * A * diag(S).
EQUED is an input argument if FACT = 'F'; otherwise, it's an output argument.
SβDOUBLE PRECISION array, dimension (N)
The scale factors for A. If EQUED = 'Y', A is multiplied on the left and right by diag(S). S is an input argument if FACT = 'F'; otherwise, S is an output argument.
If FACT = 'F' and EQUED = 'Y', each element of S must be positive.
If S is output, each element of S is a power of the radix. If S is input, each element of S should be a power of the radix to ensure a reliable solution and error estimates. Scaling by powers of the radix does not cause rounding errors unless the result underflows or overflows. Rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, producing error estimates that may not be reliable.
π¨ that last bit is the important tea β mess with S in a non-radix-power way and your error estimates stop being trustworthy. periodt.
BβCOMPLEX*16 array, dimension (LDB,NRHS)
On entry, the N-by-NRHS right hand side matrix B.
On exit:
- if
EQUED = 'N',Bis not modified; - if
EQUED = 'Y',Bis overwritten bydiag(S)*B;
LDBβINTEGER
The leading dimension of the array B. LDB >= max(1,N).
XβCOMPLEX*16 array, dimension (LDX,NRHS)
If INFO = 0, the N-by-NRHS solution matrix X to the original system of equations. Note that A and B are modified on exit if EQUED .ne. 'N', and the solution to the equilibrated system is inv(diag(S))*X. β¨
LDXβINTEGER
The leading dimension of the array X. LDX >= max(1,N).
RCONDβDOUBLE PRECISION
Reciprocal scaled condition number. This is an estimate of the reciprocal Skeel condition number of the matrix A after equilibration (if done). If this is less than the machine precision (in particular, if it is zero), the matrix is singular to working precision.
Note that the error may still be small even if this number is very small and the matrix appears ill-conditioned. π (she's giving "don't panic yet")
RPVGRWβDOUBLE PRECISION
Reciprocal pivot growth. On exit, this contains the reciprocal pivot growth factor norm(A)/norm(U). The 'max absolute element' norm is used.
If this is much less than 1, then the stability of the LU factorization of the (equilibrated) matrix A could be poor. This also means that the solution X, estimated condition numbers, and error bounds could be unreliable.
If factorization fails with 0<INFO<=N, then this contains the reciprocal pivot growth factor for the leading INFO columns of A.
BERRβDOUBLE PRECISION array, dimension (NRHS)
Componentwise relative backward error. This is the componentwise relative backward error of each solution vector X(j) (i.e., the smallest relative change in any element of A or B that makes X(j) an exact solution). π₯
N_ERR_BNDSβINTEGER
Number of error bounds to return for each right hand side and each type (normwise or componentwise). See ERR_BNDS_NORM and ERR_BNDS_COMP below. π
ERR_BNDS_NORMβDOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
For each right-hand side, this array contains information about various error bounds and condition numbers corresponding to the normwise relative error, which is defined as follows:
Normwise relative error in the ith solution vector:
max_j (abs(XTRUE(j,i) - X(j,i)))
------------------------------
max_j abs(X(j,i))
The array is indexed by the type of error information as described below. There currently are up to three pieces of information returned.
The first index in ERR_BNDS_NORM(i,:) corresponds to the ith right-hand side.
The second index in ERR_BNDS_NORM(:,err) contains the following three fields:
err = 1β 'Trust/don't trust' boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * dlamch('Epsilon').err = 2β 'Guaranteed' error bound: The estimated forward error, almost certainly within a factor of10of the true error so long as the next entry is greater than the thresholdsqrt(n) * dlamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.err = 3β Reciprocal condition number: Estimated normwise reciprocal condition number. Compared with the thresholdsqrt(n) * dlamch('Epsilon')to determine if the error estimate is 'guaranteed'. These reciprocal condition numbers are1 / (norm(Z^{-1},inf) * norm(Z,inf))for some appropriately scaled matrixZ. LetZ = S*A, whereSscales each row by a power of the radix so all absolute row sums ofZare approximately1.
See Lapack Working Note 165 for further details and extra cautions. π
ERR_BNDS_COMPβDOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
For each right-hand side, this array contains information about various error bounds and condition numbers corresponding to the componentwise relative error, which is defined as follows:
Componentwise relative error in the ith solution vector:
abs(XTRUE(j,i) - X(j,i))
max_j ----------------------
abs(X(j,i))
The array is indexed by the right-hand side i (on which the componentwise relative error depends), and the type of error information as described below. There currently are up to three pieces of information returned for each right-hand side. If componentwise accuracy is not requested (PARAMS(3) = 0.0), then ERR_BNDS_COMP is not accessed. If N_ERR_BNDS < 3, then at most the first (:,N_ERR_BNDS) entries are returned.
The first index in ERR_BNDS_COMP(i,:) corresponds to the ith right-hand side.
The second index in ERR_BNDS_COMP(:,err) contains the following three fields:
err = 1β 'Trust/don't trust' boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * dlamch('Epsilon').err = 2β 'Guaranteed' error bound: The estimated forward error, almost certainly within a factor of10of the true error so long as the next entry is greater than the thresholdsqrt(n) * dlamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.err = 3β Reciprocal condition number: Estimated componentwise reciprocal condition number. Compared with the thresholdsqrt(n) * dlamch('Epsilon')to determine if the error estimate is 'guaranteed'. These reciprocal condition numbers are1 / (norm(Z^{-1},inf) * norm(Z,inf))for some appropriately scaled matrixZ. LetZ = S*(A*diag(x)), wherexis the solution for the current right-hand side andSscales each row ofA*diag(x)by a power of the radix so all absolute row sums ofZare approximately1.
See Lapack Working Note 165 for further details and extra cautions. π§
NPARAMSβINTEGER
Specifies the number of parameters set in PARAMS. If <= 0, the PARAMS array is never referenced and default values are used. π
PARAMSβDOUBLE PRECISION array, dimension NPARAMS
Specifies algorithm parameters. If an entry is < 0.0, then that entry will be filled with default value used for that parameter. Only positions up to NPARAMS are accessed; defaults are used for higher-numbered parameters.
PARAMS(LA_LINRX_ITREF_I = 1): Whether to perform iterative refinement or not. Default:1.0D+0= 0.0: No refinement is performed, and no error bounds are computed.= 1.0: Use the extra-precise refinement algorithm.- (other values are reserved for future use)
PARAMS(LA_LINRX_ITHRESH_I = 2)β the maximum number of residual computations allowed for refinement, bestie. Default: 10.
Aggressive mode: set it to 100 to permit convergence using approximate factorizations, or factorizations that aren't LU at all. But listen β if the factorization uses a technique other than Gaussian elimination, the guarantees in err_bnds_norm and err_bnds_comp may no longer be trustworthy. π« So like, slay, but at your own risk.
PARAMS(LA_LINRX_CWISE_I = 3)β a flag deciding whether the code will attempt to find a solution with small componentwise relative error in the double-precision algorithm. Positive is true, 0.0 is false.
Default: 1.0 (attempt componentwise convergence).
WORK
WORK is COMPLEX*16 array, dimension (5*N). β¨
RWORK
RWORK is DOUBLE PRECISION array, dimension (2*N). πΈ
INFO
INFO is INTEGER. Here's the whole vibe check, no cap:
= 0: Successful exit. The solution to every right-hand side is guaranteed. π< 0: IfINFO = -i, the i-th argument had an illegal value. π> 0and<= N:U(INFO,INFO)is exactly zero. The factorization has been completed, but the factorUis exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned. π= N+J: The solution corresponding to the Jth right-hand side is not guaranteed. The solutions corresponding to other right-hand sides K withK > Jmay not be guaranteed as well, but only the first such right-hand side is reported.
If a small componentwise error is not requested (PARAMS(3) = 0.0) then the Jth right-hand side is the first with a normwise error bound that is not guaranteed (the smallest J such that ERR_BNDS_NORM(J,1) = 0.0).
By default (PARAMS(3) = 1.0) the Jth right-hand side is the first with either a normwise or componentwise error bound that is not guaranteed (the smallest J such that either ERR_BNDS_NORM(J,1) = 0.0 or ERR_BNDS_COMP(J,1) = 0.0).
See the definition of ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information about all of the right-hand sides, check ERR_BNDS_NORM or ERR_BNDS_COMP. π§
π Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π Author
Generated automatically by Doxygen for LAPACK from the source code.
And that's a wrap on the whole page, bestie!! π This iconic little artifact comes to you from LAPACK Version 3.11.0, dated Sun Nov 27 2022 β and it's filed under complex16HEsolve(3). Go forth and solve responsibly, mwah πβ¨π¦
π¦ 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