porfsx(3)
πΈ porfsx(3) β iterative refinement, expert πΈ
okay so bestie, this is porfsx from section 3 of the Library Functions Manual, and it is literally giving βLAPACK routine that makes your Hermitian positive definite solve look correct and cuteβ energy. β¨
πΈ NAME πΈ
porfsx β porfsx: iterative refinement, expert
β¨ SYNOPSIS β¨
π«Ά Functions π«Ά
subroutine cporfsx (uplo, equed, n, nrhs, a, lda, af, ldaf, s, b, ldb, x, ldx, rcond, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, rwork, info)
subroutine dporfsx (uplo, equed, n, nrhs, a, lda, af, ldaf, s, b, ldb, x, ldx, rcond, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, iwork, info)
subroutine sporfsx (uplo, equed, n, nrhs, a, lda, af, ldaf, s, b, ldb, x, ldx, rcond, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, iwork, info)
subroutine zporfsx (uplo, equed, n, nrhs, a, lda, af, ldaf, s, b, ldb, x, ldx, rcond, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, rwork, info)
The labels are literally CPORFSX, DPORFSX, SPORFSX, and ZPORFSX. no cap. π
π Detailed Description π
π₯ Function Documentation π₯
π§ subroutine cporfsx π§
subroutine cporfsx (character uplo, character equed, integer n, integer
nrhs, complex, dimension( lda, * ) a, integer lda, complex, dimension(
ldaf, * ) af, integer ldaf, real, dimension( * ) s, complex, dimension(
ldb, * ) b, integer ldb, complex, dimension( ldx, * ) x, integer ldx,
real rcond, real, dimension( * ) berr, integer n_err_bnds, real,
dimension( nrhs, * ) err_bnds_norm, real, dimension( nrhs, * )
err_bnds_comp, integer nparams, real, dimension(*) params, complex,
dimension( * ) work, real, dimension( * ) rwork, integer info)
CPORFSX
π― Purpose π―
okay so CPORFSX improves the computed solution to a system of linear equations when the coefficient matrix is Hermitian positive definite, and it also hands you error bounds and backward error estimates for that solution. π In addition to the normwise error bound, the code provides a maximum componentwise error bound if possible. See the comments for ERR_BNDS_NORM and ERR_BNDS_COMP for the deets on those error bounds.
The original system of linear equations may have been equilibrated before calling this routine, as described by arguments EQUED and S below. In that case, the solution and error bounds returned are for the original unequilibrated system. π
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. β¨
π§Έ Parameters π§Έ
πΈ UPLO πΈ
UPLO is CHARACTER*1.
= 'U': Upper triangle ofAis stored.= 'L': Lower triangle ofAis stored.
πΈ EQUED πΈ
EQUED is CHARACTER*1.
Specifies the form of equilibration that was done to A before calling this routine. This is needed to compute the solution and error bounds correctly.
= 'N': No equilibration.= 'Y': Both row and column equilibration, i.e.,Ahas been replaced bydiag(S) * A * diag(S). The right hand sideBhas been changed accordingly.
πΈ N πΈ
N is INTEGER.
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.
πΈ A πΈ
A is COMPLEX array, dimension (LDA,N).
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. If UPLO = '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. π
πΈ LDA πΈ
LDA is INTEGER.
The leading dimension of the array A. LDA >= max(1,N).
πΈ AF πΈ
AF is COMPLEX array, dimension (LDAF,N).
The triangular factor U or L from the Cholesky factorization A = U**H*U or A = L*L**H, as computed by CPOTRF.
πΈ LDAF πΈ
LDAF is INTEGER.
The leading dimension of the array AF. LDAF >= max(1,N).
πΈ S πΈ
S is REAL 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. π
πΈ B πΈ
B is COMPLEX array, dimension (LDB,NRHS).
The right hand side matrix B.
πΈ LDB πΈ
LDB is INTEGER.
The leading dimension of the array B. LDB >= max(1,N).
πΈ X πΈ
X is COMPLEX array, dimension (LDX,NRHS).
On entry, the solution matrix X, as computed by SGETRS. On exit, the improved solution matrix X.
πΈ LDX πΈ
LDX is INTEGER.
The leading dimension of the array X. LDX >= max(1,N).
πΈ RCOND πΈ
RCOND is REAL.
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. π«Ά
πΈ BERR πΈ
BERR is REAL 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 πΈ
N_ERR_BNDS is 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 πΈ
ERR_BNDS_NORM is REAL 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 = 1boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * slamch('Epsilon').err = 2error 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) * slamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.err = 3Reciprocal condition number: Estimated normwise reciprocal condition number. Compared with the thresholdsqrt(n) * slamch('Epsilon')to determine if the error estimate is . 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 πΈ
ERR_BNDS_COMP π
ERR_BNDS_COMP is a REAL array, dimension (NRHS, N_ERR_BNDS). For each right-hand side, this array is carrying info about various error bounds and condition numbers corresponding to the componentwise relative error, which is defined as follows:
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β boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * slamch('Epsilon').err = 2β error bound: The estimated forward error, almost certainly within a factor of 10 of the true error so long as the next entry is greater than the thresholdsqrt(n) * slamch('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) * slamch('Epsilon')to determine if the error estimate is . (the original really leaves it hanging there, bestie π). 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 approximately 1.
See Lapack Working Note 165 for further details and extra cautions.
NPARAMS π
NPARAMS is INTEGER. Specifies the number of parameters set in PARAMS. If <= 0, the PARAMS array is never referenced and default values are used.
PARAMS β¨
PARAMS is a REAL 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.0 = 0.0: No refinement is performed, and no error bounds are computed.= 1.0: Use the double-precision refinement algorithm, possibly with doubled-single computations if the compilation environment does not supportDOUBLE PRECISION.- (other values are reserved for future use)
- Default:
PARAMS(LA_LINRX_ITHRESH_I = 2)β Maximum number of residual computations allowed for refinement.- Default:
10 - Aggressive: Set to
100to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees inerr_bnds_normanderr_bnds_compmay no longer be trustworthy.
- Default:
PARAMS(LA_LINRX_CWISE_I = 3)β Flag determining if the code will attempt to find a solution with small componentwise relative error in the double-precision algorithm. Positive is true,0.0is false.- Default:
1.0(attempt componentwise convergence)
- Default:
WORK π¦
WORK is a COMPLEX array, dimension (2*N).
RWORK πΈ
RWORK is a REAL array, dimension (2*N).
INFO π₯
INFO is INTEGER.
= 0: Successful exit. The solution to every right-hand side is guaranteed.< 0: IfINFO = -i, thei-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 theJth right-hand side is not guaranteed. The solutions corresponding to other right-hand sidesKwithK > 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 theJth right-hand side is the first with a normwise error bound that is not guaranteed (the smallestJsuch thatERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) theJth right-hand side is the first with either a normwise or componentwise error bound that is not guaranteed (the smallestJsuch that eitherERR_BNDS_NORM(J,1) = 0.0orERR_BNDS_COMP(J,1) = 0.0). See the definition ofERR_BNDS_NORM(:,1)andERR_BNDS_COMP(:,1). To get information about all of the right-hand sides checkERR_BNDS_NORMorERR_BNDS_COMP.
Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Definition at line 389 of file cporfsx.f.
DPORFSX π
subroutine dporfsx (character uplo, character equed, integer n, integer
nrhs, double precision, dimension( lda, * ) a, integer lda, double
precision, dimension( ldaf, * ) af, integer ldaf, double precision,
dimension( * ) s, double precision, dimension( ldb, * ) b, integer ldb,
double precision, dimension( ldx, * ) x, integer ldx, double precision
rcond, 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, double precision, dimension( * ) work, integer,
dimension( * ) iwork, integer info)
DPORFSX
Purpose β¨
DPORFSX improves the computed solution to a system of linear equations when the coefficient matrix is symmetric positive definite, and provides error bounds and backward error estimates for the solution. In addition to normwise error bound, the code provides maximum componentwise error bound if possible. See comments for ERR_BNDS_NORM and ERR_BNDS_COMP for details of the error bounds.
The original system of linear equations may have been equilibrated before calling this routine, as described by arguments EQUED and S below. In this case, the solution and error bounds returned are for the original unequilibrated system.
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.
Parameters π§
UPLO is CHARACTER*1
= 'U': Upper triangle ofAis stored;= 'L': Lower triangle ofAis stored.
EQUED is CHARACTER*1
Specifies the form of equilibration that was done to A before calling this routine. This is needed to compute the solution and error bounds correctly.
= 'N': No equilibration= 'Y': Both row and column equilibration, i.e.,Ahas been replaced bydiag(S) * A * diag(S). The right hand sideBhas been changed accordingly.
N is INTEGER
The order of the matrix A. N >= 0.
NRHS is INTEGER
The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0.
A is DOUBLE PRECISION array, dimension (LDA,N)
The symmetric 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. If UPLO = '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.
LDA is INTEGER
The leading dimension of the array A. LDA >= max(1,N).
AF is DOUBLE PRECISION array, dimension (LDAF,N)
The triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T, as computed by DPOTRF.
LDAF is INTEGER
The leading dimension of the array AF. LDAF >= max(1,N).
S
SβDOUBLE PRECISIONarray, dimension(N). These are the scale factors forAπ . IfEQUED = 'Y',Agets multiplied on the left and right bydiag(S).Sis an input argument ifFACT = 'F'; otherwise it's an output argument. And ifFACT = 'F'andEQUED = 'Y', every element ofShas to be positive, no exceptions bestie. IfSis output, each element ofSis a power of the radix β¨. IfSis input, each element should be a power of the radix to make sure you get a reliable solution and reliable error estimates β because scaling by powers of the radix doesn't cause rounding errors unless the result underflows or overflows π«Ά. But lowkey watch out: rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, and that produces error estimates that may not be reliable π.BβDOUBLE PRECISIONarray, dimension(LDB,NRHS). The right hand side matrixB. That's it, that's the vibe π.LDBβINTEGER. The leading dimension of the arrayB. Gotta satisfyLDB >= max(1,N)β.XβDOUBLE PRECISIONarray, dimension(LDX,NRHS). On entry, the solution matrixX, as computed byDGETRS. On exit, the improved solution matrixXπ β glow-up arc, honestly.LDXβINTEGER. The leading dimension of the arrayX. Requirement:LDX >= max(1,N)β .RCONDβDOUBLE PRECISION. Reciprocal scaled condition number π₯. It's an estimate of the reciprocal Skeel condition number of the matrixAafter equilibration (if that was done). If this is less than the machine precision β in particular, if it's zero β the matrix is singular to working precision π. But here's the plot twist: the error may still be small even if this number is very, very small and the matrix looks ill-conditioned. Don't let the vibe check fool you.BERRβDOUBLE PRECISIONarray, dimension(NRHS). Componentwise relative backward error πΈ. Specifically: 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 β¨.N_ERR_BNDSβINTEGER. The number of error bounds to return for each right hand side and for each type (normwise or componentwise). SeeERR_BNDS_NORMandERR_BNDS_COMPbelow π.ERR_BNDS_NORMβDOUBLE PRECISIONarray, dimension(NRHS, N_ERR_BNDS). For each right-hand side, this array is carrying info about various error bounds and condition numbers corresponding to the normwise relative error, which is defined like this:
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 info returned π.
The first index in ERR_BNDS_NORM(i,:) corresponds to the *i*th right-hand side.
The second index in ERR_BNDS_NORM(:,err) contains these three fields:
err = 1β boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * dlamch('Epsilon'). βerr = 2β 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 (ngl the source sentence here just sort ofβ¦ stops π). 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 PRECISIONarray, dimension(NRHS, N_ERR_BNDS). Same deal, but for the componentwise relative error. For each right-hand side, this array holds info about various error bounds and condition numbers corresponding to the componentwise relative error, defined as:
abs(XTRUE(j,i) - X(j,i))
max_j ----------------------
abs(X(j,i))
The array is indexed by the right-hand side i (the componentwise relative error depends on it), and by the type of error information 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 π«. And 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 *i*th right-hand side.
The second index in ERR_BNDS_COMP(:,err) contains these three fields:
err = 1β boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * dlamch('Epsilon'). βerr = 2β 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 (yep, this sentence also just peaces out mid-thought π). 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 how many parameters are set inPARAMS. IfNPARAMS <= 0, thePARAMSarray is never referenced and default values are used π.PARAMSβDOUBLE PRECISIONarray, dimension(NPARAMS). Specifies algorithm parameters β¨. If an entry is< 0.0, then that entry gets filled with the default value used for that parameter. Only positions up toNPARAMSare accessed; defaults are used for higher-numbered parameters.PARAMS(LA_LINRX_ITREF_I = 1)β whether to do iterative refinement or not. Default:1.0D+0= 0.0β no refinement is performed, and no error bounds are computed.= 1.0β use the double-precision refinement algorithm, possibly with doubled-single computations if the compilation environment doesn't supportDOUBLE PRECISION.- (other values are reserved for future use π)
PARAMS(LA_LINRX_ITHRESH_I = 2)β maximum number of residual computations allowed for refinement. Default:10Aggressive: set it to100to permit convergence using approximate factorizations or factorizations other thanLU. β οΈ But if the factorization uses a technique other than Gaussian elimination, the guarantees inerr_bnds_normanderr_bnds_compmay no longer be trustworthy π.PARAMS(LA_LINRX_CWISE_I = 3)β flag determining if the code will attempt to find a solution with small componentwise relative error in the double-precision algorithm. Positive is true,0.0is false. Default:1.0(attempt componentwise convergence) π
WORKβDOUBLE PRECISIONarray, dimension(4*N). Scratch space, do not perceive it π«Ά.IWORKβINTEGERarray, dimension(N). Integer scratch space, equally unbothered β¨.
and INFO is up next, bestie π
π INFO π
INFO is INTEGER, and it's basically the receipts for how the whole thing went. Here's the vibe check:
= 0β Successful exit. The solution to every single right-hand side is guaranteed. Slay. No notes. π< 0β IfINFO = -i, the i-th argument had an illegal value. Somebody passed something cursed, bestie π> 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. Yeah, that's a no from the math.= N+Jβ Okay this one's a whole paragraph, stay with me πΈ The solution corresponding to the Jth right-hand side is not guaranteed. The solutions corresponding to other right-hand sides K with K > J may 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 thatERR_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 eitherERR_BNDS_NORM(J,1) = 0.0orERR_BNDS_COMP(J,1) = 0.0). See the definition ofERR_BNDS_NORM(:,1)andERR_BNDS_COMP(:,1). To get information about all of the right-hand sides, checkERR_BNDS_NORMorERR_BNDS_COMP. π«Ά
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 390 of file dporfsx.f.
π¦ subroutine sporfsx π¦
Okay so now we pivot to the single precision twin, and she's got the exact same energy β¨
subroutine sporfsx (character uplo, character equed, integer n, integer
nrhs, real, dimension( lda, * ) a, integer lda, real, dimension( ldaf, *
) af, integer ldaf, real, dimension( * ) s, real, dimension( ldb, * ) b,
integer ldb, real, dimension( ldx, * ) x, integer ldx, real rcond, real,
dimension( * ) berr, integer n_err_bnds, real, dimension( nrhs, * )
err_bnds_norm, real, dimension( nrhs, * ) err_bnds_comp, integer
nparams, real, dimension( * ) params, real, dimension( * ) work,
integer, dimension( * ) iwork, integer info)
SPORFSX β she's the main character of this section, ngl π₯
β¨ Purpose β¨
SPORFSXimproves the computed solution to a system of linear equations when the coefficient matrix is symmetric positive definite, and provides error bounds and backward error estimates for the solution. In addition to the normwise error bound, the code provides a maximum componentwise error bound if possible. See the comments forERR_BNDS_NORMandERR_BNDS_COMPfor details of the error bounds.
The original system of linear equations may have been equilibrated before calling this routine, as described by argumentsEQUEDandSbelow. In this case, the solution and error bounds returned are for the original unequilibrated system. π (she remembers where she came from)
Some optional parameters are bundled in thePARAMSarray. These settings determine how refinement is performed, but often the defaults are acceptable. If the defaults are acceptable, users can passNPARAMS = 0which prevents the source code from accessing thePARAMSargument. Lowkey the easiest setting ever β just say "defaults, bestie" and you're done π«Ά
πΈ Parameters πΈ
π UPLO
UPLO is CHARACTER*1.
= 'U'β Upper triangle ofAis stored;= 'L'β Lower triangle ofAis stored.
Pick one, tell her which, she'll only look at that half. π
π EQUED
EQUED is CHARACTER*1.
Specifies the form of equilibration that was done to A before calling this routine. This is needed to compute the solution and error bounds correctly β like, if you lie here, everything downstream is off, no cap π
= 'N'β No equilibration= 'Y'β Both row and column equilibration, i.e.,Ahas been replaced bydiag(S) * A * diag(S). The right hand sideBhas been changed accordingly.
π N
N is INTEGER.
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. π
π A
A is REAL array, dimension (LDA,N).
The symmetric 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. If UPLO = '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. (She's not nosy, she just doesn't read that half π)
π LDA
LDA is INTEGER.
The leading dimension of the array A. LDA >= max(1,N). β
π AF
AF is REAL array, dimension (LDAF,N).
The triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T, as computed by SPOTRF. π§
π LDAF
LDAF is INTEGER.
The leading dimension of the array AF. LDAF >= max(1,N). β
π S
S is REAL 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. π So yeah β powers of the radix, or the vibes get shaky.
π B
B is REAL array, dimension (LDB,NRHS).
The right hand side matrix B. π«Ά
π LDB
LDB is INTEGER.
The leading dimension of the array B. LDB >= max(1,N). β
π X
X is REAL array, dimension (LDX,NRHS).
On entry, the solution matrix X, as computed by SGETRS. On exit, the improved solution matrix X. β¨ Glow-up arc, literally.
π LDX
LDX is INTEGER.
The leading dimension of the array X. LDX >= max(1,N). β
π RCOND
RCOND is REAL.
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. π (iconic behaviour honestly β tiny number, fine answer, she contains multitudes)
π BERR
BERR is REAL 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). π tiny change energy
π N_ERR_BNDS
N_ERR_BNDS is 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
ERR_BNDS_NORM is REAL 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 *i*th right-hand side.
The second index in ERR_BNDS_NORM(:,err) contains the following three fields:
err = 1β boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * slamch('Epsilon').err = 2β 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) * slamch('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) * slamch('Epsilon')to determine if the error estimate is . 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. π (and yes, that sentence really does just end at "is ." in the source β not me, bestie, I'm just the messenger π)
See Lapack Working Note 165 for further details and extra cautions. π
ERR_BNDS_COMP
ERR_BNDS_COMPβ aREALarray, dimension(NRHS, N_ERR_BNDS). For every right-hand side, this baby holds the deets on all the error bounds and condition numbers for the componentwise relative error, which is literally defined like this:
abs(XTRUE(j,i) - X(j,i))
max_j ----------------------
abs(X(j,i))
Okay so, ERR_BNDS_COMP is indexed by the right-hand side i (because that's what the componentwise relative error depends on, obviously π
), and then by the type of error info, which we're about to get into. Right now there are up to three pieces of info returned per right-hand side. If componentwise accuracy wasn't even requested (PARAMS(3) = 0.0), then ERR_BNDS_COMP gets not accessed at all, thank u next. And if N_ERR_BNDS < 3, then at most the first (:,N_ERR_BNDS) entries come back β so like, you get what you asked for, no more.
The first index in ERR_BNDS_COMP(i,:) corresponds to the ith right-hand side.
The second index in ERR_BNDS_COMP(:,err) contains these three fields:
err = 1β boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * slamch('Epsilon').err = 2β 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) * slamch('Epsilon'). β οΈ This error bound should only be trusted if the previous boolean is true. Like, the boolean is the vibe check, no cap.err = 3β reciprocal condition number: the estimated componentwise reciprocal condition number. Compared with the thresholdsqrt(n) * slamch('Epsilon')to determine if the error estimate is . (yeah, the original page just trails off there mid-sentence β not me, bestie, I'm as confused as you are π). 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.
Also β see Lapack Working Note 165 for further details and extra cautions. π
NPARAMSβINTEGER. Specifies the number of parameters set inPARAMS. If<= 0, thePARAMSarray is never referenced and default values are used. Honestly iconic behaviour: ask for nothing, get defaults.PARAMSβREALarray, dimensionNPARAMS. Specifies algorithm parameters. If an entry is< 0.0, then that entry gets filled in with the default value used for that parameter. Only positions up toNPARAMSare accessed; defaults are used for any higher-numbered parameters. So you can half-ass it and the code will cover for you π«ΆPARAMS(LA_LINRX_ITREF_I = 1)β whether to perform iterative refinement or not. Default:1.0= 0.0: no refinement is performed, and no error bounds are computed.= 1.0: use the double-precision refinement algorithm, possibly with doubled-single computations if the compilation environment does not supportDOUBLE PRECISION.- (other values are reserved for future use)
PARAMS(LA_LINRX_ITHRESH_I = 2)β maximum number of residual computations allowed for refinement. Default:10Aggressive: set it to100to permit convergence using approximate factorizations or factorizations other than LU. β οΈ But if the factorization uses a technique other than Gaussian elimination, the guarantees inerr_bnds_normanderr_bnds_compmay no longer be trustworthy. So like, proceed with caution, bestie.PARAMS(LA_LINRX_CWISE_I = 3)β flag determining if the code will attempt to find a solution with small componentwise relative error in the double-precision algorithm. Positive is true,0.0is false. Default:1.0(attempt componentwise convergence)
WORKβREALarray, dimension(4*N).IWORKβINTEGERarray, dimension(N).INFOβINTEGER. The receipts π§Ύ:= 0: successful exit. The solution to every right-hand side is guaranteed.< 0: ifINFO = -i, theith 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 theJth right-hand side is not guaranteed. The solutions corresponding to other right-hand sidesKwithK > 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 theJth right-hand side is the first with a normwise error bound that is not guaranteed (the smallestJsuch thatERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) theJth right-hand side is the first with either a normwise or componentwise error bound that is not guaranteed (the smallestJsuch that eitherERR_BNDS_NORM(J,1) = 0.0orERR_BNDS_COMP(J,1) = 0.0). See the definition ofERR_BNDS_NORM(:,1)andERR_BNDS_COMP(:,1). To get information about all of the right-hand sides, checkERR_BNDS_NORMorERR_BNDS_COMP. π
π Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
πΈ Definition at line 390 of file sporfsx.f.
π subroutine zporfsx β the complex*16 sibling, same slay
subroutine zporfsx (character uplo, character equed, integer n, integer
nrhs, complex*16, dimension( lda, * ) a, integer lda, complex*16,
dimension( ldaf, * ) af, integer ldaf, double precision, dimension( * )
s, complex*16, dimension( ldb, * ) b, integer ldb, complex*16,
dimension( ldx, * ) x, integer ldx, double precision rcond, 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)
ZPORFSX β ok so this is the one where the matrix is Hermitian positive definite and everything is COMPLEX*16 and DOUBLE PRECISION. Let's go β¨
π Purpose
ZPORFSX improves the computed solution to a system of linear equations when the coefficient matrix is Hermitian positive definite, and it provides error bounds and backward error estimates for the solution. On top of the normwise error bound, the code also gives you the maximum componentwise error bound if possible. (See the comments for ERR_BNDS_NORM and ERR_BNDS_COMP for the details of the error bounds β we literally just covered those, iykyk π
)
The original system of linear equations may have been equilibrated before calling this routine, as described by arguments EQUED and S below. In that case, the solution and error bounds returned are for the original unequilibrated system. So it undoes the glow-up for you, bestie π§ββοΈ
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 at all. No thoughts, just defaults π«Ά
β Parameters
UPLOβCHARACTER*1= 'U': upper triangle ofAis stored;= 'L': lower triangle ofAis stored.
EQUEDβCHARACTER*1. Specifies the form of equilibration that was done toAbefore calling this routine. This is needed to compute the solution and error bounds correctly β so don't be lying about it π₯= 'N': no equilibration= 'Y': both row and column equilibration, i.e.,Ahas been replaced bydiag(S) * A * diag(S). The right hand sideBhas been changed accordingly.
NβINTEGER. The order of the matrixA.N >= 0.NRHSβINTEGER. The number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >= 0.AβCOMPLEX*16array, dimension(LDA,N). 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. Only half the matrix is doing main character work, and honestly? Respect πLDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).AFβCOMPLEX*16array, dimension(LDAF,N). The triangular factorUorLfrom the Cholesky factorizationA = U**H*UorA = L*L**H, as computed byZPOTRF.LDAFβINTEGER. The leading dimension of the arrayAF.LDAF >= max(1,N).Sβ hold that thought, bestie,Shas lore and it's coming in the next chunk π π
π¦ S β the scale factors, bestie π¦
S is DOUBLE PRECISION array, dimension (N) β it's literally the scale factors for A.
- If
EQUED = 'Y',Ais multiplied on the left and right bydiag(S). Sis an input argument ifFACT = 'F'; otherwise,Sis an output argument.- If
FACT = 'F'andEQUED = 'Y', each element ofSmust be positive. - If
Sis output, each element ofSis a power of the radix. π - If
Sis input, each element ofSshould 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.
π Real talk though: 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. Not iconic of them, but there it is.
π§ B β the right hand side matrix
B is COMPLEX*16 array, dimension (LDB,NRHS) β the right hand side matrix B. That's it, that's the whole vibe. π«Ά
π LDB
LDB is INTEGER β the leading dimension of the array B.
Constraint, no cap: LDB >= max(1,N).
β¨ X β the glow-up matrix
X is COMPLEX*16 array, dimension (LDX,NRHS).
- On entry: the solution matrix
X, as computed byZGETRS. - On exit: the improved solution matrix
X. Glow-up complete, slay. π₯
β LDX
LDX is INTEGER β the leading dimension of the array X.
Same energy as LDB, different letter: LDX >= max(1,N).
π RCOND β the vibe check number
RCOND is DOUBLE PRECISION β reciprocal scaled condition number. Basically 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.
So likeβ¦ don't panic-read too hard into it, iykyk. π
π BERR
BERR is DOUBLE PRECISION array, dimension (NRHS) β componentwise relative backward error.
BERR 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). Periodt. π
π N_ERR_BNDS
N_ERR_BNDS is 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 π (they're the ones doing the actual work).
π ERR_BNDS_NORM β normwise error tea β
ERR_BNDS_NORM is 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β boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * dlamch('Epsilon').err = 2β 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 . (bestie the source sentence literally cuts off there β not me, I'm just the messenger π) 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. Extra cautions!! Read the fine print, fr fr.
πΈ ERR_BNDS_COMP β componentwise error tea β
ERR_BNDS_COMP is 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), thenERR_BNDS_COMPis 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β boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * dlamch('Epsilon').err = 2β 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 . (again β the source sentence just stops mid-thought, screaming into the void π) 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. (Yes, again. Go read it. π₯)
π NPARAMS
NPARAMS is INTEGER β specifies the number of parameters set in PARAMS.
- If
<= 0, thePARAMSarray is never referenced and default values are used.
Honestly? Respectful. Not even looking at your array. π
π PARAMS β the algorithm parameter menu
PARAMS is DOUBLE PRECISION array, dimension NPARAMS β specifies algorithm parameters.
If an entry is < 0.0, then that entry will be filled with the 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 double-precision refinement algorithm, possibly with doubled-single computations if the compilation environment does not supportDOUBLE PRECISION.- (other values are reserved for future use)
- Default:
PARAMS(LA_LINRX_ITHRESH_I = 2)β Maximum number of residual computations allowed for refinement.- Default:
10 - Aggressive: Set to
100to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees inerr_bnds_normanderr_bnds_compmay no longer be trustworthy.
- Default:
β οΈ That "may no longer be trustworthy" is doing a LOT of heavy lifting there. Aggressive mode is giving main character energy, but it's also giving consequences. π
PARAMS(LA_LINRX_CWISE_I = 3)β Flag determining if the code will attempt to find a solution with small componentwise relative error in the double-precision algorithm. Positive is true,0.0is false.- Default:
1.0(attempt componentwise convergence)
- Default:
π WORK
WORK is COMPLEX*16 array, dimension (2*N). Scratch space. Mwah. π«Ά
π RWORK
RWORK is DOUBLE PRECISION array, dimension (2*N). Also scratch space, but make it double precision. β¨
β INFO
β¦
INFO is INTEGER β yes, thatβs the type, bestie, and its whole job is spilling how the solve went. β¨ Hereβs the full vibe check on its values:
= 0β Successful exit. The solution to every right-hand side is guaranteed. Slay. π< 0β IfINFO = -i, thei-th argument had an illegal value. Rude, but at least it tells you which one. π> 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. Yeah, thatβs the βwe tried, but the math said noβ zone. π= N+Jβ The solution corresponding to theJth right-hand side is not guaranteed. The solutions corresponding to other right-hand sidesKwithK > 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 theJth right-hand side is the first with a normwise error bound that is not guaranteed (the smallestJsuch thatERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) theJth right-hand side is the first with either a normwise or componentwise error bound that is not guaranteed (the smallestJsuch that eitherERR_BNDS_NORM(J,1) = 0.0orERR_BNDS_COMP(J,1) = 0.0). See the definition ofERR_BNDS_NORM(:,1)andERR_BNDS_COMP(:,1). To get information about all of the right-hand sides checkERR_BNDS_NORMorERR_BNDS_COMP. Thatβs the deep lore, iykyk. π«Ά
π Author
Bestie, this page has elf energy, because it took a whole village:
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 389 of file zporfsx.f.
π«Ά Author
Okay so thereβs another Author section, because the generator said so π:
Generated automatically by Doxygen for LAPACK from the source code.
Thatβs the whole page, bestie! π This one comes from LAPACK Version 3.12.0, and the page is porfsx(3) β the footer didnβt hand over a date, so Iβm not inventing one. No cap, periodt. β¨π
π¦ 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