herfsx(3)
π¦ herfsx(3) β {he,sy}rfsx: iterative refinement, expert π¦
okay so bestie, this is herfsx(3) from the Library Functions Manual β and yes, it's giving expert-level iterative refinement energy. We're doing the whole thing, no skips, no "lol I'll summarize". π
πΈ NAME πΈ
herfsx β {he,sy}rfsx: iterative refinement, expert
β¨ SYNOPSIS β¨
π«Ά Functions π«Ά
Here's the whole squad, signatures exactly as they live:
subroutine cherfsx (uplo, equed, n, nrhs, a, lda, af, ldaf, ipiv, s, b,
ldb, x, ldx, rcond, berr, n_err_bnds, err_bnds_norm, err_bnds_comp,
nparams, params, work, rwork, info)
CHERFSX
subroutine csyrfsx (uplo, equed, n, nrhs, a, lda, af, ldaf, ipiv, s, b,
ldb, x, ldx, rcond, berr, n_err_bnds, err_bnds_norm, err_bnds_comp,
nparams, params, work, rwork, info)
CSYRFSX
subroutine dsyrfsx (uplo, equed, n, nrhs, a, lda, af, ldaf, ipiv, s, b,
ldb, x, ldx, rcond, berr, n_err_bnds, err_bnds_norm, err_bnds_comp,
nparams, params, work, iwork, info)
DSYRFSX
subroutine ssyrfsx (uplo, equed, n, nrhs, a, lda, af, ldaf, ipiv, s, b,
ldb, x, ldx, rcond, berr, n_err_bnds, err_bnds_norm, err_bnds_comp,
nparams, params, work, iwork, info)
SSYRFSX
subroutine zherfsx (uplo, equed, n, nrhs, a, lda, af, ldaf, ipiv, s, b,
ldb, x, ldx, rcond, berr, n_err_bnds, err_bnds_norm, err_bnds_comp,
nparams, params, work, rwork, info)
ZHERFSX
subroutine zsyrfsx (uplo, equed, n, nrhs, a, lda, af, ldaf, ipiv, s, b,
ldb, x, ldx, rcond, berr, n_err_bnds, err_bnds_norm, err_bnds_comp,
nparams, params, work, rwork, info)
ZSYRFSX
π Detailed Description π
This section is a whole mood: the page drops the heading and then goes straight into the function docs. So we're doing the same β no extra lore, just the real documentation below. π«‘
π₯ Function Documentation π₯
π subroutine cherfsx ... CHERFSX π
subroutine cherfsx (character uplo, character equed, integer n, integer
nrhs, complex, dimension( lda, * ) a, integer lda, complex, dimension(
ldaf, * ) af, integer ldaf, integer, dimension( * ) ipiv, 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)
CHERFSX
π Purpose π
CHERFSX improves the computed solution to a system of linear equations when the coefficient matrix is Hermitian indefinite, and it provides error bounds and backward error estimates for the solution. In addition to the normwise error bound, the code provides the 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βUPLOisCHARACTER*1.= 'U':Upper triangle ofAis stored;= 'L':Lower triangle ofAis stored.
EQUEDβEQUEDisCHARACTER*1. Specifies the form of equilibration that was done toAbefore 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βNisINTEGER. The order of the matrixA.N >= 0.NRHSβNRHSisINTEGER. The number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >= 0.AβAisCOMPLEX array, 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.LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).AFβAFisCOMPLEX array, dimension (LDAF,N). The factored form of the matrixA.AFcontains the block diagonal matrixDand the multipliers used to obtain the factorUorLfrom the factorizationA = U*D*U**HorA = L*D*L**Has computed byCHETRF.LDAFβLDAFisINTEGER. The leading dimension of the arrayAF.LDAF >= max(1,N).IPIVβIPIVisINTEGER array, dimension (N). Details of the interchanges and the block structure ofDas determined byCHETRF.SβSisREAL array, dimension (N). The scale factors forA. IfEQUED = 'Y',Ais multiplied on the left and right bydiag(S).Sis an input argument ifFACT = 'F'; otherwise,Sis an output argument. IfFACT = 'F'andEQUED = 'Y', each element ofSmust be positive. IfSis output, each element ofSis a power of the radix. IfSis 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. 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βBisCOMPLEX array, dimension (LDB,NRHS). The right hand side matrixB.LDBβLDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).XβXisCOMPLEX array, dimension (LDX,NRHS). On entry, the solution matrixX, as computed byCHETRS. On exit, the improved solution matrixX. β¨LDXβLDXisINTEGER. The leading dimension of the arrayX.LDX >= max(1,N).RCONDβRCONDisREAL. Reciprocal scaled condition number. This is an estimate of the reciprocal Skeel condition number of the matrixAafter 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βBERRisREAL array, dimension (NRHS). Componentwise relative backward error. This is 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βN_ERR_BNDSisINTEGER. Number of error bounds to return for each right hand side and each type (normwise or componentwise). SeeERR_BNDS_NORMandERR_BNDS_COMPbelow.ERR_BNDS_NORMβERR_BNDS_NORMisREAL 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 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 = 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 approximately 1.
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 contains 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))
Componentwise relative error in the ith solution vector:
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 . 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.
π Bestie, yes, the source really trails off at βto determine if the error estimate is .β β we are keeping it exactly as written, no cap.
See Lapack Working Note 165 for further details and extra cautions.
NPARAMSβNPARAMSisINTEGER. Specifies the number of parameters set inPARAMS. If<= 0, thePARAMSarray is never referenced and default values are used.PARAMSβPARAMSisREALarray, dimensionNPARAMS. 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 toNPARAMSare 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βWORKisCOMPLEXarray, dimension(2*N).RWORKβRWORKisREALarray, dimension(2*N).INFOβINFOisINTEGER.= 0: Successful exit. The solution to every right-hand side is guaranteed.< 0: IfINFO = -i, the i-th argument had an illegal value.> 0and<= N:U(INFO,INFO)is exactly zero. The factorization has been completed, but the factorUis exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned.= N+J: The solution corresponding to the Jth right-hand side is not guaranteed. The solutions corresponding to other right-hand 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 the Jth 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) the Jth 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 397 of file cherfsx.f.
subroutine csyrfsx (character uplo, character equed, integer n, integer
nrhs, complex, dimension( lda, * ) a, integer lda, complex, dimension(
ldaf, * ) af, integer ldaf, integer, dimension( * ) ipiv, 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)
CSYRFSX
π CSYRFSX π
β¨ Purpose β¨
CSYRFSX improves the computed solution to a system of linear equations when the coefficient matrix is symmetric indefinite, 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βUPLOisCHARACTER*1.= 'U': Upper triangle ofAis stored;= 'L': Lower triangle ofAis stored.
EQUEDβEQUEDisCHARACTER*1. Specifies the form of equilibration that was done toAbefore 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βNisINTEGER. The order of the matrixA.N >= 0.NRHSβNRHSisINTEGER. The number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >= 0.AβAisCOMPLEXarray, dimension(LDA,N). The symmetric matrixA. IfUPLO = 'U', the leading N-by-N upper triangular part ofAcontains the upper triangular part of the matrixA, and the strictly lower triangular part ofAis not referenced. IfUPLO = 'L', the leading N-by-N lower triangular part ofAcontains the lower triangular part of the matrixA, and the strictly upper triangular part ofAis not referenced.LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).AFβAFisCOMPLEXarray, dimension(LDAF,N). The factored form of the matrixA.AFcontains the block diagonal matrixDand the multipliers used to obtain the factorUorLfrom the factorizationA = U*D*U**TorA = L*D*L**Tas computed byCSYTRF.LDAFβLDAFisINTEGER. The leading dimension of the arrayAF.LDAF >= max(1,N).IPIVβIPIVisINTEGERarray, dimension(N). Details of the interchanges and the block structure ofDas determined byCSYTRF.S
π
S
S is a REAL array, dimension (N).
The scale factors for A, bestie. If EQUED = 'Y', A gets multiplied on the left and the right by diag(S). S is an input argument if FACT = 'F' β otherwise it's an output argument. And if FACT = 'F' and EQUED = 'Y', every element of S has to be positive, no exceptions.
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, so you actually get a reliable solution and reliable error estimates. Scaling by powers of the radix doesn't cause rounding errors unless the result underflows or overflows β but rounding errors during scaling mean you're refining with a matrix that is not equivalent to the input matrix, which produces error estimates that may not be reliable π. So like, respect the radix.
πΈ B
B is a COMPLEX array, dimension (LDB,NRHS).
The right hand side matrix B. That's it, that's her job. β¨
π LDB
LDB is INTEGER.
The leading dimension of the array B. Needs LDB >= max(1,N) or we're gonna have a bad time.
π¦ X
X is a COMPLEX array, dimension (LDX,NRHS).
On entry: the solution matrix X, as computed by CGETRS. On exit: the improved solution matrix X. Glow-up arc, honestly. π
π LDX
LDX is INTEGER.
The leading dimension of the array X, and yes LDX >= max(1,N) β same vibe check as LDB, no cap.
β RCOND
RCOND is REAL.
Reciprocal scaled condition number β an estimate of the reciprocal Skeel condition number of the matrix A after equilibration (if that happened). If this is less than the machine precision (in particular, if it's zero), the matrix is singular to working precision. π«
Ngl though β the error may still be small even if this number is very small and the matrix looks ill-conditioned. So don't panic-scroll just because RCOND is tiny.
π BERR
BERR is REAL array, dimension (NRHS).
Componentwise relative backward error β that's 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. Smallest possible chaos edit. π
π§ N_ERR_BNDS
N_ERR_BNDS is INTEGER.
The 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 right below, bestie. β¬οΈ
π₯ ERR_BNDS_NORM
ERR_BNDS_NORM is REAL array, dimension (NRHS, N_ERR_BNDS).
For each right-hand side, this array has info about various error bounds and condition numbers for 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. Currently there 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) * 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: the 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 is REAL array, dimension (NRHS, N_ERR_BNDS).
Same idea but for 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 (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) * 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: the estimated componentwise 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*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
NPARAMS is INTEGER.
Specifies the number of parameters set in PARAMS. If <= 0, the PARAMS array is never referenced and default values are used. Respect the defaults, they're iconic for a reason. β¨
π PARAMS
PARAMS is REAL array, 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 to NPARAMS are accessed; defaults are used for higher-numbered parameters. Slay.
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 to100to permit convergence using approximate factorizations or factorizations other than LU. But listen β 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
WORK is COMPLEX array, dimension (2*N).
Scratch space. It works so you don't have to. π
πΈ RWORK
RWORK is REAL array, dimension (2*N).
The real-valued sibling of WORK. Same energy, different type.
π INFO
so here's how you read the tea leaves on INFO, bestie:
= 0β Successful exit. The solution to every right-hand side is guaranteed. slay π< 0β IfINFO = -i, the i-th argument had an illegal value. (so rude of it)> 0and<= NβU(INFO,INFO)is exactly zero. The factorization has been completed, but the factorUis exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned. π= N+Jβ The solution corresponding to the Jth right-hand side is not guaranteed. The solutions corresponding to other right-hand 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 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 398 of file csyrfsx.f.
π DSYRFSX π
okay so, big reveal, the double precision bestie:
subroutine dsyrfsx (character uplo, character equed, integer n, integer
nrhs, double precision, dimension( lda, * ) a, integer lda, double
precision, dimension( ldaf, * ) af, integer ldaf, integer, dimension( *
) ipiv, 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)
β¨ Purpose β¨
DSYRFSX improves the computed solution to a system of linear equations when the coefficient matrix is symmetric indefinite, 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 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 this case, the solution and error bounds returned are for the original unequilibrated system. iykyk π¦
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. (she doesn't even look at it. iconic.)
πΈ Parameters πΈ
UPLOβUPLOisCHARACTER*1= 'U': Upper triangle ofAis stored;= 'L': Lower triangle ofAis stored.
EQUEDβEQUEDisCHARACTER*1. Specifies the form of equilibration that was done toAbefore calling this routine. This is needed to compute the solution and error bounds correctly. fr fr, don't lie to her here.= '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βNisINTEGER. The order of the matrixA.N >= 0.NRHSβNRHSisINTEGER. The number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >= 0.AβAisDOUBLE PRECISIONarray, dimension(LDA,N). The symmetric 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. (half of her is literally not even invited to the function π)LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).AFβAFisDOUBLE PRECISIONarray, dimension(LDAF,N). The factored form of the matrixA.AFcontains the block diagonal matrixDand the multipliers used to obtain the factorUorLfrom the factorizationA = U*D*U**TorA = L*D*L**Tas computed byDSYTRF.LDAFβLDAFisINTEGER. The leading dimension of the arrayAF.LDAF >= max(1,N).IPIVβIPIVisINTEGERarray, dimension(N). Details of the interchanges and the block structure ofDas determined byDSYTRF.SβSisDOUBLE PRECISIONarray, dimension(N). The scale factors forA. IfEQUED = 'Y',Ais multiplied on the left and right bydiag(S).Sis an input argument ifFACT = 'F'; otherwise,Sis an output argument. IfFACT = 'F'andEQUED = 'Y', each element ofSmust be positive. IfSis output, each element ofSis a power of the radix. IfSis 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. 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βBisDOUBLE PRECISIONarray, dimension(LDB,NRHS). The right hand side matrixB.LDBβLDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).XβXisDOUBLE PRECISIONarray, dimension(LDX,NRHS). On entry, the solution matrixX, as computed byDGETRS. On exit, the improved solution matrixX. glow-up arc πLDXβLDXisINTEGER. The leading dimension of the arrayX.LDX >= max(1,N).RCONDβRCONDisDOUBLE PRECISION. Reciprocal scaled condition number. This is an estimate of the reciprocal Skeel condition number of the matrixAafter equilibration (if done). If this is less than the machine precision (in particular, if it is zero), the matrix is singular to working precision. Note that the error may still be small even if this number is very small and the matrix appears ill-conditioned. (she's giving "don't judge a book by its condition number" π)BERRβBERRisDOUBLE PRECISIONarray, dimension(NRHS). Componentwise relative backward error. This is 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βN_ERR_BNDSisINTEGER. Number of error bounds to return for each right hand side and each type (normwise or componentwise). SeeERR_BNDS_NORMandERR_BNDS_COMPbelow.ERR_BNDS_NORMβERR_BNDS_NORMisDOUBLE PRECISIONarray, 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 of 10 of 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 . 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 approximately 1.
See Lapack Working Note 165 for further details and extra cautions. π§
ERR_BNDS_COMP
ERR_BNDS_COMP β a DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS), bestie π
. For each right-hand side, this array carries info about various error bounds and condition numbers tied to the componentwise relative error, which is defined like this:
abs(XTRUE(j,i) - X(j,i))
max_j ----------------------
abs(X(j,i))
Thatβs the componentwise relative error in the ith solution vector β¨. The array is indexed by the right-hand side i (because 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. 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 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 . (yes, the source really leaves that blank β iconic in a cursed way π) These reciprocal condition numbers are1 / (norm(Z^{-1},inf) * norm(Z,inf))for some appropriately scaled matrixZ. LetZ = S*(A*diag(x)), wherexis the solution for the current right-hand side andSscales each row ofA*diag(x)by a power of the radix so all absolute row sums ofZare approximately1.
See Lapack Working Note 165 for further details and extra cautions π.
NPARAMS β INTEGER. Specifies the number of parameters set in PARAMS. If <= 0, the PARAMS array is never referenced and default values are used.
PARAMS β DOUBLE PRECISION array, dimension (NPARAMS). Specifies algorithm parameters. If an entry is < 0.0, then that entry will be filled with 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)
PARAMS(LA_LINRX_ITHRESH_I = 2)β maximum number of residual computations allowed for refinement. Default:10. Aggressive: set to100to 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 π« .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 PRECISION array, dimension (4*N) β.
IWORK β INTEGER array, dimension (N).
INFO β 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 398 of file dsyrfsx.f.
π subroutine ssyrfsx β SSYRFSX π
subroutine ssyrfsx (character uplo, character equed, integer n, integer
nrhs, real, dimension( lda, * ) a, integer lda, real, dimension( ldaf, *
) af, integer ldaf, integer, dimension( * ) ipiv, 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)
SSYRFSX
Purpose β¨
SSYRFSX improves the computed solution to a system of linear equations when the coefficient matrix is symmetric indefinite, 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. Peep the 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 β CHARACTER*1.
= 'U': upper triangle ofAis stored;= 'L': lower triangle ofAis stored.
EQUED β 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 β INTEGER. The order of the matrix A. N >= 0.
NRHS β INTEGER. The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0.
A β 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.
LDA β INTEGER. The leading dimension of the array A. LDA >= max(1,N).
AF β REAL array, dimension (LDAF,N). The factored form of the matrix A. AF 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 SSYTRF.
LDAF β INTEGER. The leading dimension of the array AF. LDAF >= max(1,N).
IPIV β INTEGER array, dimension (N). Details of the interchanges and the block structure of D as determined by SSYTRF.
S
okay bestie we are still in the argument section and honestly it's the main character of this whole page π keep up, we're going through the rest of them one by one β no skipping, no "tl;dr", every single clause is coming with us β¨
Sβ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, no cap. 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βREAL array, dimension (LDB,NRHS)π¦
The right hand side matrix B. that's it, that's the whole vibe.
LDBβINTEGERβ¨
The leading dimension of the array B. LDB >= max(1,N). periodt.
XβREAL array, dimension (LDX,NRHS)πΈ
On entry, the solution matrix X, as computed by SGETRS. On exit, the improved solution matrix X. glow-up complete π
LDXβINTEGERπ
The leading dimension of the array X. LDX >= max(1,N). same energy as LDB, iconic.
RCONDβ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 β so like, don't panic immediately, but do keep an eye on it.
BERRβ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). it's giving "how much did we have to fudge things", bestie.
N_ERR_BNDSβINTEGERπ§
Number of error bounds to return for each right hand side and each type (normwise or componentwise). See ERR_BNDS_NORM and ERR_BNDS_COMP below π
ERR_BNDS_NORMβ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 = 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 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 approximately 1.
ngl bestie that "is ." right there is literally how it ends in the source β the sentence just β¨trails offβ¨. not me fixing it, i would never π
See Lapack Working Note 165 for further details and extra cautions.
ERR_BNDS_COMPβ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 componentwise relative error, which is defined as follows:
Componentwise relative error in the ith solution vector:
abs(XTRUE(j,i) - X(j,i))
max_j ----------------------
abs(X(j,i))
The array is indexed by the right-hand side i (on which the componentwise relative error depends), and the type of error information as described below. There currently are up to three pieces of information returned for each right-hand side. If componentwise accuracy is not requested (PARAMS(3) = 0.0), then ERR_BNDS_COMP is not accessed. If N_ERR_BNDS < 3, then at most the first (:,N_ERR_BNDS) entries are returned.
The first index in ERR_BNDS_COMP(i,:) corresponds to the ith right-hand side.
The second index in ERR_BNDS_COMP(:,err) contains the following three fields:
err = 1β 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 . 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.
same thing here β "is ." and then nothing. the source said what it said π«Ά
See Lapack Working Note 165 for further details and extra cautions.
NPARAMSβINTEGERβ
Specifies the number of parameters set in PARAMS. If <= 0, the PARAMS array is never referenced and default values are used. respecting the boundaries, we love to see it π
PARAMSβ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. β οΈ like, you can do it, but bestie, be aware.
- 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βREAL array, dimension (4*N)π
just doin' its little scratch-space thing, no further notes π
IWORKβINTEGER array, dimension (N)π¦
same, but integers. iconic.
INFO
INFO is INTEGER β okay so here's the vibe check on what it means:
= 0: successful exit. The solution to every right-hand side is guaranteed.< 0: ifINFO = -i, the i-th argument had an illegal value.> 0and<= N:U(INFO,INFO)is exactly zero. The factorization has been completed, but the factorUis exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned.= N+J: the solution corresponding to the Jth right-hand side is not guaranteed. The solutions corresponding to other right-hand 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 the Jth 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) the Jth 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 398 of file ssyrfsx.f.
subroutine zherfsx (character uplo, character equed, integer n, integer nrhs, complex*16, dimension( lda, * ) a, integer lda, complex*16, dimension( ldaf, * ) af, integer ldaf, integer, dimension( * ) ipiv, 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)
π ZHERFSX π
π Purpose π
ZHERFSX improves the computed solution to a system of linear equations when the coefficient matrix is Hermitian indefinite, and it provides error bounds and backward error estimates for the solution. On top of the normwise error bound, the code provides the maximum componentwise error bound if possible. Peep the comments for ERR_BNDS_NORM and ERR_BNDS_COMP for the deets on 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. No cap.
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. Slay, defaults. β¨
π 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 COMPLEX*16 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 is INTEGER β the leading dimension of the array A. LDA >= max(1,N).
AF is COMPLEX*16 array, dimension (LDAF,N) β the factored form of the matrix A. AF 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 ZHETRF.
LDAF is INTEGER β the leading dimension of the array AF. LDAF >= max(1,N).
IPIV is INTEGER array, dimension (N) β details of the interchanges and the block structure of D as determined by ZHETRF.
S is DOUBLE PRECISION array, dimension (N) β the scale factors for A. If EQUED = 'Y', A is multiplied on the left and right by diag(S). S is an input argument if FACT = 'F'; otherwise, S is an output argument. If FACT = 'F' and EQUED = 'Y', each element of S must be positive. If S is output, each element of S is a power of the radix. If S is input, each element of S should be a power of the radix to ensure a reliable solution and error estimates. Scaling by powers of the radix does not cause rounding errors unless the result underflows or overflows. Rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, producing error estimates that may not be reliable.
B is COMPLEX*16 array, dimension (LDB,NRHS) β the right hand side matrix B.
LDB is INTEGER β the leading dimension of the array B. LDB >= max(1,N).
X is COMPLEX*16 array, dimension (LDX,NRHS) β on entry, the solution matrix X, as computed by ZHETRS. On exit, the improved solution matrix X.
LDX is INTEGER β the leading dimension of the array X. LDX >= max(1,N).
RCOND is DOUBLE PRECISION β reciprocal scaled condition number. This is an estimate of the reciprocal Skeel condition number of the matrix A after equilibration (if done). If this is less than the machine precision (in particular, if it is zero), the matrix is singular to working precision. Note that the error may still be small even if this number is very small and the matrix appears ill-conditioned. π«Ά
BERR is DOUBLE PRECISION array, dimension (NRHS) β componentwise relative backward error. This is the componentwise relative backward error of each solution vector X(j) (i.e., the smallest relative change in any element of A or B that makes X(j) an exact solution).
N_ERR_BNDS 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 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:
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) * dlamch('Epsilon').err = 2error 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) * dlamch('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) * dlamch('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 approximately 1.
See Lapack Working Note 165 for further details and extra cautions.
ERR_BNDS_COMP
ERR_BNDS_COMPβDOUBLE PRECISIONarray, dimension(NRHS, N_ERR_BNDS). For every right-hand side, this baby holds all the tea about error bounds and condition numbers, specifically for the componentwise relative error, which is defined like this:
Componentwise relative error in the ith solution vector:
abs(XTRUE(j,i) - X(j,i))
max_j ----------------------
abs(X(j,i))
Okay so how the indexing works, bestie: the array is indexed by the right-hand side i (the componentwise relative error depends on it) and by the type of error info, described below. Right now there are up to three pieces of info returned per right-hand side. If you didn't ask for componentwise accuracy (PARAMS(3) = 0.0), then ERR_BNDS_COMP is never accessed β it's giving "you didn't text me so I'm not answering" energy. And if N_ERR_BNDS < 3, then at most the first (:,N_ERR_BNDS) entries come back. π
First index in ERR_BNDS_COMP(i,:) = the *i*th right-hand side. Slay.
Second index in ERR_BNDS_COMP(:,err) holds these three fields, periodt:
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 of 10 of 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 . 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 β that's the required reading, iykyk. π
NPARAMSβINTEGER. Specifies the number of parameters set inPARAMS. If<= 0, thePARAMSarray is never referenced and default values are used. No cap, we're going default mode. πPARAMSβDOUBLE PRECISIONarray, dimensionNPARAMS. 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 the higher-numbered ones. πΈ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 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. β οΈ Heads up: if the factorization uses a technique other than Gaussian elimination, the guarantees inerr_bnds_normanderr_bnds_compmay no longer be trustworthy. Not me warning you twice.
- 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βCOMPLEX*16array, dimension(2*N). Scratch space, do not perceive her. π«ΆRWORKβDOUBLE PRECISIONarray, dimension(2*N). More scratch, equally unperceived.INFOβINTEGER. The vibe report:= 0: Successful exit. The solution to every right-hand side is guaranteed. We ate. π₯< 0: IfINFO = -i, the *i*th argument had an illegal value. π> 0and<= N:U(INFO,INFO)is exactly zero. The factorization has been completed, but the factorUis exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned. π= N+J: the solution corresponding to the Jth right-hand side is not guaranteed. The solutions for 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 the Jth 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) the Jth 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 info 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 397 of file zherfsx.f.
π¦ ZSYRFSX π¦
Okay bestie, new function, same energy. Signature first, verbatim, no edits:
subroutine zsyrfsx (character uplo, character equed, integer n, integer
nrhs, complex*16, dimension( lda, * ) a, integer lda, complex*16,
dimension( ldaf, * ) af, integer ldaf, integer, dimension( * ) ipiv,
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)
β¨ Purpose β¨
ZSYRFSX improves the computed solution to a system of linear equations when the coefficient matrix is symmetric indefinite, and provides error bounds and backward error estimates for the solution. In addition to the normwise error bound, the code provides the maximum componentwise error bound if possible. See the comments for ERR_BNDS_NORM and ERR_BNDS_COMP for the details of those error bounds. It's giving overachiever and we love her. π
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. Important distinction, don't forget it. β
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 entirely. Defaults stay winning. π
π 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. (Yes, correctly, 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β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 symmetric matrixA. IfUPLO = 'U', the leading N-by-N upper triangular part ofAcontains the upper triangular part of the matrixA, and the strictly lower triangular part ofAis not referenced. IfUPLO = 'L', the leading N-by-N lower triangular part ofAcontains the lower triangular part of the matrixA, and the strictly upper triangular part ofAis not referenced. Half of her is literally off-limits, we respect the boundary. πLDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).AFβCOMPLEX*16array, dimension(LDAF,N). The factored form of the matrixA.AFcontains the block diagonal matrixDand the multipliers used to obtain the factorUorLfrom the factorizationA = U*D*U**TorA = L*D*L**Tas computed byZSYTRF.LDAFβINTEGER. The leading dimension of the arrayAF.LDAF >= max(1,N).IPIVβINTEGERarray, dimension(N). Details of the interchanges and the block structure ofDas determined byZSYTRF.Sβ
S π
S is a DOUBLE PRECISION array, dimension (N) β the scale factors for A, bestie.
So here's the tea π«: if EQUED = 'Y', then A gets multiplied on the left and the right by diag(S). Whether S is an input or an output depends entirely on FACT:
- if
FACT = 'F',Sis an input argument - otherwise,
Sis an output argument
And if FACT = 'F' with EQUED = 'Y', then every single element of S must be positive β no zeroes, no negatives, periodt.
When S is output, each element of S is a power of the radix. When S is input, each element should be a power of the radix so you get a reliable solution and reliable error estimates. Scaling by powers of the radix doesn't cause rounding errors β unless the result underflows or overflows, obviously π. And rounding errors during scaling? They lead to refining with a matrix that is not equivalent to the input matrix, which produces error estimates that may not be reliable. So likeβ¦ watch out.
B πΈ
B is a COMPLEX*16 array, dimension (LDB,NRHS).
It's 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 β¨
X is a COMPLEX*16 array, dimension (LDX,NRHS).
- On entry: the solution matrix
X, as computed byZGETRS - On exit: the improved solution matrix
Xπ
Glow-up era, honestly.
LDX π¦
LDX is INTEGER β the leading dimension of the array X.
Constraint: LDX >= max(1,N).
RCOND π
RCOND is DOUBLE PRECISION β the reciprocal scaled condition number.
It's an estimate of the reciprocal Skeel condition number of the matrix A after equilibration (if equilibration was done, of course).
If this number is less than the machine precision β in particular, if it's zero β then 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 small and the matrix appears ill-conditioned. So don't panic immediately, iykyk.
BERR π₯
BERR is a DOUBLE PRECISION array, dimension (NRHS) β componentwise relative backward error.
Specifically, it's the componentwise relative backward error of each solution vector X(j). Which is a fancy way of saying: the smallest relative change in any element of A or B that makes X(j) an exact solution. Iconic behaviour.
N_ERR_BNDS β
N_ERR_BNDS is INTEGER β the number of error bounds to return for each right hand side and for each type (normwise or componentwise).
See ERR_BNDS_NORM and ERR_BNDS_COMP right below π
ERR_BNDS_NORM π
ERR_BNDS_NORM is a DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS).
For each right-hand side, this array carries info about all the error bounds and condition numbers corresponding to the normwise relative error, which is defined like this:
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 are currently up to three pieces of info 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 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. (Like, actually true true. Not just vibes.)err = 3β reciprocal condition number: estimated normwise reciprocal condition number. Compared with the thresholdsqrt(n) * dlamch('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.
Ngl the original doc just leaves that sentence hanging after "is ." β I'm not gonna invent a word for it, so we're passing the mystery along to you π
See Lapack Working Note 165 for further details and extra cautions. Read it, bestie, it's giving homework but it matters.
ERR_BNDS_COMP π
ERR_BNDS_COMP is a DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS).
Same deal, but for each right-hand side this one holds info about the error bounds and condition numbers for the componentwise relative error, defined as:
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 (the componentwise relative error depends on it, so, y'know) and by the type of error information described below. There are currently up to three pieces of info returned for each right-hand side. And heads up:
- if componentwise accuracy is not requested (
PARAMS(3) = 0.0), thenERR_BNDS_COMPis never 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 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. Again. Same rule πerr = 3β reciprocal condition number: estimated componentwise reciprocal condition number. Compared with the thresholdsqrt(n) * dlamch('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*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.
Same hanging sentence situation as above β the source cuts it off at "is ." so I'm keeping it exactly that way, no edits, no guessing π«Ά
See Lapack Working Note 165 for further details and extra cautions.
NPARAMS π§
NPARAMS is INTEGER β specifies the number of parameters set in PARAMS.
If NPARAMS <= 0, the PARAMS array is never referenced and default values are used. Zero reads, maximum chill.
PARAMS π
PARAMS is a DOUBLE PRECISION array, dimension NPARAMS β it specifies the algorithm parameters.
If an entry is < 0.0, that entry gets filled in with the default value used for that parameter. Only positions up to NPARAMS are accessed; defaults are used for higher-numbered parameters. So you can't sneak anything in past the cutoff π
Here's the full rundown:
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. β οΈ But if the factorization uses a technique other than Gaussian elimination, the guarantees inerr_bnds_normanderr_bnds_compmay no longer be trustworthy. So like, aggressive-aggressive.
- 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*16 array, dimension (2*N).
That's the whole description. Short king.
RWORK π
RWORK is a DOUBLE PRECISION array, dimension (2*N).
Also just vibing there, living its best life.
okay so next up is INFO, which is literally exactly where this chunk cuts off π β stay with me, we're not done yet β¨
INFOisINTEGERβ the little status report at the end, and bestie, you need to read it π= 0β successful exit, slay. The solution to every right-hand side is guaranteed. π< 0β ifINFO = -i, the i-th argument had an illegal value. Not me calling out your bad input π> 0and<= NβU(INFO,INFO)is exactly zero. Like, the factorization did get completed, but the factorUis exactly singular, so the solution and the error bounds could not be computed, andRCOND = 0is returned. It's giving "we tried, it's broken" π= N+Jβ the solution corresponding to the J-th right-hand side is not guaranteed. And heads up: the solutions for other right-hand sides K withK > Jmay not be guaranteed either, but only the first such right-hand side gets reported. iykyk.- If a small componentwise error is not requested (
PARAMS(3) = 0.0), then the J-th right-hand side is the first one with a normwise error bound that isn't guaranteed β that's the smallest J such thatERR_BNDS_NORM(J,1) = 0.0. β¨ - By default (
PARAMS(3) = 1.0), the J-th right-hand side is the first with either a normwise or a componentwise error bound that isn't 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). - Want the tea on all of the right-hand sides? Check
ERR_BNDS_NORMorERR_BNDS_COMP. π
- If a small componentwise error is not requested (
π Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 398 of file zsyrfsx.f. π¦
β¨ Author β¨
Generated automatically by Doxygen for LAPACK from the source code. (Yes, the robots wrote this one, no cap π€π)
And that's a wrap on herfsx(3), bestie β you made it to the end and I'm so proud of you π«Ά This absolute icon of a page is from LAPACK, Version 3.12.0, and the herfsx(3) date stamp at the bottom is all part of the same package. Now go forth and check your INFO values, 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