posvxx(3)

โœจ NAME โœจ

posvxx โ€” posvxx: factor and solve, extra precise ๐Ÿ’…


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

Functions

  • subroutine cposvxx (fact, uplo, n, nrhs, a, lda, af, ldaf, equed, s, b, ldb, x, ldx, rcond, rpvgrw, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, rwork, info) CPOSVXX computes the solution to system of linear equations A * X = B for PO matrices
  • subroutine dposvxx (fact, uplo, n, nrhs, a, lda, af, ldaf, equed, s, b, ldb, x, ldx, rcond, rpvgrw, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, iwork, info) DPOSVXX computes the solution to system of linear equations A * X = B for PO matrices
  • subroutine sposvxx (fact, uplo, n, nrhs, a, lda, af, ldaf, equed, s, b, ldb, x, ldx, rcond, rpvgrw, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, iwork, info) SPOSVXX computes the solution to system of linear equations A * X = B for PO matrices
  • subroutine zposvxx (fact, uplo, n, nrhs, a, lda, af, ldaf, equed, s, b, ldb, x, ldx, rcond, rpvgrw, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, rwork, info) ZPOSVXX computes the solution to system of linear equations A * X = B for PO matrices

๐ŸŒธ DETAILED DESCRIPTION ๐ŸŒธ

(okay bestie there's literally nothing else here, it just goes straight to the function docs, keep scrolling ๐Ÿ˜Œ)

๐Ÿ’œ Function Documentation ๐Ÿ’œ

subroutine cposvxx

subroutine cposvxx (character fact, character uplo, integer n, integer nrhs,
    complex, dimension( lda, * ) a, integer lda, complex, dimension( ldaf, * )
    af, integer ldaf, character equed, real, dimension( * ) s, complex,
    dimension( ldb, * ) b, integer ldb, complex, dimension( ldx, * ) x,
    integer ldx, real rcond, real rpvgrw, 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)

CPOSVXX computes the solution to system of linear equations A * X = B for PO matrices

๐ŸŽ€ Purpose:

so basically ๐Ÿ’–

CPOSVXX uses the Cholesky factorization A = U**T*U or A = L*L**T to compute the solution to a complex system of linear equations A * X = B, where A is an N-by-N Hermitian positive definite matrix and X and B are N-by-NRHS matrices. no cap.

If requested, both normwise and maximum componentwise error bounds are returned. CPOSVXX will return a solution with a tiny guaranteed error (O(eps) where eps is the working machine precision) unless the matrix is very ill-conditioned, in which case a warning is returned ๐Ÿšจ. Relevant condition numbers also are calculated and returned.

CPOSVXX accepts user-provided factorizations and equilibration factors; see the definitions of the FACT and EQUED options. Solving with refinement and using a factorization from a previous CPOSVXX call will also produce a solution with either O(eps) errors or warnings, but we cannot make that claim for general user-provided factorizations and equilibration factors if they differ from what CPOSVXX would itself produce. (translation: if you hand it your own random factorization, that's on you bestie ๐Ÿ™ˆ)

๐Ÿฆ‹ Description:

the way this routine just does all this for you, iconic. here's the play-by-play โœจ

The following steps are performed:

  1. If FACT = 'E', real scaling factors are computed to equilibrate the system:
diag(S)*A*diag(S)     *inv(diag(S))*X = diag(S)*B

Whether or not the system will be equilibrated depends on the scaling of the matrix A, but if equilibration is used, A is overwritten by diag(S)*A*diag(S) and B by diag(S)*B.

  1. If FACT = 'N' or 'E', the Cholesky decomposition is used to factor the matrix A (after equilibration if FACT = 'E') as
A = U**T* U,  if UPLO = 'U', or
A = L * L**T,  if UPLO = 'L',

where U is an upper triangular matrix and L is a lower triangular matrix.

  1. If the leading principal minor of order i is not positive, then the routine returns with INFO = i. Otherwise, the factored form of A is used to estimate the condition number of the matrix A (see argument RCOND). If the reciprocal of the condition number is less than machine precision, the routine still goes on to solve for X and compute error bounds as described below ๐Ÿ‘‘.
  2. The system of equations is solved for X using the factored form of A.
  3. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero), the routine will use iterative refinement to try to get a small error and error bounds. Refinement calculates the residual to at least twice the working precision ๐Ÿ”ฅ.
  4. If equilibration was used, the matrix X is premultiplied by diag(S) so that it solves the original system before equilibration.

Some optional parameters are bundled in the PARAMS array. These settings determine how refinement is performed, but often the defaults are acceptable. If the defaults are acceptable, users can pass NPARAMS = 0 which prevents the source code from accessing the PARAMS argument. (lazy girl math: pass 0 and dip ๐Ÿ˜Œ)


Parameters

FACT

FACT is CHARACTER*1

Specifies whether or not the factored form of the matrix A is supplied on entry, and if not, whether the matrix A should be equilibrated before it is factored.

  • = 'F': On entry, AF contains the factored form of A. If EQUED is not 'N', the matrix A has been equilibrated with scaling factors given by S. A and AF are not modified.
  • = 'N': The matrix A will be copied to AF and factored.
  • = 'E': The matrix A will be equilibrated if necessary, then copied to AF and factored.

UPLO

UPLO is CHARACTER*1

  • = 'U': Upper triangle of A is stored;
  • = 'L': Lower triangle of A is stored.

N

N is INTEGER

The number of linear equations, i.e., the order of the matrix A. N >= 0.

NRHS

NRHS is INTEGER

The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0.

A

A is COMPLEX array, dimension (LDA,N)

On entry, the Hermitian matrix A, except if FACT = 'F' and EQUED = 'Y', then A must contain the equilibrated matrix diag(S)*A*diag(S). 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. A is not modified if FACT = 'F' or 'N', or if FACT = 'E' and EQUED = 'N' on exit.

On exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by diag(S)*A*diag(S).

LDA

LDA is INTEGER

The leading dimension of the array A. LDA >= max(1,N).

AF

AF is COMPLEX array, dimension (LDAF,N)

If FACT = 'F', then AF is an input argument and on entry contains the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T, in the same storage format as A. If EQUED .ne. 'N', then AF is the factored form of the equilibrated matrix diag(S)*A*diag(S).

If FACT = 'N', then AF is an output argument and on exit returns the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T of the original matrix A.

If FACT = 'E', then AF is an output argument and on exit returns the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T of the equilibrated matrix A (see the description of A for the form of the equilibrated matrix).

LDAF

LDAF is INTEGER

The leading dimension of the array AF. LDAF >= max(1,N).

EQUED

EQUED is CHARACTER*1

Specifies the form of equilibration that was done.

  • = 'N': No equilibration (always true if FACT = 'N').
  • = 'Y': Both row and column equilibration, i.e., A has been replaced by diag(S) * A * diag(S).

EQUED is an input argument if FACT = 'F'; otherwise, it is an output argument.

S

S is REAL array, dimension (N)

The row 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)

On entry, the N-by-NRHS right hand side matrix B.

On exit, if EQUED = 'N', B is not modified; if EQUED = 'Y', B is overwritten by diag(S)*B;

LDB

LDB is INTEGER

The leading dimension of the array B. LDB >= max(1,N).

X

X is COMPLEX array, dimension (LDX,NRHS)

If INFO = 0, the N-by-NRHS solution matrix X to the original system of equations. Note that A and B are modified on exit if EQUED .ne. 'N', and the solution to the equilibrated system is inv(diag(S))*X.

LDX

LDX โ€” INTEGER

Leading dimension of the array X, bestie. Constraint: LDX >= max(1,N). That's it, that's the whole vibe check. ๐Ÿซถ


RCOND โ€” REAL

Reciprocal scaled condition number โœจ โ€” an estimate of the reciprocal Skeel condition number of the matrix A after equilibration (if that got done).

If this is less than machine precision (and especially if it's literally zero), the matrix is singular to working precision. ๐Ÿ’€

Big caveat, don't skip it: the error may still be small even when this number is tiny and the matrix looks ill-conditioned. So don't panic-read this one number in isolation, ok?

RPVGRW โ€” REAL

Reciprocal pivot growth ๐ŸŒฑ. On exit, this holds the reciprocal pivot growth factor norm(A)/norm(U) โ€” the norm is what's used.

If this is much less than 1, then the stability of the LU factorization of the (equilibrated) matrix A could be poor ๐Ÿ˜ญ. Which also means the solution X, the estimated condition numbers, and the error bounds could all be unreliable. Rude, but that's the tea.

If factorization fails with 0<INFO<=N, then this contains the reciprocal pivot growth factor for the leading INFO columns of A.


BERR โ€” REAL array, dimension (NRHS)

Componentwise relative backward error ๐Ÿ”. Specifically, 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. Iconic little overachiever.


N_ERR_BNDS โ€” INTEGER

The number of error bounds to return for each right hand side and each type (normwise or componentwise). Go peep 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 carries info about the 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))

That's the normwise relative error of the ith solution vector, no cap ๐Ÿงฎ.

The array is indexed by the type of error information as described below. There are currently up to three pieces of info returned.

  • First index in ERR_BNDS_NORM(i,:) โ†’ the ith right-hand side.
  • Second index in ERR_BNDS_NORM(:,err) โ†’ one of the following three fields:

The three err fields, in order:

  • err = 1 โ€” boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(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 threshold sqrt(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 threshold sqrt(n) * slamch('Epsilon') to determine if the error estimate is trusted. These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*A, where S scales each row by a power of the radix so all absolute row sums of Z are approximately 1.

See Lapack Working Note 165 for further details and extra cautions ๐Ÿ“Ž.


ERR_BNDS_COMP โ€” REAL array, dimension (NRHS, N_ERR_BNDS)

Same deal, but for the componentwise relative error ๐Ÿ’…. For each right-hand side, this array contains information 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))

That's the componentwise relative error of the ith solution vector.

The array is indexed by the right-hand side i (which the componentwise relative error depends on) and by the type of error information described below. There are currently up to three pieces of info returned for each right-hand side.

Heads up ๐Ÿšจ: if componentwise accuracy isn't 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.
  • First index in ERR_BNDS_COMP(i,:) โ†’ the ith right-hand side.
  • Second index in ERR_BNDS_COMP(:,err) โ†’ one of the three fields:
  • err = 1 โ€” boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(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 threshold sqrt(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 threshold sqrt(n) * slamch('Epsilon') to determine if the error estimate is trusted. These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*(A*diag(x)), where x is the solution for the current right-hand side and S scales each row of A*diag(x) by a power of the radix so all absolute row sums of Z are approximately 1.

Also: 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 โ€” REAL array, dimension NPARAMS

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 to NPARAMS are accessed; defaults are used for higher-numbered parameters.

  • PARAMS(LA_LINRX_ITREF_I = 1) โ€” whether to do 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 doesn't support DOUBLE 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 to 100 to permit convergence using approximate factorizations or factorizations other than LU. โš ๏ธ But if the factorization uses a technique other than Gaussian elimination, the guarantees in err_bnds_norm and err_bnds_comp may no longer be trustworthy. So like, know what you're doing.
  • 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.0 is false.
    • Default: 1.0 (attempt componentwise convergence)

WORK โ€” COMPLEX array, dimension (2*N)

Scratch space, that's the whole description bestie ๐Ÿซง


RWORK โ€” REAL array, dimension (2*N)

Scratch space but real this time ๐ŸŒธ


INFO โ€” INTEGER

The receipts ๐Ÿ“‹:

  • = 0: successful exit. The solution to every right-hand side is guaranteed โœจ
  • < 0: if INFO = -i, the i-th argument had an illegal value ๐Ÿ™…
  • > 0 and <= N: U(INFO,INFO) is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution and error bounds could not be computed. RCOND = 0 is returned. ๐Ÿ’€
  • = N+J: the solution corresponding to the Jth right-hand side is not guaranteed. The solutions for other right-hand sides K with K > J may not be guaranteed either, 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 isn't guaranteed (the smallest J such that ERR_BNDS_NORM(J,1) = 0.0).
    • By default (PARAMS(3) = 1.0), the Jth right-hand side is the first with either a normwise or a componentwise error bound that isn't guaranteed (the smallest J such that either ERR_BNDS_NORM(J,1) = 0.0 or ERR_BNDS_COMP(J,1) = 0.0).
    • See the definition of ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get info about all of the right-hand sides, check ERR_BNDS_NORM or ERR_BNDS_COMP ๐Ÿ‘€

๐ŸŒŸ Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.


๐Ÿฆ‹ Definition

Definition at line 492 of file cposvxx.f.

subroutine dposvxx (character fact, character uplo, integer n, integer nrhs,
    double precision, dimension( lda, * ) a, integer lda, double precision,
    dimension( ldaf, * ) af, integer ldaf, character equed, double
    precision, dimension( * ) s, double precision, dimension( ldb, * ) b,
    integer ldb, double precision, dimension( ldx, * ) x, integer ldx,
    double precision rcond, double precision rpvgrw, double precision,
    dimension( * ) berr, integer n_err_bnds, double precision, dimension(
    nrhs, * ) err_bnds_norm, double precision, dimension( nrhs, * )
    err_bnds_comp, integer nparams, double precision, dimension( * ) params,
    double precision, dimension( * ) work, integer, dimension( * ) iwork,
    integer info)

okay so DPOSVXX computes the solution to the system of linear equations A * X = B for PO matrices. periodt. ๐Ÿ’…

โœจ Purpose โœจ

DPOSVXX uses the Cholesky factorization A = U**T*U or A = L*L**T to compute the solution to a double precision system of linear equations A * X = B, where A is an N-by-N symmetric positive definite matrix and X and B are N-by-NRHS matrices. ๐Ÿซถ

If requested, both normwise and maximum componentwise error bounds are returned. DPOSVXX will return a solution with a tiny guaranteed error (O(eps) where eps is the working machine precision) unless the matrix is very ill-conditioned, in which case a warning is returned. Relevant condition numbers also are calculated and returned. ๐ŸŒธ

DPOSVXX accepts user-provided factorizations and equilibration factors; see the definitions of the FACT and EQUED options. Solving with refinement and using a factorization from a previous DPOSVXX call will also produce a solution with either O(eps) errors or warnings, but we cannot make that claim for general user-provided factorizations and equilibration factors if they differ from what DPOSVXX would itself produce. ๐Ÿ‘‘


๐Ÿ’– Description ๐Ÿ’–

The following steps are performed:

  1. If FACT = 'E', double precision scaling factors are computed to equilibrate the system:
diag(S)*A*diag(S)     *inv(diag(S))*X = diag(S)*B

Whether or not the system will be equilibrated depends on the scaling of the matrix A, but if equilibration is used, A is overwritten by diag(S)*A*diag(S) and B by diag(S)*B. ๐Ÿฆ‹

  1. If FACT = 'N' or 'E', the Cholesky decomposition is used to factor the matrix A (after equilibration if FACT = 'E') as
A = U**T* U,  if UPLO = 'U', or
A = L * L**T,  if UPLO = 'L',

where U is an upper triangular matrix and L is a lower triangular matrix. ๐Ÿ’…

  1. If the leading principal minor of order i is not positive, then the routine returns with INFO = i. Otherwise, the factored form of A is used to estimate the condition number of the matrix A (see argument RCOND). If the reciprocal of the condition number is less than machine precision, the routine still goes on to solve for X and compute error bounds as described below. ๐Ÿ˜ญ
  2. The system of equations is solved for X using the factored form of A. โœจ
  3. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero), the routine will use iterative refinement to try to get a small error and error bounds. Refinement calculates the residual to at least twice the working precision. ๐Ÿ”ฅ
  4. If equilibration was used, the matrix X is premultiplied by diag(S) so that it solves the original system before equilibration. ๐ŸŽ€

Some optional parameters are bundled in the PARAMS array. These settings determine how refinement is performed, but often the defaults are acceptable. If the defaults are acceptable, users can pass NPARAMS = 0 which prevents the source code from accessing the PARAMS argument. ๐Ÿซถ


๐ŸŒธ Parameters ๐ŸŒธ

  • FACT โ€” CHARACTER*1. Specifies whether or not the factored form of the matrix A is supplied on entry, and if not, whether the matrix A should be equilibrated before it is factored. ๐Ÿ’–
    • = 'F': On entry, AF contains the factored form of A. If EQUED is not 'N', the matrix A has been equilibrated with scaling factors given by S. A and AF are not modified.
    • = 'N': The matrix A will be copied to AF and factored.
    • = 'E': The matrix A will be equilibrated if necessary, then copied to AF and factored.
  • UPLO โ€” CHARACTER*1.
    • = 'U': Upper triangle of A is stored;
    • = 'L': Lower triangle of A is stored. ๐Ÿฆ‹
  • N โ€” INTEGER. The number of linear equations, i.e., the order of the matrix A. N >= 0. ๐Ÿ’…
  • NRHS โ€” INTEGER. The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0. ๐ŸŒˆ
  • A โ€” DOUBLE PRECISION array, dimension (LDA,N). On entry, the symmetric matrix A, except if FACT = 'F' and EQUED = 'Y', then A must contain the equilibrated matrix diag(S)*A*diag(S). 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. A is not modified if FACT = 'F' or 'N', or if FACT = 'E' and EQUED = 'N' on exit. ๐Ÿซถ

On exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by diag(S)*A*diag(S). ๐Ÿ‘‘

  • LDA โ€” INTEGER. The leading dimension of the array A. LDA >= max(1,N). โญ
  • AF โ€” DOUBLE PRECISION array, dimension (LDAF,N). If FACT = 'F', then AF is an input argument and on entry contains the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T, in the same storage format as A. If EQUED .ne. 'N', then AF is the factored form of the equilibrated matrix diag(S)*A*diag(S). ๐Ÿ’œ

If FACT = 'N', then AF is an output argument and on exit returns the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T of the original matrix A. ๐ŸŒธ

If FACT = 'E', then AF is an output argument and on exit returns the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T of the equilibrated matrix A (see the description of A for the form of the equilibrated matrix). โœจ

  • LDAF โ€” INTEGER. The leading dimension of the array AF. LDAF >= max(1,N). ๐ŸŽ€
  • EQUED โ€” CHARACTER*1. Specifies the form of equilibration that was done.
    • = 'N': No equilibration (always true if FACT = 'N').
    • = 'Y': Both row and column equilibration, i.e., A has been replaced by diag(S) * A * diag(S).

EQUED is an input argument if FACT = 'F'; otherwise, it is an output argument. ๐Ÿ’…

  • S โ€” DOUBLE PRECISION array, dimension (N). The row 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 โ€” DOUBLE PRECISION array, dimension (LDB,NRHS). On entry, the N-by-NRHS right hand side matrix B. On exit, if EQUED = 'N', B is not modified; if EQUED = 'Y', B is overwritten by diag(S)*B. ๐Ÿฆ‹
  • LDB โ€” INTEGER. The leading dimension of the array B. LDB >= max(1,N). ๐ŸŒˆ
  • X โ€” DOUBLE PRECISION array, dimension (LDX,NRHS). If INFO = 0, the N-by-NRHS solution matrix X to the original system of equations. Note that A and B are modified on exit if EQUED .ne. 'N', and the solution to the equilibrated system is inv(diag(S))*X. ๐Ÿ”ฅ
  • LDX โ€” INTEGER. The leading dimension of the array X. LDX >= max(1,N). โญ
  • RCOND โ€” DOUBLE PRECISION. Reciprocal scaled condition number. This is an estimate of the reciprocal Skeel condition number of the matrix A after equilibration (if done). If this is less than the machine precision (in particular, if it is zero), the matrix is singular to working precision. Note that the error may still be small even if this number is very small and the matrix appears ill-conditioned. ๐Ÿ‘‘
  • RPVGRW

RPVGRW

RPVGRW is DOUBLE PRECISION โ€” it's the reciprocal pivot growth, bestie. ๐Ÿ’… On exit this contains the reciprocal pivot growth factor norm(A)/norm(U). The norm is used. If this is much less than 1, then the stability of the LU factorization of the (equilibrated) matrix A could be poor ๐Ÿ˜ญ โ€” which also means that the solution X, the estimated condition numbers, and the error bounds could all be unreliable. If factorization fails with 0<INFO<=N, then this contains the reciprocal pivot growth factor for the leading INFO columns of A. ๐Ÿซถ

BERR

BERR is DOUBLE PRECISION array, dimension (NRHS) โ€” the componentwise relative backward error. Fr fr it'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. โœจ

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 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))

Normwise relative error in the ith solution vector โ€” that's the vibe. ๐Ÿฆ‹

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 threshold sqrt(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 threshold sqrt(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 threshold sqrt(n) * dlamch('Epsilon') to determine if the error estimate is . These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*A, where S scales each row by a power of the radix so all absolute row sums of Z are approximately 1. ๐Ÿงš
Okay so that sentence genuinely cuts off at "is ." in the original โ€” not me being sloppy, that's literally how it's written ๐Ÿ˜ญ๐Ÿ’€

See Lapack Working Note 165 for further details and extra cautions. ๐Ÿ““

ERR_BNDS_COMP

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:

             abs(XTRUE(j,i) - X(j,i))
      max_j ----------------------
                  abs(X(j,i))

Componentwise relative error in the ith solution vector โ€” periodt. ๐Ÿ’…

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 threshold sqrt(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 threshold sqrt(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 threshold sqrt(n) * dlamch('Epsilon') to determine if the error estimate is . These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*(A*diag(x)), where x is the solution for the current right-hand side and S scales each row of A*diag(x) by a power of the radix so all absolute row sums of Z are approximately 1. ๐Ÿงš
Same truncated "is ." situation here, bestie โ€” it's in the source, I'm just the messenger ๐Ÿ™ˆ

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 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 extra-precise refinement algorithm.
    • (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 to 100 to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees in err_bnds_norm and err_bnds_comp may no longer be trustworthy. ๐Ÿ’€
  • 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.0 is false.
    • Default: 1.0 (attempt componentwise convergence) ๐ŸŽฏ

WORK

WORK is DOUBLE PRECISION array, dimension (4*N). Scratch space, do not perceive her ๐Ÿซถ

IWORK

IWORK is INTEGER array, dimension (N). Integer scratch space, also not for perceiving ๐Ÿงš

INFO

INFO is INTEGER โ€” the receipts, basically:

  • = 0: successful exit. The solution to every right-hand side is guaranteed. ๐ŸŽ‰
  • < 0: if INFO = -i, the i-th argument had an illegal value. ๐Ÿ™ˆ
  • > 0 and <= N: U(INFO,INFO) is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution and error bounds could not be computed. RCOND = 0 is returned. ๐Ÿ˜ญ
  • = N+J: 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 that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) the Jth right-hand side is the first with either a normwise or componentwise error bound that is not guaranteed (the smallest J such that either ERR_BNDS_NORM(J,1) = 0.0 or ERR_BNDS_COMP(J,1) = 0.0). See the definition of ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information about all of the right-hand sides check ERR_BNDS_NORM or ERR_BNDS_COMP. ๐Ÿ‘‘

๐ŸŒธ Author ๐ŸŒธ

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.


Definition at line 490 of file dposvxx.f. โœจ


๐Ÿฆ‹ subroutine sposvxx ๐Ÿฆ‹

subroutine sposvxx (character fact, character uplo, integer n, integer nrhs,
    real, dimension( lda, * ) a, integer lda, real, dimension( ldaf, * ) af,
    integer ldaf, character equed, real, dimension( * ) s, real, dimension(
    ldb, * ) b, integer ldb, real, dimension( ldx, * ) x, integer ldx, real
    rcond, real rpvgrw, 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)

SPOSVXX computes the solution to system of linear equations A * X = B for PO matrices. ๐Ÿ”ฅ

Purpose

okay so bestie, SPOSVXX is out here using the Cholesky factorization A = U**T*U or A = L*L**T to compute the solution to a real system of linear equations A * X = B, where A is an N-by-N symmetric positive definite matrix and X and B are N-by-NRHS matrices. ๐Ÿ’…

if you ask nicely, it returns both normwise and maximum componentwise error bounds. SPOSVXX will give you a solution with a tiny guaranteed error (O(eps) where eps is the working machine precision) unless the matrix is very ill-conditioned โ€” in which case it throws a warning. relevant condition numbers also get calculated and returned. no cap. โœจ

SPOSVXX also accepts user-provided factorizations and equilibration factors (peep the definitions of the FACT and EQUED options). solving with refinement and using a factorization from a previous SPOSVXX call will also produce a solution with either O(eps) errors or warnings โ€” but we cannot make that claim for general user-provided factorizations and equilibration factors if they differ from what SPOSVXX would itself produce. periodt. ๐Ÿ’€

๐Ÿ’ซ Description ๐Ÿ’ซ

here's the tea, the routine does these steps in order: โ˜•

  1. if FACT = 'E', real scaling factors are computed to equilibrate the system:
diag(S)*A*diag(S)     *inv(diag(S))*X = diag(S)*B

whether or not the system gets equilibrated depends on the scaling of the matrix A, but if equilibration is used, A is overwritten by diag(S)*A*diag(S) and B by diag(S)*B. ๐Ÿฆ‹

  1. if FACT = 'N' or 'E', the Cholesky decomposition factors the matrix A (after equilibration if FACT = 'E') like so:
A = U**T* U,  if UPLO = 'U', or
A = L * L**T,  if UPLO = 'L',

where U is an upper triangular matrix and L is a lower triangular matrix. slay. ๐Ÿ‘‘

  1. if the leading principal minor of order i is not positive, the routine bails with INFO = i. otherwise, the factored form of A is used to estimate the condition number of the matrix A (see argument RCOND). if the reciprocal of the condition number is less than machine precision, the routine still goes on to solve for X and compute error bounds as described below. it's giving resilient. ๐Ÿ’ช
  2. the system of equations is solved for X using the factored form of A. easy peasy. โœจ
  3. by default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero), the routine uses iterative refinement to try to get a small error and error bounds. refinement calculates the residual to at least twice the working precision. highkey obsessed with that. ๐Ÿ”ฅ
  4. if equilibration was used, the matrix X is premultiplied by diag(S) so that it solves the original system before equilibration. and that's the whole glow-up. ๐Ÿ’…

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, you can pass NPARAMS = 0 which prevents the source code from accessing the PARAMS argument. iykyk. ๐ŸŽ€

๐ŸŒธ Parameters ๐ŸŒธ

  • FACT โ€” is CHARACTER*1. specifies whether or not the factored form of the matrix A is supplied on entry, and if not, whether the matrix A should be equilibrated before it is factored.
    • = 'F': on entry, AF contains the factored form of A. if EQUED is not 'N', the matrix A has been equilibrated with scaling factors given by S. A and AF are not modified.
    • = 'N': the matrix A will be copied to AF and factored.
    • = 'E': the matrix A will be equilibrated if necessary, then copied to AF and factored.
  • UPLO โ€” is CHARACTER*1.
    • = 'U': upper triangle of A is stored;
    • = 'L': lower triangle of A is stored.
  • N โ€” is INTEGER. the number of linear equations, i.e., 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 REAL array, dimension (LDA,N). on entry, the symmetric matrix A, except if FACT = 'F' and EQUED = 'Y', then A must contain the equilibrated matrix diag(S)*A*diag(S). 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. A is not modified if FACT = 'F' or 'N', or if FACT = 'E' and EQUED = 'N' on exit.
    • on exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by diag(S)*A*diag(S).
  • LDA โ€” is INTEGER. the leading dimension of the array A. LDA >= max(1,N).
  • AF โ€” is REAL array, dimension (LDAF,N). if FACT = 'F', then AF is an input argument and on entry contains the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T, in the same storage format as A. if EQUED .ne. 'N', then AF is the factored form of the equilibrated matrix diag(S)*A*diag(S).
    • if FACT = 'N', then AF is an output argument and on exit returns the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T of the original matrix A.
    • if FACT = 'E', then AF is an output argument and on exit returns the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T of the equilibrated matrix A (see the description of A for the form of the equilibrated matrix).
  • LDAF โ€” is INTEGER. the leading dimension of the array AF. LDAF >= max(1,N).
  • EQUED โ€” is CHARACTER*1. specifies the form of equilibration that was done.
    • = 'N': no equilibration (always true if FACT = 'N').
    • = 'Y': both row and column equilibration, i.e., A has been replaced by diag(S) * A * diag(S).
    • EQUED is an input argument if FACT = 'F'; otherwise, it is an output argument.
  • S โ€” is REAL array, dimension (N). the row 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 REAL array, dimension (LDB,NRHS). on entry, the N-by-NRHS right hand side matrix B. on exit,
    • if EQUED = 'N', B is not modified;
    • if EQUED = 'Y', B is overwritten by diag(S)*B;
  • LDB โ€” is INTEGER. the leading dimension of the array B. LDB >= max(1,N).
  • X โ€” is REAL array, dimension (LDX,NRHS). if INFO = 0, the N-by-NRHS solution matrix X to the original system of equations. note that A and B are modified on exit if EQUED .ne. 'N', and the solution to the equilibrated system is inv(diag(S))*X.
  • LDX โ€” is INTEGER. the leading dimension of the array X. LDX >= max(1,N).
  • 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.
  • RPVGRW โ€” is REAL. reciprocal pivot growth. on exit, this contains the reciprocal pivot growth factor norm(A)/norm(U). the norm is used. if this is much less than 1, then the stability of the LU factorization of the (equilibrated) matrix A could be poor. this also means that the solution X, estimated condition numbers, and error bounds could be unreliable. if factorization fails with 0<INFO<=N, then this contains the reciprocal pivot growth factor for the leading INFO columns of A.
  • BERR โ€” 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 โ€” 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 a REAL array, dimension (NRHS, N_ERR_BNDS), and bestie, it's the receipts for your answer ๐Ÿ’… For every right-hand side it holds 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 gets indexed by the type of error info, as described below. Right now there are up to three pieces of info coming back at you.

The first index in ERR_BNDS_NORM(i,:) is the i-th right-hand side, periodt.

The second index in ERR_BNDS_NORM(:,err) holds these three fields:

  • err = 1 โ€” a boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(n) * slamch('Epsilon').
  • err = 2 โ€” the 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 threshold sqrt(n) * slamch('Epsilon'). This error bound should only be trusted if the previous boolean is true, no cap.
  • err = 3 โ€” the reciprocal condition number: estimated normwise reciprocal condition number. Compared with the threshold sqrt(n) * slamch('Epsilon') to determine if the error estimate is . (yes, the source just trails off there ๐Ÿ™ˆ not me editing it, it's literally like that). These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*A, where S scales each row by a power of the radix so all absolute row sums of Z are approximately 1.
See Lapack Working Note 165 for further details and extra cautions. Fr fr, there are cautions in there.

ERR_BNDS_COMP is a REAL array, dimension (NRHS, N_ERR_BNDS) โ€” same energy, but this one tracks the componentwise relative error for each right-hand side, 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, iykyk) 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 at all ๐Ÿซถ 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 โ€” a boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(n) * slamch('Epsilon').
  • err = 2 โ€” the 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 threshold sqrt(n) * slamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.
  • err = 3 โ€” the reciprocal condition number: estimated componentwise reciprocal condition number. Compared with the threshold sqrt(n) * slamch('Epsilon') to determine if the error estimate is . (same trailing-off situation as above, iconic honestly). These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*(A*diag(x)), where x is the solution for the current right-hand side and S scales each row of A*diag(x) by a power of the radix so all absolute row sums of Z are approximately 1.
See Lapack Working Note 165 for further details and extra cautions.

NPARAMS is INTEGER and it's giving "how many settings did you actually bring." It specifies the number of parameters set in PARAMS. If <= 0, the PARAMS array is never referenced and default values are used. Lowkey chill of it.

PARAMS is a REAL array, dimension NPARAMS and it 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. Slay, lazy-friendly โœจ

  • 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 support DOUBLE 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 to 100 to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees in err_bnds_norm and err_bnds_comp may no longer be trustworthy ๐Ÿ‘€ so like, proceed with awareness.
  • 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.0 is false. Default: 1.0 (attempt componentwise convergence).

WORK is a REAL array, dimension (4*N). That's the scratch space, don't @ it.

IWORK is an INTEGER array, dimension (N). Integer scratch, same vibe.

INFO is INTEGER and it's the main character of the return values ๐Ÿ‘‘ Here's the whole mood ring:

  • = 0: successful exit. The solution to every right-hand side is guaranteed. We love a clean win ๐Ÿ’–
  • < 0: if INFO = -i, the i-th argument had an illegal value.
  • > 0 and <= N: U(INFO,INFO) is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution and error bounds could not be computed. RCOND = 0 is returned. Not the vibe ๐Ÿ˜ญ
  • = N+J: the solution corresponding to the J-th 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 J-th right-hand side is the first with a normwise error bound that is not guaranteed (the smallest J such that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) the J-th right-hand side is the first with either a normwise or componentwise error bound that is not guaranteed (the smallest J such that either ERR_BNDS_NORM(J,1) = 0.0 or ERR_BNDS_COMP(J,1) = 0.0). See the definition of ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information about all of the right-hand sides check ERR_BNDS_NORM or ERR_BNDS_COMP. Detective work, but make it linear algebra ๐Ÿ”

๐ŸŽ€ Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

Definition at line 493 of file sposvxx.f.


๐ŸŒธ subroutine zposvxx

Like, the complex*16 sibling walked in and ate ๐Ÿ’… Same energy, double precision error bounds, complex*16 everything else:

subroutine zposvxx (character fact, character uplo, integer n, integer nrhs,
    complex*16, dimension( lda, * ) a, integer lda, complex*16, dimension(
    ldaf, * ) af, integer ldaf, character equed, double precision,
    dimension( * ) s, complex*16, dimension( ldb, * ) b, integer ldb,
    complex*16, dimension( ldx, * ) x, integer ldx, double precision rcond,
    double precision rpvgrw, double precision, dimension( * ) berr, integer
    n_err_bnds, double precision, dimension( nrhs, * ) err_bnds_norm, double
    precision, dimension( nrhs, * ) err_bnds_comp, integer nparams, double
    precision, dimension( * ) params, complex*16, dimension( * ) work,
    double precision, dimension( * ) rwork, integer info)

ZPOSVXX computes the solution to system of linear equations A * X = B for PO matrices โœจ

๐Ÿ”ฅ Purpose:

ZPOSVXX uses the Cholesky factorization A = U**T*U or A = L*L**T to compute the solution to a complex*16 system of linear equations A * X = B, where A is an N-by-N Hermitian positive definite matrix and X and B are N-by-NRHS matrices. Obsessed with a factorization that just works ๐Ÿงš

If requested, both normwise and maximum componentwise error bounds are returned. ZPOSVXX will return a solution with a tiny guaranteed error (O(eps) where eps is the working machine precision) unless the matrix is very ill-conditioned, in which case a warning is returned. Relevant condition numbers also are calculated and returned. It's giving overachiever, and we respect it.

ZPOSVXX accepts user-provided factorizations and equilibration factors; see the definitions of the FACT and EQUED options. Solving with refinement and using a factorization from a previous ZPOSVXX call will also produce a solution with either O(eps) errors or warnings, but we cannot make that claim for general user-provided factorizations and equilibration factors if they differ from what ZPOSVXX would itself produce. Translation: DIY factorizations are on you, bestie ๐Ÿ™ˆ

๐ŸŒˆ Description:

โ€ฆand that's where this part dips โ€” more coming, don't go anywhere ๐Ÿฆ‹

  1. Equilibration era โ€” if FACT = 'E', double precision scaling factors are computed to equilibrate the system:
diag(S)*A*diag(S)     *inv(diag(S))*X = diag(S)*B

Whether or not the system actually gets equilibrated depends on the scaling of the matrix A (vibe check on the matrix, basically), but if equilibration is used, A is overwritten by diag(S)*A*diag(S) and B by diag(S)*B. Not a drill, they get overwritten fr.

  1. Cholesky o'clock โ€” if FACT = 'N' or 'E', the Cholesky decomposition is used to factor the matrix A (after equilibration if FACT = 'E') as
A = U**T* U,  if UPLO = 'U', or
A = L * L**T,  if UPLO = 'L',

where U is an upper triangular matrix and L is a lower triangular matrix. Slay, triangular representation.

  1. The minor situation โ€” if the leading principal minor of order i is not positive, then the routine returns with INFO = i. Otherwise, the factored form of A is used to estimate the condition number of the matrix A (see the RCOND glow-up below). If the reciprocal of the condition number is less than machine precision, the routine still goes on to solve for X and compute error bounds as described below. It's giving "we ball" energy but in a numerically responsible way.
  2. Solving for X โ€” the system of equations is solved for X using the factored form of A. Easy, iconic, done.
  3. Iterative refinement arc โ€” by default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero), the routine will use iterative refinement to try to get a small error and error bounds. Refinement calculates the residual to at least twice the working precision. Lowkey overachiever behaviour and we love that for us.
  4. Un-equilibrating โ€” if equilibration was used, the matrix X is premultiplied by diag(S) so that it solves the original system before equilibration. Putting the outfit back on after the fitting, 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. No cap, NPARAMS = 0 is the "leave me and my defaults alone" button.

๐Ÿ’… Parameters ๐Ÿ’…

  • FACT โ€” FACT is CHARACTER*1. Specifies whether or not the factored form of the matrix A is supplied on entry, and if not, whether the matrix A should be equilibrated before it is factored.
    • = 'F': On entry, AF contains the factored form of A. If EQUED is not 'N', the matrix A has been equilibrated with scaling factors given by S. A and AF are not modified.
    • = 'N': The matrix A will be copied to AF and factored.
    • = 'E': The matrix A will be equilibrated if necessary, then copied to AF and factored.
  • UPLO โ€” UPLO is CHARACTER*1.
    • = 'U': Upper triangle of A is stored;
    • = 'L': Lower triangle of A is stored.
  • N โ€” N is INTEGER. The number of linear equations, i.e., the order of the matrix A. N >= 0. Bestie, N is literally the size of the whole situation.
  • 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*16 array, dimension (LDA,N). On entry, the Hermitian matrix A, except if FACT = 'F' and EQUED = 'Y', then A must contain the equilibrated matrix diag(S)*A*diag(S). 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. A is not modified if FACT = 'F' or 'N', or if FACT = 'E' and EQUED = 'N' on exit.

On exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by diag(S)*A*diag(S). ๐Ÿซถ

  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,N).
  • AF โ€” AF is COMPLEX*16 array, dimension (LDAF,N).
    • If FACT = 'F', then AF is an input argument and on entry contains the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T, in the same storage format as A. If EQUED .ne. 'N', then AF is the factored form of the equilibrated matrix diag(S)*A*diag(S).
    • If FACT = 'N', then AF is an output argument and on exit returns the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T of the original matrix A.
    • If FACT = 'E', then AF is an output argument and on exit returns the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T of the equilibrated matrix A (see the description of A for the form of the equilibrated matrix).

So it's input sometimes and output sometimes โ€” main character with range. ๐Ÿ‘‘

  • LDAF โ€” LDAF is INTEGER. The leading dimension of the array AF. LDAF >= max(1,N).
  • EQUED โ€” EQUED is CHARACTER*1. Specifies the form of equilibration that was done.
    • = 'N': No equilibration (always true if FACT = 'N').
    • = 'Y': Both row and column equilibration, i.e., A has been replaced by diag(S) * A * diag(S).

EQUED is an input argument if FACT = 'F'; otherwise, it is an output argument.

  • S โ€” S is DOUBLE PRECISION array, dimension (N). The row 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. Yeah. That part. Don't skip it. ๐Ÿ’€
  • B โ€” B is COMPLEX*16 array, dimension (LDB,NRHS). On entry, the N-by-NRHS right hand side matrix B. On exit,
    • if EQUED = 'N', B is not modified;
    • if EQUED = 'Y', B is overwritten by diag(S)*B.
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • X โ€” X is COMPLEX*16 array, dimension (LDX,NRHS). If INFO = 0, the N-by-NRHS solution matrix X to the original system of equations. Note that A and B are modified on exit if EQUED .ne. 'N', and the solution to the equilibrated system is inv(diag(S))*X. The actual answer is the one to the original system though โ€” remember that plot twist. ๐Ÿฆ‹
  • LDX โ€” LDX is INTEGER. The leading dimension of the array X. LDX >= max(1,N).
  • RCOND โ€” 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. So a tiny RCOND is not automatically a disaster โ€” it's giving "don't panic, but do pay attention". ๐Ÿ˜ญ
  • RPVGRW โ€” RPVGRW is DOUBLE PRECISION. Reciprocal pivot growth. On exit, this contains the reciprocal pivot growth factor norm(A)/norm(U). The norm is used. If this is much less than 1, then the stability of the LU factorization of the (equilibrated) matrix A could be poor. This also means that the solution X, estimated condition numbers, and error bounds could be unreliable. If factorization fails with 0<INFO<=N, then this contains the reciprocal pivot growth factor for the leading INFO columns of A. If RPVGRW is acting suspicious, the whole answer is suspect โ€” periodt.
  • BERR โ€” 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). Small BERR = good vibes, certified.
  • 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 a DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS) โ€” and bestie, this thing is packed with lore. For every right-hand side, it holds info about the various error bounds and condition numbers that go with 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, and right now there are up to three pieces of info returned. Slay.

The first index in ERR_BNDS_NORM(i,:) corresponds to the *i*th right-hand side. Simple as that.

The second index in ERR_BNDS_NORM(:,err) contains the following three fields:

  • err = 1 โ€” a boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(n) * dlamch('Epsilon').
  • err = 2 โ€” the 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 threshold sqrt(n) * dlamch('Epsilon'). This error bound should only be trusted if the previous boolean is true. (Yeah, it's giving two-step verification โ€” you need both or the whole thing is a vibe and not a fact.)
  • err = 3 โ€” the reciprocal condition number: estimated normwise reciprocal condition number. Compared with the threshold sqrt(n) * dlamch('Epsilon') to determine if the error estimate is . [not me staring at the source โ€” it literally trails off there, that's how it shipped ๐Ÿ™ˆ] These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*A, where S scales each row by a power of the radix so all absolute row sums of Z are approximately 1.

See Lapack Working Note 165 for further details and extra cautions. ๐Ÿ‘‘


๐Ÿ’– ERR_BNDS_COMP

ERR_BNDS_COMP is a DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS). For each right-hand side, this one carries info about the various error bounds and condition numbers corresponding to the componentwise relative error, defined like so:

     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 (because the componentwise relative error depends on it, iykyk) 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 at all โ€” she stays home. 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 the following three fields:

  • err = 1 โ€” a boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(n) * dlamch('Epsilon').
  • err = 2 โ€” the 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 threshold sqrt(n) * dlamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.
  • err = 3 โ€” the reciprocal condition number: estimated componentwise reciprocal condition number. Compared with the threshold sqrt(n) * dlamch('Epsilon') to determine if the error estimate is . [again, the source just โœจendsโœจ there, iconic behaviour honestly] These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*(A*diag(x)), where x is the solution for the current right-hand side and S scales each row of A*diag(x) by a power of the radix so all absolute row sums of Z are approximately 1.

See Lapack Working Note 165 for further details and extra cautions. ๐Ÿซถ


๐ŸŒธ NPARAMS

NPARAMS is INTEGER. It specifies the number of parameters set in PARAMS. If it's <= 0, the PARAMS array is never even referenced and default values are used โ€” she's not nosy like that.


๐ŸŽ€ PARAMS

PARAMS is a DOUBLE PRECISION array, dimension NPARAMS. It specifies the algorithm parameters. If an entry is < 0.0, then that entry will be filled in with the default value used for that parameter (the manpage equivalent of "you decide, bestie"). Only positions up to NPARAMS are accessed; defaults are used for higher-numbered parameters.

  • PARAMS(LA_LINRX_ITREF_I = 1) โ€” whether to perform iterative refinement or not. Default: 1.0D+0
    • = 0.0: no refinement is performed, and no error bounds are computed.
    • = 1.0: use the extra-precise refinement algorithm.
    • (other values are reserved for future use ๐Ÿ‘€)
  • PARAMS(LA_LINRX_ITHRESH_I = 2) โ€” maximum number of residual computations allowed for refinement. Default: 10 Aggressive: set to 100 to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees in err_bnds_norm and err_bnds_comp may no longer be trustworthy. So likeโ€ฆ proceed with caution, babe.
  • 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.0 is false. Default: 1.0 (attempt componentwise convergence)

๐Ÿฆ‹ WORK

WORK is a COMPLEX*16 array, dimension (2*N). That's it, that's the whole vibe.


๐Ÿ’œ RWORK

RWORK is a DOUBLE PRECISION array, dimension (2*N). Also just existing, unbothered.


๐Ÿ”ฅ INFO

INFO is INTEGER, and this is the one you actually read:

  • = 0: successful exit. The solution to every right-hand side is guaranteed. we love a clean run โœจ
  • < 0: if INFO = -i, the *i*th argument had an illegal value.
  • > 0 and <= N: U(INFO,INFO) is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution and error bounds could not be computed. RCOND = 0 is returned.
  • = N+J: the solution corresponding to the *J*th 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 *J*th right-hand side is the first with a normwise error bound that is not guaranteed (the smallest J such that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) the *J*th right-hand side is the first with either a normwise or componentwise error bound that is not guaranteed (the smallest J such that either ERR_BNDS_NORM(J,1) = 0.0 or ERR_BNDS_COMP(J,1) = 0.0). See the definition of ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information about all of the right-hand sides check ERR_BNDS_NORM or ERR_BNDS_COMP. ๐Ÿ’…

๐Ÿ‘‘ Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

Definition at line 489 of file zposvxx.f.

โœจ Author

Generated automatically by Doxygen for LAPACK from the source code. (so if the grammar is weird, blame the robot, not me ๐Ÿ˜ญ)


and that's the whole page bestie, you ate that ๐Ÿ“ โ€” this masterpiece is from LAPACK, Version 3.12.0, and the page itself is posvxx(3). go forth and condition your numbers ๐Ÿ’–

๐Ÿ“ฆ where this page comes from