hpsvx(3)
okay bestie, welcome to the hpsvx(3) glow-up โจ โ this is the Library Functions Manual page for the <rainbow>{hp,sp}svx</rainbow> crew, and the vibe is literally โfactor and solve, expert.โ ๐
โจ NAME โจ
hpsvx โ {hp,sp}svx: factor and solve, expert. ๐
๐ธ SYNOPSIS ๐ธ
๐ Functions ๐
chpsvxโ CHPSVX computes the solution to system of linear equations A * X = B for OTHER matrices
subroutine chpsvx (fact, uplo, n, nrhs, ap, afp, ipiv, b, ldb, x, ldx,
rcond, ferr, berr, work, rwork, info)
cspsvxโ CSPSVX computes the solution to system of linear equations A * X = B for OTHER matrices
subroutine cspsvx (fact, uplo, n, nrhs, ap, afp, ipiv, b, ldb, x, ldx,
rcond, ferr, berr, work, rwork, info)
dspsvxโ DSPSVX computes the solution to system of linear equations A * X = B for OTHER matrices
subroutine dspsvx (fact, uplo, n, nrhs, ap, afp, ipiv, b, ldb, x, ldx,
rcond, ferr, berr, work, iwork, info)
sspsvxโ SSPSVX computes the solution to system of linear equations A * X = B for OTHER matrices
subroutine sspsvx (fact, uplo, n, nrhs, ap, afp, ipiv, b, ldb, x, ldx,
rcond, ferr, berr, work, iwork, info)
zhpsvxโ ZHPSVX computes the solution to system of linear equations A * X = B for OTHER matrices
subroutine zhpsvx (fact, uplo, n, nrhs, ap, afp, ipiv, b, ldb, x, ldx,
rcond, ferr, berr, work, rwork, info)
zspsvxโ ZSPSVX computes the solution to system of linear equations A * X = B for OTHER matrices
subroutine zspsvx (fact, uplo, n, nrhs, ap, afp, ipiv, b, ldb, x, ldx,
rcond, ferr, berr, work, rwork, info)
๐ Detailed Description ๐
This section is literally just a heading in the source, bestie โ the actual deets are living their best life in Function Documentation right below. ๐ซถ
๐งฎ Function Documentation ๐งฎ
๐ subroutine chpsvx ๐
subroutine chpsvx (character fact, character uplo, integer n, integer nrhs,
complex, dimension( * ) ap, complex, dimension( * ) afp, integer,
dimension( * ) ipiv, complex, dimension( ldb, * ) b, integer ldb,
complex, dimension( ldx, * ) x, integer ldx, real rcond, real,
dimension( * ) ferr, real, dimension( * ) berr, complex, dimension( * )
work, real, dimension( * ) rwork, integer info)
CHPSVX computes the solution to system of linear equations A * X = B for OTHER matrices.
โจ Purpose โจ
CHPSVX uses the diagonal pivoting factorization A = U*D*U**H or A = L*D*L**H to compute the solution to a complex system of linear equations A * X = B, where A is an N-by-N Hermitian matrix stored in packed format 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 factorAasA = U * D * U**H, ifUPLO = 'U', orA = L * D * L**H, ifUPLO = 'L', whereU(orL) is a product of permutation and unit upper (lower) triangular matrices andDis 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โFACT is CHARACTER*1. Specifies whether or not the factored form ofAhas been supplied on entry.= 'F': On entry,AFPandIPIVcontain the factored form ofA.AFPandIPIVwill not be modified.= 'N': The matrixAwill be copied toAFPand factored.
UPLOโUPLO is CHARACTER*1.= 'U': Upper triangle ofAis stored.= 'L': Lower triangle ofAis stored.
NโN is INTEGER. The number of linear equations, i.e., the order of the matrixA.N >= 0.NRHSโNRHS is INTEGER. The number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >= 0.APโAP is COMPLEX array, dimension (N*(N+1)/2). The upper or lower triangle of the Hermitian matrixA, packed columnwise in a linear array. The j-th column ofAis stored in the arrayAPas follows:- if
UPLO = 'U',AP(i + (j-1)*j/2) = A(i,j)for1<=i<=j; - if
UPLO = 'L',AP(i + (j-1)*(2*n-j)/2) = A(i,j)forj<=i<=n.
- if
See below for further details.
AFPโAFP is COMPLEX array, dimension (N*(N+1)/2).
If FACT = 'F', then AFP is an input argument and on entry contains 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 CHPTRF, stored as a packed triangular matrix in the same storage format as A.
If FACT = 'N', then AFP is an output argument and on exit contains 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 CHPTRF, stored as a packed triangular matrix in the same storage format as A.
IPIVโIPIV is INTEGER array, dimension (N).
If FACT = 'F', then IPIV is an input argument and on entry contains details of the interchanges and the block structure of D, as determined by CHPTRF.
If IPIV(k) > 0, then rows and columns k and IPIV(k) were interchanged and D(k,k) is a 1-by-1 diagonal block.
If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0, then rows and columns k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k) is a 2-by-2 diagonal block.
If UPLO = 'L' and IPIV(k) = IPIV(k+1) < 0, then rows and columns k+1 and -IPIV(k) were interchanged and D(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 contains details of the interchanges and the block structure of D, as determined by CHPTRF.
BโB is COMPLEX array, dimension (LDB,NRHS). The N-by-NRHS right hand side matrixB.LDBโLDB is INTEGER. The leading dimension of the arrayB.LDB >= max(1,N).XโX is COMPLEX array, dimension (LDX,NRHS). IfINFO = 0orINFO = N+1, the N-by-NRHS solution matrixX.LDXโLDX is INTEGER. The leading dimension of the arrayX.LDX >= max(1,N).RCONDโRCOND is REAL. The estimate of the reciprocal condition number of the matrixA. 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.FERRโFERR is REAL array, dimension (NRHS). The estimated forward error bound for each solution vectorX(j)(the j-th column of the solution matrixX). 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.BERRโBERR is REAL array, dimension (NRHS). The componentwise relative backward error of each solution vectorX(j)(i.e., the smallest relative change in any element ofAorBthat makesX(j)an exact solution).WORKโWORK is COMPLEX array, dimension (2*N).RWORKโRWORK is REAL array, dimension (N).INFOโINFO is INTEGER.= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: ifINFO = i, andiis<= N:D(i,i)is exactly zero. The factorization has been completed but the factorDis exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned.= N+1:Dis 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.
bestie, ifRCONDis tiny or zero, that matrix is singular to working precision โ read theINFOtea before trusting the solve. ๐จ๐
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ Further Details ๐
The packed storage scheme is illustrated by the following example when N = 4, UPLO = 'U':
Two-dimensional storage of the Hermitian matrix A:
a11 a12 a13 a14
a22 a23 a24
a33 a34 (aij = conjg(aji))
a44
Packed storage of the upper triangle of A:
AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
Definition at line 275 of file chpsvx.f.
subroutine cspsvx
subroutine cspsvx (character fact, character uplo, integer n, integer nrhs,
complex, dimension( * ) ap, complex, dimension( * ) afp, integer,
dimension( * ) ipiv, complex, dimension( ldb, * ) b, integer ldb,
complex, dimension( ldx, * ) x, integer ldx, real rcond, real,
dimension( * ) ferr, real, dimension( * ) berr, complex, dimension( * )
work, real, dimension( * ) rwork, integer info)
okay so bestie, CSPSVX computes the solution to system of linear equations A * X = B for OTHER matrices ๐
(and yes the all-caps "OTHER" is doing main character energy, we respect it).
Purpose ๐
!>
!> CSPSVX uses the diagonal pivoting factorization A = U*D*U**T or
!> A = L*D*L**T to compute the solution to a complex system of linear
!> equations A * X = B, where A is an N-by-N symmetric matrix stored
!> in packed format and X and B are N-by-NRHS matrices.
!>
!> Error bounds on the solution and a condition estimate are also
!> provided.
!>
Translation: CSPSVX uses the diagonal pivoting factorization A = U*D*U**T or A = L*D*L**T to solve a complex system of linear equations A * X = B, where A is an N-by-N symmetric matrix stored in packed format, and X and B are N-by-NRHS matrices. It also hands you error bounds on the solution plus a condition estimate. So generous, honestly ๐ซถ.
Description ๐ธ
The following steps are performed:
- If
FACT = 'N', the diagonal pivoting method is used to factorAas
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 symmetric 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. (she literally warns you and then does the thing anyway, iconic) - 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,AFPandIPIVcontain the factored form ofA.AP,AFPandIPIVwill not be modified.= 'N': The matrixAwill be copied toAFPand 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.APโ isCOMPLEXarray, dimension(N*(N+1)/2). The upper or lower triangle of the symmetric matrixA, packed columnwise in a linear array. The j-th column ofAis stored in the arrayAPas follows:
if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n.
See below for further details. ๐
AFPโ isCOMPLEXarray, dimension(N*(N+1)/2). IfFACT = 'F', thenAFPis an input argument and on entry contains the block diagonal matrixDand the multipliers used to obtain the factorUorLfrom the factorizationA = U*D*U**TorA = L*D*L**Tas computed byCSPTRF, stored as a packed triangular matrix in the same storage format asA. IfFACT = 'N', thenAFPis an output argument and on exit contains the block diagonal matrixDand the multipliers used to obtain the factorUorLfrom the factorizationA = U*D*U**TorA = L*D*L**Tas computed byCSPTRF, stored as a packed triangular matrix in the same storage format asA. (same storage format asA, she said, twice, because it matters ๐)IPIVโ isINTEGERarray, dimension(N). IfFACT = 'F', thenIPIVis an input argument and on entry contains details of the interchanges and the block structure ofD, as determined byCSPTRF. IfIPIV(k) > 0, then rows and columnskandIPIV(k)were interchanged andD(k,k)is a 1-by-1 diagonal block. IfUPLO = '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. IfUPLO = '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. ๐ฅ IfFACT = 'N', thenIPIVis an output argument and on exit contains details of the interchanges and the block structure ofD, as determined byCSPTRF.Bโ isCOMPLEXarray, dimension(LDB,NRHS). The N-by-NRHS right hand side matrixB.LDBโ isINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).Xโ isCOMPLEXarray, dimension(LDX,NRHS). IfINFO = 0orINFO = N+1, the N-by-NRHS solution matrixX. (the payoff, the moment, the slay)LDXโ isINTEGER. The leading dimension of the arrayX.LDX >= max(1,N).RCONDโ isREAL. The estimate of the reciprocal condition number of the matrixA. 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.FERRโ isREALarray, dimension(NRHS). The estimated forward error bound for each solution vectorX(j)(the j-th column of the solution matrixX). 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 a lil dramatic, she overestimates, we love her for it)BERRโ isREALarray, dimension(NRHS). The componentwise relative backward error of each solution vectorX(j)(i.e., the smallest relative change in any element ofAorBthat makesX(j)an exact solution).WORKโ isCOMPLEXarray, dimension(2*N).RWORKโ isREALarray, dimension(N).INFOโ isINTEGER.= 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 factorDis exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned.= N+1:Dis 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. (she computes it anyway bc sometimes the vibe check is wrong, no cap)
Author ๐
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details: ๐ฆ
The packed storage scheme is illustrated by the following example when N = 4, UPLO = 'U':
Two-dimensional storage of the symmetric matrix A:
a11 a12 a13 a14
a22 a23 a24
a33 a34 (aij = aji)
a44
Packed storage of the upper triangle of A:
AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
see how she just... folds it up? diagonal by diagonal? obsessed ๐
Definition at line 275 of file cspsvx.f.
subroutine dspsvx
subroutine dspsvx (character fact, character uplo, integer n, integer nrhs,
double precision, dimension( * ) ap, double precision, dimension( * )
afp, integer, dimension( * ) ipiv, double precision, dimension( ldb, * )
b, integer ldb, double precision, dimension( ldx, * ) x, integer ldx,
double precision rcond, double precision, dimension( * ) ferr, double
precision, dimension( * ) berr, double precision, dimension( * ) work,
integer, dimension( * ) iwork, integer info)
DSPSVX computes the solution to system of linear equations A * X = B for OTHER matrices โจ โ yes it's the real-valued sibling of the one above, same energy, different precision.
Purpose ๐
!>
!> DSPSVX uses the diagonal pivoting factorization A = U*D*U**T or
!> A = L*D*L**T to compute the solution to a real system of linear
!> equations A * X = B, where A is an N-by-N symmetric matrix stored
!> in packed format and X and B are N-by-NRHS matrices.
!>
!> Error bounds on the solution and a condition estimate are also
!> provided.
!>
so DSPSVX pulls the same diagonal pivoting factorization A = U*D*U**T or A = L*D*L**T to solve a real system A * X = B, where A is an N-by-N symmetric matrix in packed format and X and B are N-by-NRHS matrices. Error bounds and a condition estimate on the solution? Also provided. She came prepared ๐.
Description ๐
(hold that thought โ the steps are literally right there, next part, don't come for me ๐ญ)
okay so the step-by-step for DSPSVX is giving main character energy:
- If
FACT = 'N', the 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 symmetric 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. 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 for X and compute error bounds as described below. - The system of equations is solved for X using the factored form of A.
- Iterative refinement is applied to improve the computed solution matrix and calculate error bounds and backward error estimates for it.
๐ธ Parameters ๐ธ
FACTโFACT is CHARACTER*1. Specifies whether or not the factored form of A has been supplied on entry.= 'F':On entry,AFPandIPIVcontain the factored form of A.AP,AFPandIPIVwill not be modified.= 'N':The matrix A will be copied toAFPand factored.
UPLOโUPLO is CHARACTER*1.= 'U':Upper triangle of A is stored;= 'L':Lower triangle of A is stored.
NโN is INTEGER. The number of linear equations, i.e., the order 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.APโAP is DOUBLE PRECISION array, dimension (N*(N+1)/2). The upper or lower triangle of the symmetric matrix A, packed columnwise in a linear array. The j-th column of A is stored in the arrayAPas follows:- if
UPLO = 'U',AP(i + (j-1)*j/2) = A(i,j)for1<=i<=j; - if
UPLO = 'L',AP(i + (j-1)*(2*n-j)/2) = A(i,j)forj<=i<=n.
- if
See below for further details.
AFPโAFP is DOUBLE PRECISION array, dimension (N*(N+1)/2).- If
FACT = 'F', thenAFPis an input argument and on entry contains the block diagonal matrix D and the multipliers used to obtain the factor U or L from the factorizationA = U*D*U**TorA = L*D*L**Tas computed byDSPTRF, stored as a packed triangular matrix in the same storage format as A. - If
FACT = 'N', thenAFPis an output argument and on exit contains the block diagonal matrix D and the multipliers used to obtain the factor U or L from the factorizationA = U*D*U**TorA = L*D*L**Tas computed byDSPTRF, stored as a packed triangular matrix in the same storage format as A.
- If
IPIVโIPIV is INTEGER array, dimension (N).- If
FACT = 'F', thenIPIVis an input argument and on entry contains details of the interchanges and the block structure of D, as determined byDSPTRF. - If
IPIV(k) > 0, then rows and columns k andIPIV(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 columns k-1 and-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 columns k+1 and-IPIV(k)were interchanged andD(k:k+1,k:k+1)is a 2-by-2 diagonal block. - If
FACT = 'N', thenIPIVis an output argument and on exit contains details of the interchanges and the block structure of D, as determined byDSPTRF.
- If
BโB is DOUBLE PRECISION array, dimension (LDB,NRHS). The N-by-NRHS right hand side matrix B.LDBโLDB is INTEGER. The leading dimension of the array B.LDB >= max(1,N).XโX is DOUBLE PRECISION array, dimension (LDX,NRHS). IfINFO = 0orINFO = N+1, the N-by-NRHS solution matrix X.LDXโLDX is INTEGER. The leading dimension of the array X.LDX >= max(1,N).RCONDโRCOND is 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.FERRโFERR is DOUBLE PRECISION array, 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.BERRโBERR is DOUBLE PRECISION array, 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).WORKโWORK is DOUBLE PRECISION array, dimension (3*N).IWORKโIWORK is INTEGER array, dimension (N).INFOโINFO is INTEGER.= 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.
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ Further Details ๐
The packed storage scheme is illustrated by the following example when N = 4, UPLO = 'U':
Two-dimensional storage of the symmetric matrix A:
a11 a12 a13 a14
a22 a23 a24
a33 a34 (aij = aji)
a44
Packed storage of the upper triangle of A:
AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
Definition at line 274 of file dspsvx.f.
๐ง subroutine sspsvx ๐ง
subroutine sspsvx (character fact, character uplo, integer n, integer nrhs,
real, dimension( * ) ap, real, dimension( * ) afp, integer, dimension( *
) ipiv, real, dimension( ldb, * ) b, integer ldb, real, dimension( ldx,
* ) x, integer ldx, real rcond, real, dimension( * ) ferr, real,
dimension( * ) berr, real, dimension( * ) work, integer, dimension( * )
iwork, integer info)
SSPSVX computes the solution to system of linear equations A * X = B for OTHER matrices periodt.
โจ Purpose โจ
SSPSVX uses the diagonal pivoting factorization A = U*D*U**T or A = L*D*L**T to compute the solution to a real system of linear equations A * X = B, where A is an N-by-N symmetric matrix stored in packed format 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 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 symmetric 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. 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 for X and compute error bounds as described below. - The system of equations is solved for X using the factored form of A.
- Iterative refinement is applied to improve the computed solution matrix and calculate error bounds and backward error estimates for it.
๐ Parameters ๐
FACTโFACT is CHARACTER*1. Specifies whether or not the factored form of A has been supplied on entry.= 'F':On entry,AFPandIPIVcontain the factored form of A.AP,AFPandIPIVwill not be modified.= 'N':The matrix A will be copied toAFPand factored.
UPLOUPLOโ ok soUPLOis aCHARACTER*1, and it's literally just picking a triangle.'U'means the upper triangle ofAis stored;'L'means the lower triangle ofAis stored. That's the whole vibe ๐NโNisINTEGER, bestie. It's the number of linear equations, i.e., the order of the matrixA. And the rule isN >= 0โ no negative nonsense ๐ซถNRHSโNRHSisINTEGERtoo. It's the number of right hand sides, i.e., the number of columns of the matricesBandX. Requirement:NRHS >= 0โจAPโAPis aREALarray, dimension(N*(N+1)/2). It's the upper or lower triangle of the symmetric matrixA, packed columnwise in a linear array. Thej-th column ofAis stored in the arrayAPas follows:- if
UPLO = 'U',AP(i + (j-1)*j/2) = A(i,j)for1<=i<=j; - if
UPLO = 'L',AP(i + (j-1)*(2*n-j)/2) = A(i,j)forj<=i<=n. See below for further details ๐
- if
AFPโAFPis aREALarray, dimension(N*(N+1)/2). IfFACT = 'F', thenAFPis an input argument and on entry contains the block diagonal matrixDand the multipliers used to obtain the factorUorLfrom the factorizationA = U*D*U**TorA = L*D*L**Tas computed bySSPTRF, stored as a packed triangular matrix in the same storage format asA.
If FACT = 'N', then AFP is an output argument and on exit contains the block diagonal matrix D and the multipliers used to obtain the factor U or L from the factorization A = U*D*U**T or A = L*D*L**T as computed by SSPTRF, stored as a packed triangular matrix in the same storage format as A. Same energy, different direction ๐
IPIVโIPIVis anINTEGERarray, dimension(N). IfFACT = 'F', thenIPIVis an input argument and on entry contains details of the interchanges and the block structure ofD, as determined bySSPTRF.- If
IPIV(k) > 0, then rows and columnskandIPIV(k)were interchanged andD(k,k)is a1-by-1diagonal 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 a2-by-2diagonal 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 a2-by-2diagonal block.
- If
If FACT = 'N', then IPIV is an output argument and on exit contains details of the interchanges and the block structure of D, as determined by SSPTRF. Basically it's the receipts of what got swapped ๐
BโBis aREALarray, dimension(LDB,NRHS). It's theN-by-NRHSright hand side matrixB. The main character of the equation, lowkey ๐LDBโLDBisINTEGER. It's the leading dimension of the arrayB, and you needLDB >= max(1,N). Respect the bounds, bestie ๐ซกXโXis aREALarray, dimension(LDX,NRHS). IfINFO = 0orINFO = N+1, this is theN-by-NRHSsolution matrixX. The moment we've all been waiting for โจLDXโLDXisINTEGER. It's the leading dimension of the arrayX, and the rule isLDX >= max(1,N). Keep it valid or it's giving illegal argument energy ๐ญRCONDโRCONDisREAL. It's the estimate of the reciprocal condition number of the matrixA. 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 ifRCONDis tiny or zero, that's your red flag era. The routine is literally telling you the matrix is singular to working precision, andINFO > 0is the clue ๐
FERRโFERRis aREALarray, dimension(NRHS). It's the estimated forward error bound for each solution vectorX(j)(thej-th column of the solution matrixX). 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. So it's a little dramatic, but in a helpful way ๐BERRโBERRis aREALarray, dimension(NRHS). It's the componentwise relative backward error of each solution vectorX(j)(i.e., the smallest relative change in any element ofAorBthat makesX(j)an exact solution). Tiny number, big meaning ๐WORKโWORKis aREALarray, dimension(3*N). It's the workspace, doing background support like a true bestie ๐ซถIWORKโIWORKis anINTEGERarray, dimension(N). More workspace, but integer flavored โจINFOโINFOisINTEGER, and this is the status report:= 0: successful exit. Slay.< 0: ifINFO = -i, thei-th argument had an illegal value. Not iconic.> 0: ifINFO = i, andiis<= N:D(i,i)is exactly zero. The factorization has been completed but the factorDis exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned.= N+1:Dis 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.
TheINFO = N+1case is giving "warning, but we still pulled through" energy. The routine still computes the solution and error bounds because sometimes the computed solution is more accurate thanRCONDwould suggest ๐ฅ
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ Further Details: ๐
The packed storage scheme is illustrated by the following example when N = 4, UPLO = 'U':
Two-dimensional storage of the symmetric matrix A:
a11 a12 a13 a14
a22 a23 a24
a33 a34 (aij = aji)
a44
Packed storage of the upper triangle of A:
AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
Definition at line 274 of file sspsvx.f.
๐ฆ subroutine zhpsvx ๐ฆ
subroutine zhpsvx (character fact, character uplo, integer n, integer nrhs,
complex*16, dimension( * ) ap, complex*16, dimension( * ) afp, 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, double precision, dimension( * )
rwork, integer info)
ZHPSVX computes the solution to system of linear equations A * X = B for OTHER matrices.
๐ฏ Purpose ๐ฏ
ZHPSVX uses the diagonal pivoting factorization A = U*D*U**H or A = L*D*L**H to compute the solution to a complex system of linear equations A * X = B, where A is an N-by-N Hermitian matrix stored in packed format and X and B are N-by-NRHS matrices.
Error bounds on the solution and a condition estimate are also provided. Yes, it's thorough, and we love that for us ๐
๐ Description ๐
The following steps are performed:
- If
FACT = 'N', the diagonal pivoting method is used to factorAas
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โFACTisCHARACTER*1. It specifies whether or not the factored form ofAhas been supplied on entry.= 'F': On entry,AFPandIPIVcontain the factored form ofA.AFPandIPIVwill not be modified.= 'N': The matrixAwill be copied toAFPand factored. Pick your lane, bestie ๐
UPLOโUPLOisCHARACTER*1.= 'U': Upper triangle ofAis stored;= 'L': Lower triangle ofAis stored. Triangle choice, but make it Hermitian โจ
NโNisINTEGER. It's the number of linear equations, i.e., the order of the matrixA.N >= 0, always ๐ซถNRHSโNRHSisINTEGER. It's the number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >= 0, no cap ๐ฏAPโAPis aCOMPLEX*16array, dimension(N*(N+1)/2). It's the upper or lower triangle of the Hermitian matrixA, packed columnwise in a linear array. Thej-th column ofAis stored in the arrayAPas follows:- if
UPLO = 'U',AP(i + (j-1)*j/2) = A(i,j)for1<=i<=j; - if
UPLO = 'L',AP(i + (j-1)*(2*n-j)/2) = A(i,j)forj<=i<=n. See below for further details ๐
- if
AFPโAFPโ okay soAFPis aCOMPLEX*16array, dimension(N*(N+1)/2). IfFACT = 'F', thenAFPis 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 byZHPTRF, stored as a packed triangular matrix in the same storage format asA. IfFACT = 'N', thenAFPis an output argument and on exit it contains that same block diagonal matrixDand the multipliers used to obtain the factorUorLfrom the factorizationA = U*D*U**HorA = L*D*L**Has computed byZHPTRF, stored as a packed triangular matrix in the same storage format asA. slay, storage format twins ๐IPIVโIPIVis anINTEGERarray, dimension(N). IfFACT = 'F', thenIPIVis an input argument and on entry it contains details of the interchanges and the block structure ofD, as determined byZHPTRF. iykyk, this is the receipts ๐งพ- 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', thenIPIVis an output argument and on exit it contains details of the interchanges and the block structure ofD, as determined byZHPTRF.
- If
BโBis aCOMPLEX*16array, dimension(LDB,NRHS). It's theN-by-NRHSright hand side matrixB. the main character of the equation, honestly ๐ซถLDBโLDBisINTEGER. It's the leading dimension of the arrayB, andLDB >= max(1,N). respect the leading dimension or catch hands ๐ซตXโXis aCOMPLEX*16array, dimension(LDX,NRHS). IfINFO = 0orINFO = N+1, this is theN-by-NRHSsolution matrixX. the answer era โจLDXโLDXisINTEGER. It's the leading dimension of the arrayX, andLDX >= max(1,N). same energy asLDB, no cap ๐RCONDโRCONDisDOUBLE PRECISION. It's the estimate of the reciprocal condition number of the matrixA. 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. bestie, that's the โuh ohโ signal ๐จFERRโFERRis aDOUBLE PRECISIONarray, dimension(NRHS). It's the estimated forward error bound for each solution vectorX(j)(the j-th column of the solution matrixX). 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. generous king, giving us an upper bound ๐BERRโBERRis aDOUBLE PRECISIONarray, dimension(NRHS). It's the componentwise relative backward error of each solution vectorX(j)(i.e., the smallest relative change in any element ofAorBthat makesX(j)an exact solution). backward error but make it fashion ๐ซWORKโWORKis aCOMPLEX*16array, dimension(2*N). scratch space, doing behind-the-scenes work ๐ ๏ธRWORKโRWORKis aDOUBLE PRECISIONarray, dimension(N). more scratch space, real-valued this time ๐INFOโINFOisINTEGER. the vibe check at the end ๐= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: ifINFO = i, andiis:<= N:D(i,i)is exactly zero. The factorization has been completed but the factorDis exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned.= N+1:Dis 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: sometimes the โbadโ condition number still eats ๐ญ๐ฅ
Author ๐ซถ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
shoutout to the Unix aunties and uncles who wrote this down, fr fr ๐ฟ
Further Details: ๐ธ
The packed storage scheme is illustrated by the following example when N = 4, UPLO = 'U':
Two-dimensional storage of the Hermitian matrix A:
a11 a12 a13 a14
a22 a23 a24
a33 a34 (aij = conjg(aji))
a44
Packed storage of the upper triangle of A:
AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
visual learner moment: that's the whole packed-storage wig in one example ๐
Definition at line 275 of file zhpsvx.f.
๐ฆ subroutine zspsvx ๐ฆ
subroutine zspsvx (character fact, character uplo, integer n, integer nrhs,
complex*16, dimension( * ) ap, complex*16, dimension( * ) afp, 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, double precision, dimension( * )
rwork, integer info)
ZSPSVX computes the solution to system of linear equations A * X = B for OTHER matrices. โOTHER matricesโ is giving mysterious side quest, but okay ๐
๐ Purpose: ๐
ZSPSVX uses the diagonal pivoting factorization A = U*D*U**T or A = L*D*L**T to compute the solution to a complex system of linear equations A * X = B, where A is an N-by-N symmetric matrix stored in packed format and X and B are N-by-NRHS matrices.
Error bounds on the solution and a condition estimate are also provided. accuracy? we love her ๐
๐ Description: ๐
The following steps are performed:
- If
FACT = 'N', the diagonal pivoting method is used to factorAasA = U * D * U**T, ifUPLO = 'U', orA = L * D * L**T, ifUPLO = 'L', whereU(orL) is a product of permutation and unit upper (lower) triangular matrices andDis symmetric and block diagonal with 1-by-1 and 2-by-2 diagonal blocks. block diagonal D is the moment, honestly ๐งฉ - 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. warning bestie: singular D means no solution/error bounds, periodt ๐ซ - 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. glow-up step: refine, refine, refine ๐
โจ Parameters โจ
FACTโFACTisCHARACTER*1. It specifies whether or not the factored form ofAhas been supplied on entry.= 'F': On entry,AFPandIPIVcontain the factored form ofA.AP,AFPandIPIVwill not be modified.= 'N': The matrixAwill be copied toAFPand factored.
UPLOโUPLOisCHARACTER*1.= 'U': Upper triangle ofAis stored.= 'L': Lower triangle ofAis stored.
NโNisINTEGER. It's the number of linear equations, i.e., the order of the matrixA.N >= 0.NRHSโNRHSisINTEGER. It's the number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >= 0.APโAPis aCOMPLEX*16array, dimension(N*(N+1)/2). It's the upper or lower triangle of the symmetric matrixA, packed columnwise in a linear array. The j-th column ofAis stored in the arrayAPas follows:- if
UPLO = 'U',AP(i + (j-1)*j/2) = A(i,j)for1<=i<=j; - if
UPLO = 'L',AP(i + (j-1)*(2*n-j)/2) = A(i,j)forj<=i<=n.
- if
See below for further details. packed columnwise, iconic storage behavior ๐
AFPโAFPis aCOMPLEX*16array, dimension(N*(N+1)/2). IfFACT = 'F', thenAFPis an input argument and on entry it contains the block diagonal matrixDand the multipliers used to obtain the factorUorLfrom the factorizationA = U*D*U**TorA = L*D*L**Tas computed byZSPTRF, stored as a packed triangular matrix in the same storage format asA. IfFACT = 'N', thenAFPis an output argument and on exit it contains the block diagonal matrixDand the multipliers used to obtain the factorUorLfrom the factorizationA = U*D*U**TorA = L*D*L**Tas computed byZSPTRF, stored as a packed triangular matrix in the same storage format asA. ZSPTRF said โI'll handle the factorization,โ and honestly? she did ๐IPIV
okay bestie, picking up right where we left off with IPIV โ no cap, this one's a little extra ๐
IPIVโINTEGER array, dimension (N). IfFACT = 'F', thenIPIVis an input argument and on entry contains details of the interchanges and the block structure ofD, as determined byZSPTRF. IfIPIV(k) > 0, then rows and columnskandIPIV(k)were interchanged andD(k,k)is a 1-by-1 diagonal block. IfUPLO = '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. IfUPLO = '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 contains details of the interchanges and the block structure of D, as determined by ZSPTRF. ๐ซถ
BโCOMPLEX*16 array, dimension (LDB,NRHS). TheN-by-NRHSright hand side matrixB. ๐LDBโINTEGER. The leading dimension of the arrayB.LDB >= max(1,N). slay, keep it legal โจXโCOMPLEX*16 array, dimension (LDX,NRHS). IfINFO = 0orINFO = N+1, theN-by-NRHSsolution matrixX. ๐ธLDXโINTEGER. The leading dimension of the arrayX.LDX >= max(1,N). periodt ๐RCONDโDOUBLE PRECISION. The estimate of the reciprocal condition number of the matrixA. 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. lowkey important ๐จFERRโDOUBLE PRECISION array, dimension (NRHS). The estimated forward error bound for each solution vectorX(j)(thej-th column of the solution matrixX). 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. ngl, it's giving "trust but verify" ๐ญBERRโDOUBLE PRECISION array, dimension (NRHS). The componentwise relative backward error of each solution vectorX(j)(i.e., the smallest relative change in any element ofAorBthat makesX(j)an exact solution). ๐WORKโCOMPLEX*16 array, dimension (2*N). ๐RWORKโDOUBLE PRECISION array, dimension (N). ๐ฆINFOโINTEGER.= 0: successful exit โ< 0: ifINFO = -i, thei-th argument had an illegal value ๐> 0: ifINFO = i, andiis<= N:D(i,i)is exactly zero. The factorization has been completed but the factorDis exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned. ๐= N+1:Dis 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. not me being dramatic but this is actually iconic ๐ฅ
Author ๐
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details: ๐ง
The packed storage scheme is illustrated by the following example when N = 4, UPLO = 'U':
Two-dimensional storage of the symmetric matrix A:
a11 a12 a13 a14
a22 a23 a24
a33 a34 (aij = aji)
a44
Packed storage of the upper triangle of A:
AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
see? it's literally just the upper triangle tucked into one cute lil array ๐โจ
Definition at line 275 of file zspsvx.f.
Author (again, but make it Doxygen) ๐ป
Generated automatically by Doxygen for LAPACK from the source code.
and that's the whole entire page bestie, no cap ๐ซถ โ straight from LAPACK, Version 3.12.0, hpsvx(3), generated with love (and Doxygen). byeeee ๐
โจ
๐ฆ 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