* equations 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_N and ERR_BNDS_C for details of the error
-* bounds.
+* 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, R
* equations 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_N and ERR_BNDS_C for details of the error
-* bounds.
+* 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, R
- Subroutine CHERFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, IPIV,
+ 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 )
* 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_N and ERR_BNDS_C for details of the error bounds.
+* 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
* IPIV (input or output) INTEGER array, dimension (N)
* If FACT = 'F', then IPIV is an input argument and on entry
* contains details of the interchanges and the block
-* structure of D, as determined by SSYTRF. If IPIV(k) > 0,
+* structure of D, as determined by CHETRF. If IPIV(k) > 0,
* then rows and columns k and IPIV(k) were interchanged and
* D(k,k) is a 1-by-1 diagonal block. If UPLO = 'U' and
* IPIV(k) = IPIV(k-1) < 0, then rows and columns k-1 and
*
* If FACT = 'N', then IPIV is an output argument and on exit
* contains details of the interchanges and the block
-* structure of D, as determined by SSYTRF.
+* structure of D, as determined by CHETRF.
*
* EQUED (input or output) CHARACTER*1
* Specifies the form of equilibration that was done.
* Arguments
* =========
*
-* C REAL vector.
+* TRANS (input) CHARACTER*1
+* Specifies the form of the system of equations:
+* = 'N': A * X = B (No transpose)
+* = 'T': A**T * X = B (Transpose)
+* = 'C': A**H * X = B (Conjugate Transpose = Transpose)
*
-* WORK COMPLEX workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK REAL workspace of size N.
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0.
+*
+* AB (input) COMPLEX array, dimension (LDAB,N)
+* On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
+* The j-th column of A is stored in the j-th column of the
+* array AB as follows:
+* AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
+*
+* LDAB (input) INTEGER
+* The leading dimension of the array AB. LDAB >= KL+KU+1.
+*
+* AFB (input) COMPLEX array, dimension (LDAFB,N)
+* Details of the LU factorization of the band matrix A, as
+* computed by CGBTRF. U is stored as an upper triangular
+* band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
+* and the multipliers used during the factorization are stored
+* in rows KL+KU+2 to 2*KL+KU+1.
+*
+* LDAFB (input) INTEGER
+* The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by CGBTRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* C (input) REAL array, dimension (N)
+* The vector C in the formula op(A) * inv(diag(C)).
+*
+* CAPPLY (input) LOGICAL
+* If .TRUE. then access the vector C in the formula above.
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) REAL array, dimension (N).
+* Workspace.
*
* =====================================================================
*
NOTRANS = LSAME( TRANS, 'N' )
IF ( .NOT. NOTRANS .AND. .NOT. LSAME( TRANS, 'T' ) .AND. .NOT.
$ LSAME( TRANS, 'C' ) ) THEN
+ INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( KL.LT.0 .OR. KL.GT.N-1 ) THEN
- INFO = -4
+ INFO = -3
ELSE IF( KU.LT.0 .OR. KU.GT.N-1 ) THEN
- INFO = -5
+ INFO = -4
ELSE IF( LDAB.LT.KL+KU+1 ) THEN
- INFO = -8
+ INFO = -6
ELSE IF( LDAFB.LT.2*KL+KU+1 ) THEN
- INFO = -10
+ INFO = -8
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'CLA_GBRCOND_C', -INFO )
* Arguments
* =========
*
-* X COMPLEX vector.
+* TRANS (input) CHARACTER*1
+* Specifies the form of the system of equations:
+* = 'N': A * X = B (No transpose)
+* = 'T': A**T * X = B (Transpose)
+* = 'C': A**H * X = B (Conjugate Transpose = Transpose)
*
-* WORK COMPLEX workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK REAL workspace of size N.
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0.
+*
+* AB (input) COMPLEX array, dimension (LDAB,N)
+* On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
+* The j-th column of A is stored in the j-th column of the
+* array AB as follows:
+* AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
+*
+* LDAB (input) INTEGER
+* The leading dimension of the array AB. LDAB >= KL+KU+1.
+*
+* AFB (input) COMPLEX array, dimension (LDAFB,N)
+* Details of the LU factorization of the band matrix A, as
+* computed by CGBTRF. U is stored as an upper triangular
+* band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
+* and the multipliers used during the factorization are stored
+* in rows KL+KU+2 to 2*KL+KU+1.
+*
+* LDAFB (input) INTEGER
+* The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by CGBTRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* X (input) COMPLEX array, dimension (N)
+* The vector X in the formula op(A) * diag(X).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) REAL array, dimension (N).
+* Workspace.
*
* =====================================================================
*
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( KL.LT.0 .OR. KL.GT.N-1 ) THEN
- INFO = -4
+ INFO = -3
ELSE IF( KU.LT.0 .OR. KU.GT.N-1 ) THEN
- INFO = -5
+ INFO = -4
ELSE IF( LDAB.LT.KL+KU+1 ) THEN
- INFO = -8
+ INFO = -6
ELSE IF( LDAFB.LT.2*KL+KU+1 ) THEN
- INFO = -10
+ INFO = -8
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'CLA_GBRCOND_X', -INFO )
SUBROUTINE CLA_GBRFSX_EXTENDED ( PREC_TYPE, TRANS_TYPE, N, KL, KU,
$ NRHS, AB, LDAB, AFB, LDAFB, IPIV,
$ COLEQU, C, B, LDB, Y, LDY,
- $ BERR_OUT, N_NORMS, ERRS_N, ERRS_C,
- $ RES, AYB, DY, Y_TAIL, RCOND,
- $ ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ BERR_OUT, N_NORMS, ERR_BNDS_NORM,
+ $ ERR_BNDS_COMP, RES, AYB, DY,
+ $ Y_TAIL, RCOND, ITHRESH, RTHRESH,
+ $ DZ_UB, IGNORE_CWISE, INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
COMPLEX AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
$ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
REAL C( * ), AYB(*), RCOND, BERR_OUT( * ),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
*
-* CLA_GBRFSX_EXTENDED computes ... .
+* CLA_GBRFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by CGBRFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* TRANS_TYPE (input) INTEGER
+* Specifies the transposition operation on A.
+* The value is defined by ILATRANS(T) where T is a CHARACTER and
+* T = 'N': No transpose
+* = 'T': Transpose
+* = 'C': Conjugate transpose
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* AB (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDAB (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AFB (input) COMPLEX array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by CGBTRF.
+*
+* LDAFB (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by CGBTRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) REAL array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) COMPLEX array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) COMPLEX array, dimension (LDY,NRHS)
+* On entry, the solution matrix X, as computed by CGBTRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) REAL array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by CLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) 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 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) 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 .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) COMPLEX array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) REAL array, dimension (N)
+* Workspace.
+*
+* DY (input) COMPLEX array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) COMPLEX array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) REAL
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) REAL
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to CGBTRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Compute error bounds.
*
IF ( N_NORMS .GE. 1 ) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF ( N_NORMS .GE. 2 ) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
*
* Purpose
* =======
-*
-* CLA_GBRPVGRW computes ... .
+*
+* CLA_GBRPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* AB (input) COMPLEX array, dimension (LDAB,N)
+* On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
+* The j-th column of A is stored in the j-th column of the
+* array AB as follows:
+* AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
+*
+* LDAB (input) INTEGER
+* The leading dimension of the array AB. LDAB >= KL+KU+1.
+*
+* AFB (input) COMPLEX array, dimension (LDAFB,N)
+* Details of the LU factorization of the band matrix A, as
+* computed by CGBTRF. U is stored as an upper triangular
+* band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
+* and the multipliers used during the factorization are stored
+* in rows KL+KU+2 to 2*KL+KU+1.
+*
+* LDAFB (input) INTEGER
+* The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.
+*
* =====================================================================
*
* .. Local Scalars ..
* .. Executable Statements ..
*
RPVGRW = 1.0
-*
+
KD = KU + 1
DO J = 1, NCOLS
AMAX = 0.0
* Arguments
* =========
*
-* C REAL vector.
+* TRANS (input) CHARACTER*1
+* Specifies the form of the system of equations:
+* = 'N': A * X = B (No transpose)
+* = 'T': A**T * X = B (Transpose)
+* = 'C': A**H * X = B (Conjugate Transpose = Transpose)
*
-* WORK COMPLEX workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK REAL workspace of size N.
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by CGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by CGETRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* C (input) REAL array, dimension (N)
+* The vector C in the formula op(A) * inv(diag(C)).
+*
+* CAPPLY (input) LOGICAL
+* If .TRUE. then access the vector C in the formula above.
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) REAL array, dimension (N).
+* Workspace.
*
* =====================================================================
*
* Arguments
* =========
*
-* X COMPLEX vector.
+* TRANS (input) CHARACTER*1
+* Specifies the form of the system of equations:
+* = 'N': A * X = B (No transpose)
+* = 'T': A**T * X = B (Transpose)
+* = 'C': A**H * X = B (Conjugate Transpose = Transpose)
*
-* WORK COMPLEX workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK REAL workspace of size N.
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by CGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by CGETRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* X (input) COMPLEX array, dimension (N)
+* The vector X in the formula op(A) * diag(X).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) REAL array, dimension (N).
+* Workspace.
*
* =====================================================================
*
* Purpose
* =======
*
-* CLA_GERFSX_EXTENDED computes ... .
+* CLA_GERFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by CGERFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* TRANS_TYPE (input) INTEGER
+* Specifies the transposition operation on A.
+* The value is defined by ILATRANS(T) where T is a CHARACTER and
+* T = 'N': No transpose
+* = 'T': Transpose
+* = 'C': Conjugate transpose
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by CGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by CGETRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) REAL array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) COMPLEX array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) COMPLEX array, dimension (LDY,NRHS)
+* On entry, the solution matrix X, as computed by CGETRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) REAL array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by CLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) 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 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) 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 .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) COMPLEX array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) REAL array, dimension (N)
+* Workspace.
+*
+* DY (input) COMPLEX array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) COMPLEX array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) REAL
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) REAL
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to CGETRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Arguments
* =========
*
-* C REAL vector.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* WORK COMPLEX workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK REAL workspace of size N.
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by CHETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by CHETRF.
+*
+* C (input) REAL array, dimension (N)
+* The vector C in the formula op(A) * inv(diag(C)).
+*
+* CAPPLY (input) LOGICAL
+* If .TRUE. then access the vector C in the formula above.
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) REAL array, dimension (N).
+* Workspace.
*
* =====================================================================
*
* Arguments
* =========
*
-* X COMPLEX vector.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* WORK COMPLEX workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK REAL workspace of size N.
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by CHETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by CHETRF.
+*
+* X (input) COMPLEX array, dimension (N)
+* The vector X in the formula op(A) * diag(X).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) REAL array, dimension (N).
+* Workspace.
*
* =====================================================================
*
SUBROUTINE CLA_HERFSX_EXTENDED( PREC_TYPE, UPLO, N, NRHS, A, LDA,
$ AF, LDAF, IPIV, COLEQU, C, B, LDB,
- $ Y, LDY, BERR_OUT, N_NORMS, ERRS_N,
- $ ERRS_C, RES, AYB, DY, Y_TAIL,
- $ RCOND, ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ Y, LDY, BERR_OUT, N_NORMS,
+ $ ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
+ $ AYB, DY, Y_TAIL, RCOND, ITHRESH,
+ $ RTHRESH, DZ_UB, IGNORE_CWISE,
+ $ INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
COMPLEX A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
$ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
REAL C( * ), AYB( * ), RCOND, BERR_OUT( * ),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
-*
-* CLA_HERFSX_EXTENDED computes ... .
+*
+* CLA_HERFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by CHERFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by CHETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by CHETRF.
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) REAL array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) COMPLEX array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) COMPLEX array, dimension
+* (LDY,NRHS)
+* On entry, the solution matrix X, as computed by CHETRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) REAL array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by CLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) 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 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) 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 .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) COMPLEX array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) REAL array, dimension (N)
+* Workspace.
+*
+* DY (input) COMPLEX array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) COMPLEX array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) REAL
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) REAL
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to CHETRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Compute error bounds.
*
IF ( N_NORMS .GE. 1 ) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF (N_NORMS .GE. 2) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
* Purpose
* =======
*
-* CLA_HERPVGRW computes ... .
+* CLA_HERPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* INFO (input) INTEGER
+* The value of INFO returned from SSYTRF, .i.e., the pivot in
+* column INFO is exactly 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by CHETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by CHETRF.
+*
+* WORK (input) COMPLEX array, dimension (2*N)
+*
* =====================================================================
*
* .. Local Scalars ..
* Purpose
* =======
*
-* CLA_LIN_BERR computes component-wise relative backward error from
+* CLA_LIN_BERR computes componentwise relative backward error from
* the formula
* max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
-* where abs(Z) is the component-wise absolute value of the matrix
+* where abs(Z) is the componentwise absolute value of the matrix
* or vector Z.
*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NZ (input) INTEGER
+* We add (NZ+1)*SLAMCH( 'Safe minimum' ) to R(i) in the numerator to
+* guard against spuriously zero residuals. Default value is N.
+*
+* NRHS (input) INTEGER
+* The number of right hand sides, i.e., the number of columns
+* of the matrices AYB, RES, and BERR. NRHS >= 0.
+*
+* RES (input) DOUBLE PRECISION array, dimension (N,NRHS)
+* The residual matrix, i.e., the matrix R in the relative backward
+* error formula above.
+*
+* AYB (input) DOUBLE PRECISION array, dimension (N, NRHS)
+* The denominator in the relative backward error formula above, i.e.,
+* the matrix abs(op(A_s))*abs(Y) + abs(B_s). The matrices A, Y, and B
+* are from iterative refinement (see cla_gerfsx_extended.f).
+*
+* RES (output) COMPLEX array, dimension (NRHS)
+* The componentwise relative backward error from the formula above.
+*
* =====================================================================
*
* .. Local Scalars ..
* Arguments
* =========
*
-* C REAL vector.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* WORK COMPLEX workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK REAL workspace of size N.
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by CPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* C (input) REAL array, dimension (N)
+* The vector C in the formula op(A) * inv(diag(C)).
+*
+* CAPPLY (input) LOGICAL
+* If .TRUE. then access the vector C in the formula above.
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) REAL array, dimension (N).
+* Workspace.
*
* =====================================================================
*
* Arguments
* =========
*
-* X COMPLEX vector.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* WORK COMPLEX workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK REAL workspace of size N.
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by CPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* X (input) COMPLEX array, dimension (N)
+* The vector X in the formula op(A) * diag(X).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) REAL array, dimension (N).
+* Workspace.
*
* =====================================================================
*
SUBROUTINE CLA_PORFSX_EXTENDED( PREC_TYPE, UPLO, N, NRHS, A, LDA,
$ AF, LDAF, COLEQU, C, B, LDB, Y,
- $ LDY, BERR_OUT, N_NORMS, ERRS_N,
- $ ERRS_C, RES, AYB, DY, Y_TAIL,
- $ RCOND, ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ LDY, BERR_OUT, N_NORMS,
+ $ ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
+ $ AYB, DY, Y_TAIL, RCOND, ITHRESH,
+ $ RTHRESH, DZ_UB, IGNORE_CWISE,
+ $ INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
COMPLEX A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
$ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
REAL C( * ), AYB( * ), RCOND, BERR_OUT( * ),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
-*
-* CLA_PORFSX_EXTENDED computes ... .
+*
+* CLA_PORFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by CPORFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by CPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) REAL array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) COMPLEX array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) COMPLEX array, dimension
+* (LDY,NRHS)
+* On entry, the solution matrix X, as computed by CPOTRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) REAL array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by CLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) 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 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) 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 .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) COMPLEX array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) REAL array, dimension (N)
+* Workspace.
+*
+* DY (input) COMPLEX array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) COMPLEX array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) REAL
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) REAL
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to CPOTRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Compute error bounds.
*
IF (N_NORMS .GE. 1) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF (N_NORMS .GE. 2) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
* Purpose
* =======
*
-* CLA_PORPVGRW computes ... .
+* CLA_PORPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by CPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* WORK (input) COMPLEX array, dimension (2*N)
+*
* =====================================================================
*
* .. Local Scalars ..
* Purpose
* =======
*
-* CLA_RPVGRW computes ... .
+* CLA_RPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by CGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
* =====================================================================
*
* .. Local Scalars ..
* .. Executable Statements ..
*
RPVGRW = 1.0
-*
+
DO J = 1, NCOLS
AMAX = 0.0
UMAX = 0.0
* Arguments
* =========
*
-* C REAL vector.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* WORK COMPLEX workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK REAL workspace of size N.
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by CSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by CSYTRF.
+*
+* C (input) REAL array, dimension (N)
+* The vector C in the formula op(A) * inv(diag(C)).
+*
+* CAPPLY (input) LOGICAL
+* If .TRUE. then access the vector C in the formula above.
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) REAL array, dimension (N).
+* Workspace.
*
* =====================================================================
*
* Arguments
* =========
*
-* X COMPLEX vector.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* WORK COMPLEX workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK REAL workspace of size N.
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by CSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by CSYTRF.
+*
+* X (input) COMPLEX array, dimension (N)
+* The vector X in the formula op(A) * diag(X).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) REAL array, dimension (N).
+* Workspace.
*
* =====================================================================
*
SUBROUTINE CLA_SYRFSX_EXTENDED( PREC_TYPE, UPLO, N, NRHS, A, LDA,
$ AF, LDAF, IPIV, COLEQU, C, B, LDB,
- $ Y, LDY, BERR_OUT, N_NORMS, ERRS_N,
- $ ERRS_C, RES, AYB, DY, Y_TAIL,
- $ RCOND, ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ Y, LDY, BERR_OUT, N_NORMS,
+ $ ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
+ $ AYB, DY, Y_TAIL, RCOND, ITHRESH,
+ $ RTHRESH, DZ_UB, IGNORE_CWISE,
+ $ INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
COMPLEX A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
$ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
REAL C( * ), AYB( * ), RCOND, BERR_OUT( * ),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
-*
-* CLA_SYRFSX_EXTENDED computes ... .
+*
+* CLA_SYRFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by CSYRFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by CSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by CSYTRF.
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) REAL array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) COMPLEX array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) COMPLEX array, dimension
+* (LDY,NRHS)
+* On entry, the solution matrix X, as computed by CSYTRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) REAL array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by CLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) 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 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) 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 .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) COMPLEX array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) REAL array, dimension (N)
+* Workspace.
+*
+* DY (input) COMPLEX array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) COMPLEX array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) REAL
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) REAL
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to CSYTRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Compute error bounds.
*
IF ( N_NORMS .GE. 1 ) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF ( N_NORMS .GE. 2 ) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
* Purpose
* =======
*
-* CLA_SYRPVGRW computes ... .
+* CLA_SYRPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* INFO (input) INTEGER
+* The value of INFO returned from CSYTRF, .i.e., the pivot in
+* column INFO is exactly 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) COMPLEX array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by CSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by CSYTRF.
+*
+* WORK (input) COMPLEX array, dimension (2*N)
+*
* =====================================================================
*
* .. Local Scalars ..
*
* CLARSCL2 performs a reciprocal diagonal scaling on an vector:
* x <-- inv(D) * x
-* where the diagonal matrix D is stored as a vector.
-* Eventually to be replaced by BLAS_sge_diag_scale in the new BLAS
+* where the REAL diagonal matrix D is stored as a vector.
+*
+* Eventually to be replaced by BLAS_cge_diag_scale in the new BLAS
* standard.
*
* Arguments
* =========
-* N (input) INTEGER
-* The size of the vectors X and D.
-*
-* D (input) REAL array, length N
-* Diagonal matrix D, stored as a vector of length N.
-* X (input/output) COMPLEX array, length N
-* On entry, the vector X to be scaled by D.
-* On exit, the scaled vector.
-* ..
+*
+* M (input) INTEGER
+* The number of rows of D and X. M >= 0.
+*
+* N (input) INTEGER
+* The number of columns of D and X. N >= 0.
+*
+* D (input) REAL array, length M
+* Diagonal matrix D, stored as a vector of length M.
+*
+* X (input/output) COMPLEX array, dimension (LDX,N)
+* On entry, the vector X to be scaled by D.
+* On exit, the scaled vector.
+*
+* LDX (input) INTEGER
+* The leading dimension of the vector X. LDX >= 0.
+*
+* =====================================================================
+*
* .. Local Scalars ..
INTEGER I, J
* ..
*
DO J = 1, N
DO I = 1, M
- X(I,J) = X(I,J) / D(I)
+ X( I, J ) = X( I, J ) / D( I )
END DO
END DO
-*
+
RETURN
END
-*
+
*
* CLASCL2 performs a diagonal scaling on a vector:
* x <-- D * x
-* where the diagonal matrix D is stored as a vector.
-* Eventually to be replaced by BLAS_sge_diag_scale in the new BLAS
+* where the diagonal REAL matrix D is stored as a vector.
+*
+* Eventually to be replaced by BLAS_cge_diag_scale in the new BLAS
* standard.
*
* Arguments
* =========
-* N (input) INTEGER
-* The size of the vectors X and D.
-*
-* D (input) REAL array, length N
-* Diagonal matrix D, stored as a vector of length N.
-* X (input/output) COMPLEX array, length N
-* On entry, the vector X to be scaled by D.
-* On exit, the scaled vector.
-* ..
+*
+* M (input) INTEGER
+* The number of rows of D and X. M >= 0.
+*
+* N (input) INTEGER
+* The number of columns of D and X. N >= 0.
+*
+* D (input) REAL array, length M
+* Diagonal matrix D, stored as a vector of length M.
+*
+* X (input/output) COMPLEX array, dimension (LDX,N)
+* On entry, the vector X to be scaled by D.
+* On exit, the scaled vector.
+*
+* LDX (input) INTEGER
+* The leading dimension of the vector X. LDX >= 0.
+*
+* =====================================================================
+*
* .. Local Scalars ..
INTEGER I, J
* ..
*
DO J = 1, N
DO I = 1, M
- X(I,J) = X(I,J) * D(I)
+ X( I, J ) = X( I, J ) * D( I )
END DO
END DO
-*
+
RETURN
END
-*
+
- Subroutine CPORFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, S, B,
+ SUBROUTINE CPORFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, S, B,
$ LDB, X, LDX, RCOND, BERR, N_ERR_BNDS,
$ ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
$ WORK, RWORK, INFO )
* definite, and provides error bounds and backward error estimates
* for the solution. In addition to normwise error bound, the code
* provides maximum componentwise error bound if possible. See
-* comments for ERR_BNDS for details of the error bounds.
+* 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
- Subroutine CSYRFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, IPIV,
+ 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 )
* 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_N and ERR_BNDS_C for details of the error bounds.
+* 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
* = 'E': The matrix A will be equilibrated if necessary, then
* copied to AF and factored.
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
* N (input) INTEGER
* The number of linear equations, i.e., the order of the
* matrix A. N >= 0.
* equations 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_N and ERR_BNDS_C for details of the error
-* bounds.
+* 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, R
* equations 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_N and ERR_BNDS_C for details of the error
-* bounds.
+* 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, R
DOUBLE PRECISION FUNCTION DLA_GBRCOND( TRANS, N, KL, KU, AB, LDAB,
- $ AFB, LDAFB, IPIV, CMODE, C, INFO,
- $ WORK, IWORK )
+ $ AFB, LDAFB, IPIV, CMODE, C,
+ $ INFO, WORK, IWORK )
*
* -- LAPACK routine (version 3.2.1) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Arguments
* =========
*
-* WORK double precision workspace of size 5*N.
+* TRANS (input) CHARACTER*1
+* Specifies the form of the system of equations:
+* = 'N': A * X = B (No transpose)
+* = 'T': A**T * X = B (Transpose)
+* = 'C': A**H * X = B (Conjugate Transpose = Transpose)
*
-* IWORK integer workspace of size N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0.
+*
+* AB (input) DOUBLE PRECISION array, dimension (LDAB,N)
+* On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
+* The j-th column of A is stored in the j-th column of the
+* array AB as follows:
+* AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
+*
+* LDAB (input) INTEGER
+* The leading dimension of the array AB. LDAB >= KL+KU+1.
+*
+* AFB (input) DOUBLE PRECISION array, dimension (LDAFB,N)
+* Details of the LU factorization of the band matrix A, as
+* computed by DGBTRF. U is stored as an upper triangular
+* band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
+* and the multipliers used during the factorization are stored
+* in rows KL+KU+2 to 2*KL+KU+1.
+*
+* LDAFB (input) INTEGER
+* The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by DGBTRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* CMODE (input) INTEGER
+* Determines op2(C) in the formula op(A) * op2(C) as follows:
+* CMODE = 1 op2(C) = C
+* CMODE = 0 op2(C) = I
+* CMODE = -1 op2(C) = inv(C)
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The vector C in the formula op(A) * op2(C).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) DOUBLE PRECISION array, dimension (5*N).
+* Workspace.
+*
+* IWORK (input) INTEGER array, dimension (N).
+* Workspace.
*
* =====================================================================
*
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( KL.LT.0 .OR. KL.GT.N-1 ) THEN
- INFO = -4
+ INFO = -3
ELSE IF( KU.LT.0 .OR. KU.GT.N-1 ) THEN
- INFO = -5
+ INFO = -4
ELSE IF( LDAB.LT.KL+KU+1 ) THEN
- INFO = -8
+ INFO = -6
ELSE IF( LDAFB.LT.2*KL+KU+1 ) THEN
- INFO = -10
+ INFO = -8
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'DLA_GBRCOND', -INFO )
SUBROUTINE DLA_GBRFSX_EXTENDED( PREC_TYPE, TRANS_TYPE, N, KL, KU,
$ NRHS, AB, LDAB, AFB, LDAFB, IPIV,
$ COLEQU, C, B, LDB, Y, LDY,
- $ BERR_OUT, N_NORMS, ERRS_N, ERRS_C,
- $ RES, AYB, DY, Y_TAIL, RCOND,
- $ ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ BERR_OUT, N_NORMS, ERR_BNDS_NORM,
+ $ ERR_BNDS_COMP, RES, AYB, DY,
+ $ Y_TAIL, RCOND, ITHRESH, RTHRESH,
+ $ DZ_UB, IGNORE_CWISE, INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
DOUBLE PRECISION AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
$ Y( LDY, * ), RES(*), DY(*), Y_TAIL(*)
DOUBLE PRECISION C( * ), AYB(*), RCOND, BERR_OUT(*),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
*
-* DLA_GBRFSX_EXTENDED computes ... .
+* DLA_GBRFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by DGBRFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* TRANS_TYPE (input) INTEGER
+* Specifies the transposition operation on A.
+* The value is defined by ILATRANS(T) where T is a CHARACTER and
+* T = 'N': No transpose
+* = 'T': Transpose
+* = 'C': Conjugate transpose
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) DOUBLE PRECISION array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) DOUBLE PRECISION array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by DGBTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by DGBTRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) DOUBLE PRECISION array, dimension
+* (LDY,NRHS)
+* On entry, the solution matrix X, as computed by DGBTRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) DOUBLE PRECISION array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by DLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* normwise relative error, which is defined as follows:
+*
+* Normwise relative error in the ith solution vector:
+* max_j (abs(XTRUE(j,i) - X(j,i)))
+* ------------------------------
+* max_j abs(X(j,i))
+*
+* The array is indexed by the type of error information as described
+* below. There currently are up to three pieces of information
+* returned.
+*
+* The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_NORM(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* componentwise relative error, which is defined as follows:
+*
+* Componentwise relative error in the ith solution vector:
+* abs(XTRUE(j,i) - X(j,i))
+* max_j ----------------------
+* abs(X(j,i))
+*
+* The array is indexed by the right-hand side i (on which the
+* componentwise relative error depends), and the type of error
+* information as described below. There currently are up to three
+* pieces of information returned for each right-hand side. If
+* componentwise accuracy is not requested (PARAMS(3) = 0.0), then
+* ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) DOUBLE PRECISION array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) DOUBLE PRECISION array, dimension (N)
+* Workspace. This can be the same workspace passed for Y_TAIL.
+*
+* DY (input) DOUBLE PRECISION array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) DOUBLE PRECISION array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) DOUBLE PRECISION
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) DOUBLE PRECISION
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to DGBTRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Compute error bounds.
*
IF ( N_NORMS .GE. 1 ) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF (N_NORMS .GE. 2) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
- DOUBLE PRECISION FUNCTION DLA_GBRPVGRW( N, KL, KU, NCOLS, AB,
- $ LDAB, AFB, LDAFB )
+ DOUBLE PRECISION FUNCTION DLA_GBRPVGRW( N, KL, KU, NCOLS, AB,
+ $ LDAB, AFB, LDAFB )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
*
* Purpose
* =======
-*
-* DLA_GBRPVGRW computes ... .
+*
+* DLA_GBRPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* AB (input) DOUBLE PRECISION array, dimension (LDAB,N)
+* On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
+* The j-th column of A is stored in the j-th column of the
+* array AB as follows:
+* AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
+*
+* LDAB (input) INTEGER
+* The leading dimension of the array AB. LDAB >= KL+KU+1.
+*
+* AFB (input) DOUBLE PRECISION array, dimension (LDAFB,N)
+* Details of the LU factorization of the band matrix A, as
+* computed by DGBTRF. U is stored as an upper triangular
+* band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
+* and the multipliers used during the factorization are stored
+* in rows KL+KU+2 to 2*KL+KU+1.
+*
+* LDAFB (input) INTEGER
+* The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.
+*
* =====================================================================
*
* .. Local Scalars ..
* .. Executable Statements ..
*
RPVGRW = 1.0D+0
-*
+
KD = KU + 1
DO J = 1, NCOLS
AMAX = 0.0D+0
- DOUBLE PRECISION FUNCTION DLA_GERCOND ( TRANS, N, A, LDA, AF,
- $ LDAF, IPIV, CMODE, C, INFO, WORK,
- $ IWORK )
+ DOUBLE PRECISION FUNCTION DLA_GERCOND ( TRANS, N, A, LDA, AF,
+ $ LDAF, IPIV, CMODE, C,
+ $ INFO, WORK, IWORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Arguments
* ==========
*
-* WORK DOUBLE PRECISION workspace of size 3*N, and
+* TRANS (input) CHARACTER*1
+* Specifies the form of the system of equations:
+* = 'N': A * X = B (No transpose)
+* = 'T': A**T * X = B (Transpose)
+* = 'C': A**H * X = B (Conjugate Transpose = Transpose)
*
-* IWORK INTEGER workspace of size N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* A (input) DOUBLE PRECISION array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) DOUBLE PRECISION array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by DGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by DGETRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* CMODE (input) INTEGER
+* Determines op2(C) in the formula op(A) * op2(C) as follows:
+* CMODE = 1 op2(C) = C
+* CMODE = 0 op2(C) = I
+* CMODE = -1 op2(C) = inv(C)
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The vector C in the formula op(A) * op2(C).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) DOUBLE PRECISION array, dimension (3*N).
+* Workspace.
+*
+* IWORK (input) INTEGER array, dimension (N).
+* Workspace.
*
* =====================================================================
*
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
+ ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
+ INFO = -4
+ ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
+ INFO = -6
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'DLA_GERCOND', -INFO )
* Purpose
* =======
*
-* DLA_GERFSX_EXTENDED computes ... .
+* DLA_GERFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by DGERFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* TRANS_TYPE (input) INTEGER
+* Specifies the transposition operation on A.
+* The value is defined by ILATRANS(T) where T is a CHARACTER and
+* T = 'N': No transpose
+* = 'T': Transpose
+* = 'C': Conjugate transpose
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) DOUBLE PRECISION array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) DOUBLE PRECISION array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by DGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by DGETRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) DOUBLE PRECISION array, dimension
+* (LDY,NRHS)
+* On entry, the solution matrix X, as computed by DGETRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) DOUBLE PRECISION array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by DLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* normwise relative error, which is defined as follows:
+*
+* Normwise relative error in the ith solution vector:
+* max_j (abs(XTRUE(j,i) - X(j,i)))
+* ------------------------------
+* max_j abs(X(j,i))
+*
+* The array is indexed by the type of error information as described
+* below. There currently are up to three pieces of information
+* returned.
+*
+* The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_NORM(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* componentwise relative error, which is defined as follows:
+*
+* Componentwise relative error in the ith solution vector:
+* abs(XTRUE(j,i) - X(j,i))
+* max_j ----------------------
+* abs(X(j,i))
+*
+* The array is indexed by the right-hand side i (on which the
+* componentwise relative error depends), and the type of error
+* information as described below. There currently are up to three
+* pieces of information returned for each right-hand side. If
+* componentwise accuracy is not requested (PARAMS(3) = 0.0), then
+* ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) DOUBLE PRECISION array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) DOUBLE PRECISION array, dimension (N)
+* Workspace. This can be the same workspace passed for Y_TAIL.
+*
+* DY (input) DOUBLE PRECISION array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) DOUBLE PRECISION array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) DOUBLE PRECISION
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) DOUBLE PRECISION
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to DGETRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Purpose
* =======
*
-* DLA_LIN_BERR computes component-wise relative backward error from
+* DLA_LIN_BERR computes componentwise relative backward error from
* the formula
* max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
-* where abs(Z) is the component-wise absolute value of the matrix
+* where abs(Z) is the componentwise absolute value of the matrix
* or vector Z.
*
+* Arguments
+* ==========
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NZ (input) INTEGER
+* We add (NZ+1)*SLAMCH( 'Safe minimum' ) to R(i) in the numerator to
+* guard against spuriously zero residuals. Default value is N.
+*
+* NRHS (input) INTEGER
+* The number of right hand sides, i.e., the number of columns
+* of the matrices AYB, RES, and BERR. NRHS >= 0.
+*
+* RES (input) DOUBLE PRECISION array, dimension (N,NRHS)
+* The residual matrix, i.e., the matrix R in the relative backward
+* error formula above.
+*
+* AYB (input) DOUBLE PRECISION array, dimension (N, NRHS)
+* The denominator in the relative backward error formula above, i.e.,
+* the matrix abs(op(A_s))*abs(Y) + abs(B_s). The matrices A, Y, and B
+* are from iterative refinement (see dla_gerfsx_extended.f).
+*
+* RES (output) DOUBLE PRECISION array, dimension (NRHS)
+* The componentwise relative backward error from the formula above.
+*
* =====================================================================
*
* .. Local Scalars ..
- DOUBLE PRECISION FUNCTION DLA_PORCOND( UPLO, N, A, LDA, AF, LDAF,
- $ CMODE, C, INFO, WORK, IWORK )
+ DOUBLE PRECISION FUNCTION DLA_PORCOND( UPLO, N, A, LDA, AF, LDAF,
+ $ CMODE, C, INFO, WORK,
+ $ IWORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Arguments
* ==========
*
-* WORK double precision workspace of size 3*N.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* IWORK integer workspace of size N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* A (input) REAL array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) DOUBLE PRECISION array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by DPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* CMODE (input) INTEGER
+* Determines op2(C) in the formula op(A) * op2(C) as follows:
+* CMODE = 1 op2(C) = C
+* CMODE = 0 op2(C) = I
+* CMODE = -1 op2(C) = inv(C)
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The vector C in the formula op(A) * op2(C).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) DOUBLE PRECISION array, dimension (3*N).
+* Workspace.
+*
+* IWORK (input) INTEGER array, dimension (N).
+* Workspace.
*
* =====================================================================
*
SUBROUTINE DLA_PORFSX_EXTENDED( PREC_TYPE, UPLO, N, NRHS, A, LDA,
$ AF, LDAF, COLEQU, C, B, LDB, Y,
- $ LDY, BERR_OUT, N_NORMS, ERRS_N,
- $ ERRS_C, RES, AYB, DY, Y_TAIL,
- $ RCOND, ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ LDY, BERR_OUT, N_NORMS,
+ $ ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
+ $ AYB, DY, Y_TAIL, RCOND, ITHRESH,
+ $ RTHRESH, DZ_UB, IGNORE_CWISE,
+ $ INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
DOUBLE PRECISION A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
$ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
DOUBLE PRECISION C( * ), AYB(*), RCOND, BERR_OUT( * ),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
*
-* DLA_PORFSX_EXTENDED computes ... .
+* DLA_PORFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by DPORFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) DOUBLE PRECISION array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) DOUBLE PRECISION array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by DPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) DOUBLE PRECISION array, dimension
+* (LDY,NRHS)
+* On entry, the solution matrix X, as computed by DPOTRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) DOUBLE PRECISION array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by DLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* normwise relative error, which is defined as follows:
+*
+* Normwise relative error in the ith solution vector:
+* max_j (abs(XTRUE(j,i) - X(j,i)))
+* ------------------------------
+* max_j abs(X(j,i))
+*
+* The array is indexed by the type of error information as described
+* below. There currently are up to three pieces of information
+* returned.
+*
+* The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_NORM(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* componentwise relative error, which is defined as follows:
+*
+* Componentwise relative error in the ith solution vector:
+* abs(XTRUE(j,i) - X(j,i))
+* max_j ----------------------
+* abs(X(j,i))
+*
+* The array is indexed by the right-hand side i (on which the
+* componentwise relative error depends), and the type of error
+* information as described below. There currently are up to three
+* pieces of information returned for each right-hand side. If
+* componentwise accuracy is not requested (PARAMS(3) = 0.0), then
+* ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) DOUBLE PRECISION array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) DOUBLE PRECISION array, dimension (N)
+* Workspace. This can be the same workspace passed for Y_TAIL.
+*
+* DY (input) DOUBLE PRECISION array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) DOUBLE PRECISION array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) DOUBLE PRECISION
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) DOUBLE PRECISION
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to DPOTRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Compute error bounds.
*
IF ( N_NORMS .GE. 1 ) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF ( N_NORMS .GE. 2 ) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
DOUBLE PRECISION FUNCTION DLA_PORPVGRW( UPLO, NCOLS, A, LDA, AF,
- $ LDAF, WORK )
+ $ LDAF, WORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Purpose
* =======
*
-* DLA_PORPVGRW computes ... .
+* DLA_PORPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) DOUBLE PRECISION array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) DOUBLE PRECISION array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by DPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* WORK (input) DOUBLE PRECISION array, dimension (2*N)
+*
* =====================================================================
*
* .. Local Scalars ..
* Purpose
* =======
*
-* DLA_RPVGRW computes ... .
+* DLA_RPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) DOUBLE PRECISION array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) DOUBLE PRECISION array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by DGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
* =====================================================================
*
* .. Local Scalars ..
* .. Executable Statements ..
*
RPVGRW = 1.0D+0
-*
+
DO J = 1, NCOLS
AMAX = 0.0D+0
UMAX = 0.0D+0
DOUBLE PRECISION FUNCTION DLA_SYRCOND( UPLO, N, A, LDA, AF, LDAF,
- $ IPIV, CMODE, C, INFO, WORK, IWORK )
+ $ IPIV, CMODE, C, INFO, WORK,
+ $ IWORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Arguments
* ==========
*
-* WORK double precision workspace of size 3*N.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* IWORK integer workspace of size N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* A (input) DOUBLE PRECISION array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) DOUBLE PRECISION array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by DSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by DSYTRF.
+*
+* CMODE (input) INTEGER
+* Determines op2(C) in the formula op(A) * op2(C) as follows:
+* CMODE = 1 op2(C) = C
+* CMODE = 0 op2(C) = I
+* CMODE = -1 op2(C) = inv(C)
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The vector C in the formula op(A) * op2(C).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) DOUBLE PRECISION array, dimension (3*N).
+* Workspace.
+*
+* IWORK (input) INTEGER array, dimension (N).
+* Workspace.
*
* =====================================================================
*
END DO
IF ( UP ) THEN
- call dsytrs( 'U', n, 1, af, ldaf, ipiv, work, n, info )
+ CALL DSYTRS( 'U', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
ELSE
- call dsytrs( 'L', n, 1, af, ldaf, ipiv, work, n, info )
+ CALL DSYTRS( 'L', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
ENDIF
*
* Multiply by inv(C).
END IF
IF ( UP ) THEN
- call dsytrs( 'U', n, 1, af, ldaf, ipiv, work, n, info )
+ CALL DSYTRS( 'U', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
ELSE
- call dsytrs( 'L', n, 1, af, ldaf, ipiv, work, n, info )
+ CALL DSYTRS( 'L', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
ENDIF
*
* Multiply by R.
SUBROUTINE DLA_SYRFSX_EXTENDED( PREC_TYPE, UPLO, N, NRHS, A, LDA,
$ AF, LDAF, IPIV, COLEQU, C, B, LDB,
- $ Y, LDY, BERR_OUT, N_NORMS, ERRS_N,
- $ ERRS_C, RES, AYB, DY, Y_TAIL,
- $ RCOND, ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ Y, LDY, BERR_OUT, N_NORMS,
+ $ ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
+ $ AYB, DY, Y_TAIL, RCOND, ITHRESH,
+ $ RTHRESH, DZ_UB, IGNORE_CWISE,
+ $ INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
DOUBLE PRECISION A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
$ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
DOUBLE PRECISION C( * ), AYB( * ), RCOND, BERR_OUT( * ),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
*
-* DLA_SYRFSX_EXTENDED computes ... .
+* DLA_SYRFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by DSYRFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) DOUBLE PRECISION array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) DOUBLE PRECISION array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by DSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by DSYTRF.
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) DOUBLE PRECISION array, dimension
+* (LDY,NRHS)
+* On entry, the solution matrix X, as computed by DSYTRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) DOUBLE PRECISION array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by DLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* normwise relative error, which is defined as follows:
+*
+* Normwise relative error in the ith solution vector:
+* max_j (abs(XTRUE(j,i) - X(j,i)))
+* ------------------------------
+* max_j abs(X(j,i))
+*
+* The array is indexed by the type of error information as described
+* below. There currently are up to three pieces of information
+* returned.
+*
+* The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_NORM(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* componentwise relative error, which is defined as follows:
+*
+* Componentwise relative error in the ith solution vector:
+* abs(XTRUE(j,i) - X(j,i))
+* max_j ----------------------
+* abs(X(j,i))
+*
+* The array is indexed by the right-hand side i (on which the
+* componentwise relative error depends), and the type of error
+* information as described below. There currently are up to three
+* pieces of information returned for each right-hand side. If
+* componentwise accuracy is not requested (PARAMS(3) = 0.0), then
+* ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) DOUBLE PRECISION array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) DOUBLE PRECISION array, dimension (N)
+* Workspace. This can be the same workspace passed for Y_TAIL.
+*
+* DY (input) DOUBLE PRECISION array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) DOUBLE PRECISION array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) DOUBLE PRECISION
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) DOUBLE PRECISION
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to DSYTRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Compute error bounds.
*
IF ( N_NORMS .GE. 1 ) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF ( N_NORMS .GE. 2 ) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
DOUBLE PRECISION FUNCTION DLA_SYRPVGRW( UPLO, N, INFO, A, LDA, AF,
- $ LDAF, IPIV, WORK )
+ $ LDAF, IPIV, WORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Purpose
* =======
*
-* DLA_SYRPVGRW computes ... .
+* DLA_SYRPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* INFO (input) INTEGER
+* The value of INFO returned from DSYTRF, .i.e., the pivot in
+* column INFO is exactly 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) DOUBLE PRECISION array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) DOUBLE PRECISION array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by DSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by DSYTRF.
+*
+* WORK (input) DOUBLE PRECISION array, dimension (2*N)
+*
* =====================================================================
*
* .. Local Scalars ..
* x <-- inv(D) * x
* where the diagonal matrix D is stored as a vector.
*
-* Eventually to be replaced by BLAS_sge_diag_scale in the new BLAS
+* Eventually to be replaced by BLAS_dge_diag_scale in the new BLAS
* standard.
*
* Arguments
* =========
*
-* N (input) INTEGER
-* The size of the vectors X and D.
+* M (input) INTEGER
+* The number of rows of D and X. M >= 0.
*
-* D (input) DOUBLE PRECISION array, length N
-* Diagonal matrix D, stored as a vector of length N.
+* N (input) INTEGER
+* The number of columns of D and X. N >= 0.
+*
+* D (input) DOUBLE PRECISION array, length M
+* Diagonal matrix D, stored as a vector of length M.
+*
+* X (input/output) DOUBLE PRECISION array, dimension (LDX,N)
+* On entry, the vector X to be scaled by D.
+* On exit, the scaled vector.
+*
+* LDX (input) INTEGER
+* The leading dimension of the vector X. LDX >= 0.
+*
+* =====================================================================
*
-* X (input/output) DOUBLE PRECISION array, length N
-* On entry, the vector X to be scaled by D.
-* On exit, the scaled vector.
-* ..
* .. Local Scalars ..
INTEGER I, J
* ..
*
DO J = 1, N
DO I = 1, M
- X(I,J) = X(I,J) / D(I)
+ X( I, J ) = X( I, J ) / D( I )
END DO
END DO
-*
+
RETURN
END
* x <-- D * x
* where the diagonal matrix D is stored as a vector.
*
-* Eventually to be replaced by BLAS_sge_diag_scale in the new BLAS
+* Eventually to be replaced by BLAS_dge_diag_scale in the new BLAS
* standard.
*
* Arguments
* =========
*
-* N (input) INTEGER
-* The size of the vectors X and D.
+* M (input) INTEGER
+* The number of rows of D and X. M >= 0.
*
-* D (input) DOUBLE PRECISION array, length N
-* Diagonal matrix D, stored as a vector of length N.
+* N (input) INTEGER
+* The number of columns of D and X. N >= 0.
+*
+* D (input) DOUBLE PRECISION array, length M
+* Diagonal matrix D, stored as a vector of length M.
+*
+* X (input/output) DOUBLE PRECISION array, dimension (LDX,N)
+* On entry, the vector X to be scaled by D.
+* On exit, the scaled vector.
+*
+* LDX (input) INTEGER
+* The leading dimension of the vector X. LDX >= 0.
+*
+* =====================================================================
*
-* X (input/output) DOUBLE PRECISION array, length N
-* On entry, the vector X to be scaled by D.
-* On exit, the scaled vector.
-* ..
* .. Local Scalars ..
INTEGER I, J
* ..
*
DO J = 1, N
DO I = 1, M
- X(I,J) = X(I,J) * D(I)
+ X( I, J ) = X( I, J ) * D( I )
END DO
END DO
-*
+
RETURN
END
* definite, and provides error bounds and backward error estimates
* for the solution. In addition to normwise error bound, the code
* provides maximum componentwise error bound if possible. See
-* comments for ERR_BNDS for details of the error bounds.
+* 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
* 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_N and ERR_BNDS_C for details of the error bounds.
+* 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
* = 'E': The matrix A will be equilibrated if necessary, then
* copied to AF and factored.
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
* N (input) INTEGER
* The number of linear equations, i.e., the order of the
* matrix A. N >= 0.
* equations 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_N and ERR_BNDS_C for details of the error
-* bounds.
+* 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, R
* equations 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_N and ERR_BNDS_C for details of the error
-* bounds.
+* 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, R
* Arguments
* ==========
*
-* WORK real workspace of size 5*N.
+* TRANS (input) CHARACTER*1
+* Specifies the form of the system of equations:
+* = 'N': A * X = B (No transpose)
+* = 'T': A**T * X = B (Transpose)
+* = 'C': A**H * X = B (Conjugate Transpose = Transpose)
*
-* IWORK integer workspace of size N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0.
+*
+* AB (input) REAL array, dimension (LDAB,N)
+* On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
+* The j-th column of A is stored in the j-th column of the
+* array AB as follows:
+* AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
+*
+* LDAB (input) INTEGER
+* The leading dimension of the array AB. LDAB >= KL+KU+1.
+*
+* AFB (input) REAL array, dimension (LDAFB,N)
+* Details of the LU factorization of the band matrix A, as
+* computed by SGBTRF. U is stored as an upper triangular
+* band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
+* and the multipliers used during the factorization are stored
+* in rows KL+KU+2 to 2*KL+KU+1.
+*
+* LDAFB (input) INTEGER
+* The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by SGBTRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* CMODE (input) INTEGER
+* Determines op2(C) in the formula op(A) * op2(C) as follows:
+* CMODE = 1 op2(C) = C
+* CMODE = 0 op2(C) = I
+* CMODE = -1 op2(C) = inv(C)
+*
+* C (input) REAL array, dimension (N)
+* The vector C in the formula op(A) * op2(C).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) REAL array, dimension (5*N).
+* Workspace.
+*
+* IWORK (input) INTEGER array, dimension (N).
+* Workspace.
*
* =====================================================================
*
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( KL.LT.0 .OR. KL.GT.N-1 ) THEN
- INFO = -4
+ INFO = -3
ELSE IF( KU.LT.0 .OR. KU.GT.N-1 ) THEN
- INFO = -5
+ INFO = -4
ELSE IF( LDAB.LT.KL+KU+1 ) THEN
- INFO = -8
+ INFO = -6
ELSE IF( LDAFB.LT.2*KL+KU+1 ) THEN
- INFO = -10
+ INFO = -8
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'SLA_GBRCOND', -INFO )
SUBROUTINE SLA_GBRFSX_EXTENDED( PREC_TYPE, TRANS_TYPE, N, KL, KU,
$ NRHS, AB, LDAB, AFB, LDAFB, IPIV,
$ COLEQU, C, B, LDB, Y, LDY,
- $ BERR_OUT, N_NORMS, ERRS_N, ERRS_C,
- $ RES, AYB, DY, Y_TAIL, RCOND,
- $ ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ BERR_OUT, N_NORMS, ERR_BNDS_NORM,
+ $ ERR_BNDS_COMP, RES, AYB, DY,
+ $ Y_TAIL, RCOND, ITHRESH, RTHRESH,
+ $ DZ_UB, IGNORE_CWISE, INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
REAL AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
$ Y( LDY, * ), RES(*), DY(*), Y_TAIL(*)
REAL C( * ), AYB(*), RCOND, BERR_OUT(*),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
*
-* SLA_GBRFSX_EXTENDED computes ... .
+* SLA_GBRFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by SGBRFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* TRANS_TYPE (input) INTEGER
+* Specifies the transposition operation on A.
+* The value is defined by ILATRANS(T) where T is a CHARACTER and
+* T = 'N': No transpose
+* = 'T': Transpose
+* = 'C': Conjugate transpose
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) REAL array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) REAL array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by SGBTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by SGBTRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) REAL array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) REAL array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) REAL array, dimension (LDY,NRHS)
+* On entry, the solution matrix X, as computed by SGBTRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) REAL array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by SLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) 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 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) 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 .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) REAL array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) REAL array, dimension (N)
+* Workspace. This can be the same workspace passed for Y_TAIL.
+*
+* DY (input) REAL array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) REAL array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) REAL
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) REAL
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to SGBTRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Compute error bounds.
*
IF ( N_NORMS .GE. 1 ) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF (N_NORMS .GE. 2) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
*
* Purpose
* =======
-*
-* SLA_GBRPVGRW computes ... .
+*
+* SLA_GBRPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* AB (input) REAL array, dimension (LDAB,N)
+* On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
+* The j-th column of A is stored in the j-th column of the
+* array AB as follows:
+* AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
+*
+* LDAB (input) INTEGER
+* The leading dimension of the array AB. LDAB >= KL+KU+1.
+*
+* AFB (input) REAL array, dimension (LDAFB,N)
+* Details of the LU factorization of the band matrix A, as
+* computed by SGBTRF. U is stored as an upper triangular
+* band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
+* and the multipliers used during the factorization are stored
+* in rows KL+KU+2 to 2*KL+KU+1.
+*
+* LDAFB (input) INTEGER
+* The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.
+*
* =====================================================================
*
* .. Local Scalars ..
* .. Executable Statements ..
*
RPVGRW = 1.0
-*
+
KD = KU + 1
DO J = 1, NCOLS
AMAX = 0.0
* Arguments
* ==========
*
-* WORK REAL workspace of size 3*N.
+* TRANS (input) CHARACTER*1
+* Specifies the form of the system of equations:
+* = 'N': A * X = B (No transpose)
+* = 'T': A**T * X = B (Transpose)
+* = 'C': A**H * X = B (Conjugate Transpose = Transpose)
*
-* IWORK INTEGER workspace of size N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* A (input) REAL array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) REAL array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by SGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by SGETRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* CMODE (input) INTEGER
+* Determines op2(C) in the formula op(A) * op2(C) as follows:
+* CMODE = 1 op2(C) = C
+* CMODE = 0 op2(C) = I
+* CMODE = -1 op2(C) = inv(C)
+*
+* C (input) REAL array, dimension (N)
+* The vector C in the formula op(A) * op2(C).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) REAL array, dimension (3*N).
+* Workspace.
+*
+* IWORK (input) INTEGER array, dimension (N).
+* Workspace.2
*
* =====================================================================
*
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
+ ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
+ INFO = -4
+ ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
+ INFO = -6
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'SLA_GERCOND', -INFO )
SUBROUTINE SLA_GERFSX_EXTENDED( PREC_TYPE, TRANS_TYPE, N, NRHS, A,
$ LDA, AF, LDAF, IPIV, COLEQU, C, B,
$ LDB, Y, LDY, BERR_OUT, N_NORMS,
- $ ERRS_N, ERRS_C, RES, AYB, DY,
- $ Y_TAIL, RCOND, ITHRESH, RTHRESH,
- $ DZ_UB, IGNORE_CWISE, INFO )
+ $ ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
+ $ AYB, DY, Y_TAIL, RCOND, ITHRESH,
+ $ RTHRESH, DZ_UB, IGNORE_CWISE,
+ $ INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
REAL A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
$ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
REAL C( * ), AYB( * ), RCOND, BERR_OUT( * ),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
-*
-* SLA_GERFSX_EXTENDED computes ... .
+*
+* SLA_GERFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by SGERFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* TRANS_TYPE (input) INTEGER
+* Specifies the transposition operation on A.
+* The value is defined by ILATRANS(T) where T is a CHARACTER and
+* T = 'N': No transpose
+* = 'T': Transpose
+* = 'C': Conjugate transpose
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) REAL array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) REAL array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by SGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by SGETRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) REAL array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) REAL array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) REAL array, dimension (LDY,NRHS)
+* On entry, the solution matrix X, as computed by SGETRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) REAL array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by SLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) 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 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) 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 .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) REAL array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) REAL array, dimension (N)
+* Workspace. This can be the same workspace passed for Y_TAIL.
+*
+* DY (input) REAL array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) REAL array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) REAL
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) REAL
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to SGETRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Compute error bounds
*
IF (N_NORMS .GE. 1) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF ( N_NORMS .GE. 2 ) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
* Purpose
* =======
*
-* SLA_LIN_BERR computes component-wise relative backward error from
+* SLA_LIN_BERR computes componentwise relative backward error from
* the formula
* max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
-* where abs(Z) is the component-wise absolute value of the matrix
+* where abs(Z) is the componentwise absolute value of the matrix
* or vector Z.
*
+* Arguments
+* ==========
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NZ (input) INTEGER
+* We add (NZ+1)*SLAMCH( 'Safe minimum' ) to R(i) in the numerator to
+* guard against spuriously zero residuals. Default value is N.
+*
+* NRHS (input) INTEGER
+* The number of right hand sides, i.e., the number of columns
+* of the matrices AYB, RES, and BERR. NRHS >= 0.
+*
+* RES (input) REAL array, dimension (N,NRHS)
+* The residual matrix, i.e., the matrix R in the relative backward
+* error formula above.
+*
+* AYB (input) REAL array, dimension (N, NRHS)
+* The denominator in the relative backward error formula above, i.e.,
+* the matrix abs(op(A_s))*abs(Y) + abs(B_s). The matrices A, Y, and B
+* are from iterative refinement (see sla_gerfsx_extended.f).
+*
+* RES (output) REAL array, dimension (NRHS)
+* The componentwise relative backward error from the formula above.
+*
* =====================================================================
*
* .. Local Scalars ..
* Arguments
* ==========
*
-* WORK real workspace of size 3*N, and
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* IWORK integer workspace of size N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* A (input) REAL array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) REAL array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by SPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* CMODE (input) INTEGER
+* Determines op2(C) in the formula op(A) * op2(C) as follows:
+* CMODE = 1 op2(C) = C
+* CMODE = 0 op2(C) = I
+* CMODE = -1 op2(C) = inv(C)
+*
+* C (input) REAL array, dimension (N)
+* The vector C in the formula op(A) * op2(C).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) REAL array, dimension (3*N).
+* Workspace.
+*
+* IWORK (input) INTEGER array, dimension (N).
+* Workspace.
*
* =====================================================================
*
SUBROUTINE SLA_PORFSX_EXTENDED( PREC_TYPE, UPLO, N, NRHS, A, LDA,
$ AF, LDAF, COLEQU, C, B, LDB, Y,
- $ LDY, BERR_OUT, N_NORMS, ERRS_N,
- $ ERRS_C, RES, AYB, DY, Y_TAIL,
- $ RCOND, ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ LDY, BERR_OUT, N_NORMS,
+ $ ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
+ $ AYB, DY, Y_TAIL, RCOND, ITHRESH,
+ $ RTHRESH, DZ_UB, IGNORE_CWISE,
+ $ INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
REAL A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
$ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
REAL C( * ), AYB(*), RCOND, BERR_OUT( * ),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
*
-* SLA_PORFSX_EXTENDED computes ... .
+* SLA_PORFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by SPORFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) REAL array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) REAL array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by SPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) REAL array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) REAL array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) REAL array, dimension (LDY,NRHS)
+* On entry, the solution matrix X, as computed by SPOTRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) REAL array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by SLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) 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 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) 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 .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) REAL array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) REAL array, dimension (N)
+* Workspace. This can be the same workspace passed for Y_TAIL.
+*
+* DY (input) REAL array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) REAL array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) REAL
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) REAL
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to SPOTRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Compute error bounds.
*
IF ( N_NORMS .GE. 1 ) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF ( N_NORMS .GE. 2 ) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
* Purpose
* =======
*
-* SLA_PORPVGRW computes ... .
+* SLA_PORPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) REAL array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) REAL array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by SPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* WORK (input) REAL array, dimension (2*N)
+*
* =====================================================================
*
* .. Local Scalars ..
*
* Purpose
* =======
-*
-* SLA_RPVGRW computes ... .
+*
+* SLA_RPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) REAL array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) REAL array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by SGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
* =====================================================================
*
* .. Local Scalars ..
* .. Executable Statements ..
*
RPVGRW = 1.0
-*
+
DO J = 1, NCOLS
AMAX = 0.0
UMAX = 0.0
* Arguments
* ==========
*
-* WORK real workspace of size 3*N.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* IWORK integer workspace of size N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* A (input) REAL array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) REAL array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by SSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by SSYTRF.
+*
+* CMODE (input) INTEGER
+* Determines op2(C) in the formula op(A) * op2(C) as follows:
+* CMODE = 1 op2(C) = C
+* CMODE = 0 op2(C) = I
+* CMODE = -1 op2(C) = inv(C)
+*
+* C (input) REAL array, dimension (N)
+* The vector C in the formula op(A) * op2(C).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) REAL array, dimension (3*N).
+* Workspace.
+*
+* IWORK (input) INTEGER array, dimension (N).
+* Workspace.
*
* =====================================================================
*
END DO
IF ( UP ) THEN
- call ssytrs( 'U', n, 1, af, ldaf, ipiv, work, n, info )
+ CALL SSYTRS( 'U', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
ELSE
- call ssytrs( 'L', n, 1, af, ldaf, ipiv, work, n, info )
+ CALL SSYTRS( 'L', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
ENDIF
*
* Multiply by inv(C).
END IF
IF ( UP ) THEN
- call ssytrs( 'U', n, 1, af, ldaf, ipiv, work, n, info )
+ CALL SSYTRS( 'U', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
ELSE
- call ssytrs( 'L', n, 1, af, ldaf, ipiv, work, n, info )
+ CALL SSYTRS( 'L', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
ENDIF
*
* Multiply by R.
SUBROUTINE SLA_SYRFSX_EXTENDED( PREC_TYPE, UPLO, N, NRHS, A, LDA,
$ AF, LDAF, IPIV, COLEQU, C, B, LDB,
- $ Y, LDY, BERR_OUT, N_NORMS, ERRS_N,
- $ ERRS_C, RES, AYB, DY, Y_TAIL,
- $ RCOND, ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ Y, LDY, BERR_OUT, N_NORMS,
+ $ ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
+ $ AYB, DY, Y_TAIL, RCOND, ITHRESH,
+ $ RTHRESH, DZ_UB, IGNORE_CWISE,
+ $ INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
REAL A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
$ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
REAL C( * ), AYB( * ), RCOND, BERR_OUT( * ),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
*
-* SLA_SYRFSX_EXTENDED computes ... .
+* SLA_SYRFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by SSYRFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) REAL array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) REAL array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by SSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by SSYTRF.
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) REAL array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) REAL array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) REAL array, dimension (LDY,NRHS)
+* On entry, the solution matrix X, as computed by SSYTRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) REAL array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by SLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) 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 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) 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 .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) REAL array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) REAL array, dimension (N)
+* Workspace. This can be the same workspace passed for Y_TAIL.
+*
+* DY (input) REAL array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) REAL array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) REAL
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) REAL
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to SSYTRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Compute error bounds.
*
IF ( N_NORMS .GE. 1 ) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF ( N_NORMS .GE. 2 ) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
* Purpose
* =======
*
-* SLA_SYRPVGRW computes ... .
+* SLA_SYRPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* INFO (input) INTEGER
+* The value of INFO returned from SSYTRF, .i.e., the pivot in
+* column INFO is exactly 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) REAL array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) REAL array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by SSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by SSYTRF.
+*
+* WORK (input) REAL array, dimension (2*N)
+*
* =====================================================================
*
* .. Local Scalars ..
* Arguments
* =========
*
-* N (input) INTEGER
-* The size of the vectors X and D.
+* M (input) INTEGER
+* The number of rows of D and X. M >= 0.
*
-* D (input) REAL array, length N
-* Diagonal matrix D, stored as a vector of length N.
+* N (input) INTEGER
+* The number of columns of D and X. N >= 0.
+*
+* D (input) REAL array, length M
+* Diagonal matrix D, stored as a vector of length M.
+*
+* X (input/output) REAL array, dimension (LDX,N)
+* On entry, the vector X to be scaled by D.
+* On exit, the scaled vector.
+*
+* LDX (input) INTEGER
+* The leading dimension of the vector X. LDX >= 0.
+*
+* =====================================================================
*
-* X (input/output) REAL array, length N
-* On entry, the vector X to be scaled by D.
-* On exit, the scaled vector.
-* ..
* .. Local Scalars ..
INTEGER I, J
* ..
*
DO J = 1, N
DO I = 1, M
- X(I,J) = X(I,J) / D(I)
+ X( I, J ) = X( I, J ) / D( I )
END DO
END DO
-*
+
RETURN
END
* Arguments
* =========
*
-* N (input) INTEGER
-* The size of the vectors X and D.
+* M (input) INTEGER
+* The number of rows of D and X. M >= 0.
*
-* D (input) REAL array, length N
-* Diagonal matrix D, stored as a vector of length N.
+* N (input) INTEGER
+* The number of columns of D and X. N >= 0.
+*
+* D (input) REAL array, length M
+* Diagonal matrix D, stored as a vector of length M.
+*
+* X (input/output) REAL array, dimension (LDX,N)
+* On entry, the vector X to be scaled by D.
+* On exit, the scaled vector.
+*
+* LDX (input) INTEGER
+* The leading dimension of the vector X. LDX >= 0.
+*
+* =====================================================================
*
-* X (input/output) REAL array, length N
-* On entry, the vector X to be scaled by D.
-* On exit, the scaled vector.
-* ..
* .. Local Scalars ..
INTEGER I, J
* ..
*
DO J = 1, N
DO I = 1, M
- X(I,J) = X(I,J) * D(I)
+ X( I, J ) = X( I, J ) * D( I )
END DO
END DO
-*
+
RETURN
END
* definite, and provides error bounds and backward error estimates
* for the solution. In addition to normwise error bound, the code
* provides maximum componentwise error bound if possible. See
-* comments for ERR_BNDS for details of the error bounds.
+* 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
* 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_N and ERR_BNDS_C for details of the error bounds.
+* 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
* = 'E': The matrix A will be equilibrated if necessary, then
* copied to AF and factored.
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
* N (input) INTEGER
* The number of linear equations, i.e., the order of the
* matrix A. N >= 0.
* equations 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_N and ERR_BNDS_C for details of the error
-* bounds.
+* 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, R
* equations 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_N and ERR_BNDS_C for details of the error
-* bounds.
+* 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, R
- Subroutine ZHERFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, IPIV,
+ 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 )
* 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_N and ERR_BNDS_C for details of the error bounds.
+* 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
* IPIV (input or output) INTEGER array, dimension (N)
* If FACT = 'F', then IPIV is an input argument and on entry
* contains details of the interchanges and the block
-* structure of D, as determined by DSYTRF. If IPIV(k) > 0,
+* structure of D, as determined by ZHETRF. If IPIV(k) > 0,
* then rows and columns k and IPIV(k) were interchanged and
* D(k,k) is a 1-by-1 diagonal block. If UPLO = 'U' and
* IPIV(k) = IPIV(k-1) < 0, then rows and columns k-1 and
*
* If FACT = 'N', then IPIV is an output argument and on exit
* contains details of the interchanges and the block
-* structure of D, as determined by DSYTRF.
+* structure of D, as determined by ZHETRF.
*
* EQUED (input or output) CHARACTER*1
* Specifies the form of equilibration that was done.
- DOUBLE PRECISION FUNCTION ZLA_GBRCOND_C( TRANS, N, KL, KU, AB,
- $ LDAB, AFB, LDAFB, IPIV, C, CAPPLY,
- $ INFO, WORK, RWORK )
+ DOUBLE PRECISION FUNCTION ZLA_GBRCOND_C( TRANS, N, KL, KU, AB,
+ $ LDAB, AFB, LDAFB, IPIV,
+ $ C, CAPPLY, INFO, WORK,
+ $ RWORK )
*
* -- LAPACK routine (version 3.2.1) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Arguments
* =========
*
-* C DOUBLE PRECISION vector.
+* TRANS (input) CHARACTER*1
+* Specifies the form of the system of equations:
+* = 'N': A * X = B (No transpose)
+* = 'T': A**T * X = B (Transpose)
+* = 'C': A**H * X = B (Conjugate Transpose = Transpose)
*
-* WORK COMPLEX*16 workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK DOUBLE PRECISION workspace of size N.
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0.
+*
+* AB (input) COMPLEX*16 array, dimension (LDAB,N)
+* On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
+* The j-th column of A is stored in the j-th column of the
+* array AB as follows:
+* AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
+*
+* LDAB (input) INTEGER
+* The leading dimension of the array AB. LDAB >= KL+KU+1.
+*
+* AFB (input) COMPLEX*16 array, dimension (LDAFB,N)
+* Details of the LU factorization of the band matrix A, as
+* computed by ZGBTRF. U is stored as an upper triangular
+* band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
+* and the multipliers used during the factorization are stored
+* in rows KL+KU+2 to 2*KL+KU+1.
+*
+* LDAFB (input) INTEGER
+* The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by ZGBTRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The vector C in the formula op(A) * inv(diag(C)).
+*
+* CAPPLY (input) LOGICAL
+* If .TRUE. then access the vector C in the formula above.
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX*16 array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) DOUBLE PRECISION array, dimension (N).
+* Workspace.
*
* =====================================================================
*
NOTRANS = LSAME( TRANS, 'N' )
IF ( .NOT. NOTRANS .AND. .NOT. LSAME( TRANS, 'T' ) .AND. .NOT.
$ LSAME( TRANS, 'C' ) ) THEN
+ INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( KL.LT.0 .OR. KL.GT.N-1 ) THEN
- INFO = -4
+ INFO = -3
ELSE IF( KU.LT.0 .OR. KU.GT.N-1 ) THEN
- INFO = -5
+ INFO = -4
ELSE IF( LDAB.LT.KL+KU+1 ) THEN
- INFO = -8
+ INFO = -6
ELSE IF( LDAFB.LT.2*KL+KU+1 ) THEN
- INFO = -10
+ INFO = -8
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'ZLA_GBRCOND_C', -INFO )
DOUBLE PRECISION FUNCTION ZLA_GBRCOND_X( TRANS, N, KL, KU, AB,
- $ LDAB, AFB, LDAFB, IPIV, X, INFO,
- $ WORK, RWORK )
+ $ LDAB, AFB, LDAFB, IPIV,
+ $ X, INFO, WORK, RWORK )
*
* -- LAPACK routine (version 3.2.1) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Arguments
* =========
*
-* X COMPLEX*16 vector.
+* TRANS (input) CHARACTER*1
+* Specifies the form of the system of equations:
+* = 'N': A * X = B (No transpose)
+* = 'T': A**T * X = B (Transpose)
+* = 'C': A**H * X = B (Conjugate Transpose = Transpose)
*
-* WORK COMPLEX*16 workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK DOUBLE PRECISION workspace of size N.
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0.
+*
+* AB (input) COMPLEX*16 array, dimension (LDAB,N)
+* On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
+* The j-th column of A is stored in the j-th column of the
+* array AB as follows:
+* AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
+*
+* LDAB (input) INTEGER
+* The leading dimension of the array AB. LDAB >= KL+KU+1.
+*
+* AFB (input) COMPLEX*16 array, dimension (LDAFB,N)
+* Details of the LU factorization of the band matrix A, as
+* computed by ZGBTRF. U is stored as an upper triangular
+* band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
+* and the multipliers used during the factorization are stored
+* in rows KL+KU+2 to 2*KL+KU+1.
+*
+* LDAFB (input) INTEGER
+* The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by ZGBTRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* X (input) COMPLEX*16 array, dimension (N)
+* The vector X in the formula op(A) * diag(X).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX*16 array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) DOUBLE PRECISION array, dimension (N).
+* Workspace.
*
* =====================================================================
*
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( KL.LT.0 .OR. KL.GT.N-1 ) THEN
- INFO = -4
+ INFO = -3
ELSE IF( KU.LT.0 .OR. KU.GT.N-1 ) THEN
- INFO = -5
+ INFO = -4
ELSE IF( LDAB.LT.KL+KU+1 ) THEN
- INFO = -8
+ INFO = -6
ELSE IF( LDAFB.LT.2*KL+KU+1 ) THEN
- INFO = -10
+ INFO = -8
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'ZLA_GBRCOND_X', -INFO )
SUBROUTINE ZLA_GBRFSX_EXTENDED( PREC_TYPE, TRANS_TYPE, N, KL, KU,
$ NRHS, AB, LDAB, AFB, LDAFB, IPIV,
$ COLEQU, C, B, LDB, Y, LDY,
- $ BERR_OUT, N_NORMS, ERRS_N, ERRS_C,
- $ RES, AYB, DY, Y_TAIL, RCOND,
- $ ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ BERR_OUT, N_NORMS, ERR_BNDS_NORM,
+ $ ERR_BNDS_COMP, RES, AYB, DY,
+ $ Y_TAIL, RCOND, ITHRESH, RTHRESH,
+ $ DZ_UB, IGNORE_CWISE, INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
COMPLEX*16 AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
$ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
DOUBLE PRECISION C( * ), AYB(*), RCOND, BERR_OUT( * ),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
-*
-* ZLA_GBRFSX_EXTENDED computes ... .
+*
+* ZLA_GBRFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by ZGBRFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* TRANS_TYPE (input) INTEGER
+* Specifies the transposition operation on A.
+* The value is defined by ILATRANS(T) where T is a CHARACTER and
+* T = 'N': No transpose
+* = 'T': Transpose
+* = 'C': Conjugate transpose
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* AB (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDAB (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AFB (input) COMPLEX*16 array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by ZGBTRF.
+*
+* LDAFB (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by ZGBTRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) COMPLEX*16 array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) COMPLEX*16 array, dimension (LDY,NRHS)
+* On entry, the solution matrix X, as computed by ZGBTRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) DOUBLE PRECISION array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by ZLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* normwise relative error, which is defined as follows:
+*
+* Normwise relative error in the ith solution vector:
+* max_j (abs(XTRUE(j,i) - X(j,i)))
+* ------------------------------
+* max_j abs(X(j,i))
+*
+* The array is indexed by the type of error information as described
+* below. There currently are up to three pieces of information
+* returned.
+*
+* The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_NORM(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* componentwise relative error, which is defined as follows:
+*
+* Componentwise relative error in the ith solution vector:
+* abs(XTRUE(j,i) - X(j,i))
+* max_j ----------------------
+* abs(X(j,i))
+*
+* The array is indexed by the right-hand side i (on which the
+* componentwise relative error depends), and the type of error
+* information as described below. There currently are up to three
+* pieces of information returned for each right-hand side. If
+* componentwise accuracy is not requested (PARAMS(3) = 0.0), then
+* ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) DOUBLE PRECISION array, dimension (N)
+* Workspace.
+*
+* DY (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) DOUBLE PRECISION
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) DOUBLE PRECISION
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to ZGBTRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
* Compute error bounds.
*
IF ( N_NORMS .GE. 1 ) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF ( N_NORMS .GE. 2 ) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
- DOUBLE PRECISION FUNCTION ZLA_GBRPVGRW( N, KL, KU, NCOLS, AB,
- $ LDAB, AFB, LDAFB )
+ DOUBLE PRECISION FUNCTION ZLA_GBRPVGRW( N, KL, KU, NCOLS, AB,
+ $ LDAB, AFB, LDAFB )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
*
* Purpose
* =======
-*
-* ZLA_GBRPVGRW computes ... .
+*
+* ZLA_GBRPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* KL (input) INTEGER
+* The number of subdiagonals within the band of A. KL >= 0.
+*
+* KU (input) INTEGER
+* The number of superdiagonals within the band of A. KU >= 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* AB (input) COMPLEX*16 array, dimension (LDAB,N)
+* On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
+* The j-th column of A is stored in the j-th column of the
+* array AB as follows:
+* AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
+*
+* LDAB (input) INTEGER
+* The leading dimension of the array AB. LDAB >= KL+KU+1.
+*
+* AFB (input) COMPLEX*16 array, dimension (LDAFB,N)
+* Details of the LU factorization of the band matrix A, as
+* computed by ZGBTRF. U is stored as an upper triangular
+* band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
+* and the multipliers used during the factorization are stored
+* in rows KL+KU+2 to 2*KL+KU+1.
+*
+* LDAFB (input) INTEGER
+* The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.
+*
* =====================================================================
*
* .. Local Scalars ..
* .. Executable Statements ..
*
RPVGRW = 1.0D+0
-*
+
KD = KU + 1
DO J = 1, NCOLS
AMAX = 0.0D+0
DOUBLE PRECISION FUNCTION ZLA_GERCOND_C( TRANS, N, A, LDA, AF,
- $ LDAF, IPIV, C, CAPPLY, INFO, WORK,
- $ RWORK )
+ $ LDAF, IPIV, C, CAPPLY,
+ $ INFO, WORK, RWORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Arguments
* =========
*
-* C DOUBLE PRECISION vector.
+* TRANS (input) CHARACTER*1
+* Specifies the form of the system of equations:
+* = 'N': A * X = B (No transpose)
+* = 'T': A**T * X = B (Transpose)
+* = 'C': A**H * X = B (Conjugate Transpose = Transpose)
*
-* WORK COMPLEX*16 workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK DOUBLE PRECISION workspace of size N.
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by ZGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by ZGETRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The vector C in the formula op(A) * inv(diag(C)).
+*
+* CAPPLY (input) LOGICAL
+* If .TRUE. then access the vector C in the formula above.
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX*16 array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) DOUBLE PRECISION array, dimension (N).
+* Workspace.
*
* =====================================================================
*
- DOUBLE PRECISION FUNCTION ZLA_GERCOND_X( TRANS, N, A, LDA, AF,
- $ LDAF, IPIV, X, INFO, WORK, RWORK )
+ DOUBLE PRECISION FUNCTION ZLA_GERCOND_X( TRANS, N, A, LDA, AF,
+ $ LDAF, IPIV, X, INFO,
+ $ WORK, RWORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Arguments
* =========
*
-* C COMPLEX*16 vector.
+* TRANS (input) CHARACTER*1
+* Specifies the form of the system of equations:
+* = 'N': A * X = B (No transpose)
+* = 'T': A**T * X = B (Transpose)
+* = 'C': A**H * X = B (Conjugate Transpose = Transpose)
*
-* WORK COMPLEX*16 workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK DOUBLE PRECISION workspace of size N.
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by ZGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by ZGETRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* X (input) COMPLEX*16 array, dimension (N)
+* The vector X in the formula op(A) * diag(X).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX*16 array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) DOUBLE PRECISION array, dimension (N).
+* Workspace.
*
* =====================================================================
*
*
* Purpose
* =======
-*
-* ZLA_GERFSX_EXTENDED computes ... .
+*
+* ZLA_GERFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by ZGERFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* TRANS_TYPE (input) INTEGER
+* Specifies the transposition operation on A.
+* The value is defined by ILATRANS(T) where T is a CHARACTER and
+* T = 'N': No transpose
+* = 'T': Transpose
+* = 'C': Conjugate transpose
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by ZGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* The pivot indices from the factorization A = P*L*U
+* as computed by ZGETRF; row i of the matrix was interchanged
+* with row IPIV(i).
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) COMPLEX*16 array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) COMPLEX*16 array, dimension (LDY,NRHS)
+* On entry, the solution matrix X, as computed by ZGETRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) DOUBLE PRECISION array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by ZLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* normwise relative error, which is defined as follows:
+*
+* Normwise relative error in the ith solution vector:
+* max_j (abs(XTRUE(j,i) - X(j,i)))
+* ------------------------------
+* max_j abs(X(j,i))
+*
+* The array is indexed by the type of error information as described
+* below. There currently are up to three pieces of information
+* returned.
+*
+* The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_NORM(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* componentwise relative error, which is defined as follows:
+*
+* Componentwise relative error in the ith solution vector:
+* abs(XTRUE(j,i) - X(j,i))
+* max_j ----------------------
+* abs(X(j,i))
+*
+* The array is indexed by the right-hand side i (on which the
+* componentwise relative error depends), and the type of error
+* information as described below. There currently are up to three
+* pieces of information returned for each right-hand side. If
+* componentwise accuracy is not requested (PARAMS(3) = 0.0), then
+* ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) DOUBLE PRECISION array, dimension (N)
+* Workspace.
+*
+* DY (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) DOUBLE PRECISION
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) DOUBLE PRECISION
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to ZGETRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
DOUBLE PRECISION FUNCTION ZLA_HERCOND_C( UPLO, N, A, LDA, AF,
- $ LDAF, IPIV, C, CAPPLY, INFO, WORK,
- $ RWORK )
+ $ LDAF, IPIV, C, CAPPLY,
+ $ INFO, WORK, RWORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Arguments
* =========
*
-* C DOUBLE PRECISION vector.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* WORK COMPLEX*16 workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK DOUBLE PRECISION workspace of size N.
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by ZHETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by CHETRF.
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The vector C in the formula op(A) * inv(diag(C)).
+*
+* CAPPLY (input) LOGICAL
+* If .TRUE. then access the vector C in the formula above.
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX*16 array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) DOUBLE PRECISION array, dimension (N).
+* Workspace.
*
* =====================================================================
*
- DOUBLE PRECISION FUNCTION ZLA_HERCOND_X( UPLO, N, A, LDA, AF,
- $ LDAF, IPIV, X, INFO, WORK, RWORK )
+ DOUBLE PRECISION FUNCTION ZLA_HERCOND_X( UPLO, N, A, LDA, AF,
+ $ LDAF, IPIV, X, INFO,
+ $ WORK, RWORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Arguments
* =========
*
-* C COMPLEX*16 vector.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* WORK COMPLEX*16 workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK DOUBLE PRECISION workspace of size N.
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by ZHETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by CHETRF.
+*
+* X (input) COMPLEX*16 array, dimension (N)
+* The vector X in the formula op(A) * diag(X).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX*16 array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) DOUBLE PRECISION array, dimension (N).
+* Workspace.
*
* =====================================================================
*
SUBROUTINE ZLA_HERFSX_EXTENDED( PREC_TYPE, UPLO, N, NRHS, A, LDA,
$ AF, LDAF, IPIV, COLEQU, C, B, LDB,
- $ Y, LDY, BERR_OUT, N_NORMS, ERRS_N,
- $ ERRS_C, RES, AYB, DY, Y_TAIL,
- $ RCOND, ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ Y, LDY, BERR_OUT, N_NORMS,
+ $ ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
+ $ AYB, DY, Y_TAIL, RCOND, ITHRESH,
+ $ RTHRESH, DZ_UB, IGNORE_CWISE,
+ $ INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
COMPLEX*16 A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
$ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
DOUBLE PRECISION C( * ), AYB( * ), RCOND, BERR_OUT( * ),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
*
-* ZLA_HERFSX_EXTENDED computes ... .
+* ZLA_HERFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by ZHERFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by ZHETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by ZHETRF.
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) COMPLEX*16 array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) COMPLEX*16 array, dimension
+* (LDY,NRHS)
+* On entry, the solution matrix X, as computed by ZHETRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) DOUBLE PRECISION array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by ZLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* normwise relative error, which is defined as follows:
+*
+* Normwise relative error in the ith solution vector:
+* max_j (abs(XTRUE(j,i) - X(j,i)))
+* ------------------------------
+* max_j abs(X(j,i))
+*
+* The array is indexed by the type of error information as described
+* below. There currently are up to three pieces of information
+* returned.
+*
+* The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_NORM(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* componentwise relative error, which is defined as follows:
+*
+* Componentwise relative error in the ith solution vector:
+* abs(XTRUE(j,i) - X(j,i))
+* max_j ----------------------
+* abs(X(j,i))
+*
+* The array is indexed by the right-hand side i (on which the
+* componentwise relative error depends), and the type of error
+* information as described below. There currently are up to three
+* pieces of information returned for each right-hand side. If
+* componentwise accuracy is not requested (PARAMS(3) = 0.0), then
+* ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) DOUBLE PRECISION array, dimension (N)
+* Workspace.
+*
+* DY (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) DOUBLE PRECISION
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) DOUBLE PRECISION
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to ZHETRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
DOUBLE PRECISION DLAMCH
* ..
* .. Intrinsic Functions ..
- INTRINSIC ABS, REAL, DIMAG, MAX, MIN
+ INTRINSIC ABS, DBLE, DIMAG, MAX, MIN
* ..
* .. Statement Functions ..
DOUBLE PRECISION CABS1
* Compute error bounds.
*
IF ( N_NORMS .GE. 1 ) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF (N_NORMS .GE. 2) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
DOUBLE PRECISION FUNCTION ZLA_HERPVGRW( UPLO, N, INFO, A, LDA, AF,
- $ LDAF, IPIV, WORK )
+ $ LDAF, IPIV, WORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Purpose
* =======
*
-* ZLA_HERPVGRW computes ... .
+* ZLA_HERPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* INFO (input) INTEGER
+* The value of INFO returned from ZHETRF, .i.e., the pivot in
+* column INFO is exactly 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by ZHETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by ZHETRF.
+*
+* WORK (input) COMPLEX*16 array, dimension (2*N)
+*
* =====================================================================
*
* .. Local Scalars ..
* where abs(Z) is the componentwise absolute value of the matrix
* or vector Z.
*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NZ (input) INTEGER
+* We add (NZ+1)*SLAMCH( 'Safe minimum' ) to R(i) in the numerator to
+* guard against spuriously zero residuals. Default value is N.
+*
+* NRHS (input) INTEGER
+* The number of right hand sides, i.e., the number of columns
+* of the matrices AYB, RES, and BERR. NRHS >= 0.
+*
+* RES (input) DOUBLE PRECISION array, dimension (N,NRHS)
+* The residual matrix, i.e., the matrix R in the relative backward
+* error formula above.
+*
+* AYB (input) DOUBLE PRECISION array, dimension (N, NRHS)
+* The denominator in the relative backward error formula above, i.e.,
+* the matrix abs(op(A_s))*abs(Y) + abs(B_s). The matrices A, Y, and B
+* are from iterative refinement (see zla_gerfsx_extended.f).
+*
+* RES (output) COMPLEX*16 array, dimension (NRHS)
+* The componentwise relative backward error from the formula above.
+*
* =====================================================================
*
* .. Local Scalars ..
DOUBLE PRECISION FUNCTION ZLA_PORCOND_C( UPLO, N, A, LDA, AF,
- $ LDAF, C, CAPPLY, INFO, WORK, RWORK )
+ $ LDAF, C, CAPPLY, INFO,
+ $ WORK, RWORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Purpose
* =======
*
-* DLA_PORCOND_C Computes the infinity norm condition number of
+* ZLA_PORCOND_C Computes the infinity norm condition number of
* op(A) * inv(diag(C)) where C is a DOUBLE PRECISION vector
*
* Arguments
* =========
*
-* C DOUBLE PRECISION vector.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* WORK COMPLEX*16 workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK DOUBLE PRECISION workspace of size N.
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by ZPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The vector C in the formula op(A) * inv(diag(C)).
+*
+* CAPPLY (input) LOGICAL
+* If .TRUE. then access the vector C in the formula above.
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX*16 array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) DOUBLE PRECISION array, dimension (N).
+* Workspace.
*
* =====================================================================
*
- DOUBLE PRECISION FUNCTION ZLA_PORCOND_X( UPLO, N, A, LDA, AF,
- $ LDAF, X, INFO, WORK, RWORK )
+ DOUBLE PRECISION FUNCTION ZLA_PORCOND_X( UPLO, N, A, LDA, AF,
+ $ LDAF, X, INFO, WORK,
+ $ RWORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Arguments
* =========
*
-* C COMPLEX*16 vector.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* WORK COMPLEX*16 workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK DOUBLE PRECISION workspace of size N.
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by ZPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* X (input) COMPLEX*16 array, dimension (N)
+* The vector X in the formula op(A) * diag(X).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX*16 array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) DOUBLE PRECISION array, dimension (N).
+* Workspace.
*
* =====================================================================
*
SUBROUTINE ZLA_PORFSX_EXTENDED( PREC_TYPE, UPLO, N, NRHS, A, LDA,
$ AF, LDAF, COLEQU, C, B, LDB, Y,
- $ LDY, BERR_OUT, N_NORMS, ERRS_N,
- $ ERRS_C, RES, AYB, DY, Y_TAIL,
- $ RCOND, ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ LDY, BERR_OUT, N_NORMS,
+ $ ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
+ $ AYB, DY, Y_TAIL, RCOND, ITHRESH,
+ $ RTHRESH, DZ_UB, IGNORE_CWISE,
+ $ INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
COMPLEX*16 A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
$ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
DOUBLE PRECISION C( * ), AYB( * ), RCOND, BERR_OUT( * ),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
*
-* ZLA_PORFSX_EXTENDED computes ... .
+* ZLA_PORFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by ZPORFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
-
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by ZPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) COMPLEX*16 array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) COMPLEX*16 array, dimension
+* (LDY,NRHS)
+* On entry, the solution matrix X, as computed by ZPOTRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) DOUBLE PRECISION array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by ZLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* normwise relative error, which is defined as follows:
+*
+* Normwise relative error in the ith solution vector:
+* max_j (abs(XTRUE(j,i) - X(j,i)))
+* ------------------------------
+* max_j abs(X(j,i))
+*
+* The array is indexed by the type of error information as described
+* below. There currently are up to three pieces of information
+* returned.
+*
+* The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_NORM(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* componentwise relative error, which is defined as follows:
+*
+* Componentwise relative error in the ith solution vector:
+* abs(XTRUE(j,i) - X(j,i))
+* max_j ----------------------
+* abs(X(j,i))
+*
+* The array is indexed by the right-hand side i (on which the
+* componentwise relative error depends), and the type of error
+* information as described below. There currently are up to three
+* pieces of information returned for each right-hand side. If
+* componentwise accuracy is not requested (PARAMS(3) = 0.0), then
+* ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) DOUBLE PRECISION array, dimension (N)
+* Workspace.
+*
+* DY (input) COMPLEX*16 PRECISION array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) DOUBLE PRECISION
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) DOUBLE PRECISION
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to ZPOTRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
DOUBLE PRECISION DLAMCH
* ..
* .. Intrinsic Functions ..
- INTRINSIC ABS, REAL, DIMAG, MAX, MIN
+ INTRINSIC ABS, DBLE, DIMAG, MAX, MIN
* ..
* .. Statement Functions ..
DOUBLE PRECISION CABS1
* Compute error bounds.
*
IF (N_NORMS .GE. 1) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF (N_NORMS .GE. 2) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
DOUBLE PRECISION FUNCTION ZLA_PORPVGRW( UPLO, NCOLS, A, LDA, AF,
- $ LDAF, WORK )
+ $ LDAF, WORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Purpose
* =======
*
-* ZLA_PORPVGRW computes ... .
+* ZLA_PORPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The triangular factor U or L from the Cholesky factorization
+* A = U**T*U or A = L*L**T, as computed by ZPOTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* WORK (input) COMPLEX*16 array, dimension (2*N)
+*
* =====================================================================
*
* .. Local Scalars ..
* Purpose
* =======
*
-* ZLA_RPVGRW computes ... .
+* ZLA_RPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) DOUBLE PRECISION array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) DOUBLE PRECISION array, dimension (LDAF,N)
+* The factors L and U from the factorization
+* A = P*L*U as computed by ZGETRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
* =====================================================================
*
* .. Local Scalars ..
* .. Executable Statements ..
*
RPVGRW = 1.0D+0
-*
+
DO J = 1, NCOLS
AMAX = 0.0D+0
UMAX = 0.0D+0
- DOUBLE PRECISION FUNCTION ZLA_SYRCOND_C( UPLO, N, A, LDA, AF,
- $ LDAF, IPIV, C, CAPPLY, INFO, WORK,
- $ RWORK )
+ DOUBLE PRECISION FUNCTION ZLA_SYRCOND_C( UPLO, N, A, LDA, AF,
+ $ LDAF, IPIV, C, CAPPLY,
+ $ INFO, WORK, RWORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Arguments
* =========
*
-* C DOUBLE PRECISION vector.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* WORK COMPLEX*16 workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK DOUBLE PRECISION workspace of size N.
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by ZSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by ZSYTRF.
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The vector C in the formula op(A) * inv(diag(C)).
+*
+* CAPPLY (input) LOGICAL
+* If .TRUE. then access the vector C in the formula above.
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX*16 array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) DOUBLE PRECISION array, dimension (N).
+* Workspace.
*
* =====================================================================
*
- DOUBLE PRECISION FUNCTION ZLA_SYRCOND_X( UPLO, N, A, LDA, AF,
- $ LDAF, IPIV, X, INFO, WORK, RWORK )
+ DOUBLE PRECISION FUNCTION ZLA_SYRCOND_X( UPLO, N, A, LDA, AF,
+ $ LDAF, IPIV, X, INFO,
+ $ WORK, RWORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Arguments
* =========
*
-* C COMPLEX*16 vector.
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
*
-* WORK COMPLEX*16 workspace of size 2*N.
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
*
-* RWORK DOUBLE PRECISION workspace of size N.
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by ZSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by ZSYTRF.
+*
+* X (input) COMPLEX*16 array, dimension (N)
+* The vector X in the formula op(A) * diag(X).
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* i > 0: The ith argument is invalid.
+*
+* WORK (input) COMPLEX*16 array, dimension (2*N).
+* Workspace.
+*
+* RWORK (input) DOUBLE PRECISION array, dimension (N).
+* Workspace.
*
* =====================================================================
*
SUBROUTINE ZLA_SYRFSX_EXTENDED( PREC_TYPE, UPLO, N, NRHS, A, LDA,
$ AF, LDAF, IPIV, COLEQU, C, B, LDB,
- $ Y, LDY, BERR_OUT, N_NORMS, ERRS_N,
- $ ERRS_C, RES, AYB, DY, Y_TAIL,
- $ RCOND, ITHRESH, RTHRESH, DZ_UB,
- $ IGNORE_CWISE, INFO )
+ $ Y, LDY, BERR_OUT, N_NORMS,
+ $ ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
+ $ AYB, DY, Y_TAIL, RCOND, ITHRESH,
+ $ RTHRESH, DZ_UB, IGNORE_CWISE,
+ $ INFO )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
COMPLEX*16 A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
$ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
DOUBLE PRECISION C( * ), AYB( * ), RCOND, BERR_OUT( * ),
- $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * )
+ $ ERR_BNDS_NORM( NRHS, * ),
+ $ ERR_BNDS_COMP( NRHS, * )
* ..
*
* Purpose
* =======
-*
-* ZLA_SYRFSX_EXTENDED computes ... .
+*
+* ZLA_SYRFSX_EXTENDED improves the computed solution to a system of
+* linear equations by performing extra-precise iterative refinement
+* and provides error bounds and backward error estimates for the solution.
+* This subroutine is called by ZSYRFSX to perform iterative refinement.
+* 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. Note that this
+* subroutine is only resonsible for setting the second fields of
+* ERR_BNDS_NORM and ERR_BNDS_COMP.
*
* Arguments
* =========
*
+* PREC_TYPE (input) INTEGER
+* Specifies the intermediate precision to be used in refinement.
+* The value is defined by ILAPREC(P) where P is a CHARACTER and
+* P = 'S': Single
+* = 'D': Double
+* = 'I': Indigenous
+* = 'X', 'E': Extra
+*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* NRHS (input) INTEGER
+* The number of right-hand-sides, i.e., the number of columns of the
+* matrix B.
+*
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by ZSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by ZSYTRF.
+*
+* COLEQU (input) LOGICAL
+* If .TRUE. then column equilibration was done to A before calling
+* this routine. This is needed to compute the solution and error
+* bounds correctly.
+*
+* C (input) DOUBLE PRECISION array, dimension (N)
+* The column scale factors for A. If COLEQU = .FALSE., C
+* is not accessed. If C is input, each element of C 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 (input) COMPLEX*16 array, dimension (LDB,NRHS)
+* The right-hand-side matrix B.
+*
+* LDB (input) INTEGER
+* The leading dimension of the array B. LDB >= max(1,N).
+*
+* Y (input/output) COMPLEX*16 array, dimension
+* (LDY,NRHS)
+* On entry, the solution matrix X, as computed by ZSYTRS.
+* On exit, the improved solution matrix Y.
+*
+* LDY (input) INTEGER
+* The leading dimension of the array Y. LDY >= max(1,N).
+*
+* BERR_OUT (output) DOUBLE PRECISION array, dimension (NRHS)
+* On exit, BERR_OUT(j) contains the componentwise relative backward
+* error for right-hand-side j from the formula
+* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
+* where abs(Z) is the componentwise absolute value of the matrix
+* or vector Z. This is computed by ZLA_LIN_BERR.
+*
+* N_NORMS (input) INTEGER
+* Determines which error bounds to return (see ERR_BNDS_NORM
+* and ERR_BNDS_COMP).
+* If N_NORMS >= 1 return normwise error bounds.
+* If N_NORMS >= 2 return componentwise error bounds.
+*
+* ERR_BNDS_NORM (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* normwise relative error, which is defined as follows:
+*
+* Normwise relative error in the ith solution vector:
+* max_j (abs(XTRUE(j,i) - X(j,i)))
+* ------------------------------
+* max_j abs(X(j,i))
+*
+* The array is indexed by the type of error information as described
+* below. There currently are up to three pieces of information
+* returned.
+*
+* The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_NORM(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated normwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* ERR_BNDS_COMP (input/output) DOUBLE PRECISION array, dimension
+* (NRHS, N_ERR_BNDS)
+* For each right-hand side, this array contains information about
+* various error bounds and condition numbers corresponding to the
+* componentwise relative error, which is defined as follows:
+*
+* Componentwise relative error in the ith solution vector:
+* abs(XTRUE(j,i) - X(j,i))
+* max_j ----------------------
+* abs(X(j,i))
+*
+* The array is indexed by the right-hand side i (on which the
+* componentwise relative error depends), and the type of error
+* information as described below. There currently are up to three
+* pieces of information returned for each right-hand side. If
+* componentwise accuracy is not requested (PARAMS(3) = 0.0), then
+* ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most
+* the first (:,N_ERR_BNDS) entries are returned.
+*
+* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
+* right-hand side.
+*
+* The second index in ERR_BNDS_COMP(:,err) contains the following
+* three fields:
+* err = 1 "Trust/don't trust" boolean. Trust the answer if the
+* reciprocal condition number is less than the threshold
+* sqrt(n) * slamch('Epsilon').
+*
+* err = 2 "Guaranteed" 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: Estimated componentwise
+* reciprocal condition number. Compared with the threshold
+* sqrt(n) * slamch('Epsilon') to determine if the error
+* estimate is "guaranteed". 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.
+*
+* This subroutine is only responsible for setting the second field
+* above.
+* See Lapack Working Note 165 for further details and extra
+* cautions.
+*
+* RES (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the intermediate residual.
+*
+* AYB (input) DOUBLE PRECISION array, dimension (N)
+* Workspace.
+*
+* DY (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the intermediate solution.
+*
+* Y_TAIL (input) COMPLEX*16 array, dimension (N)
+* Workspace to hold the trailing bits of the intermediate solution.
+*
+* RCOND (input) 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.
+*
+* ITHRESH (input) INTEGER
+* The maximum number of residual computations allowed for
+* refinement. The default is 10. For '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.
+*
+* RTHRESH (input) DOUBLE PRECISION
+* Determines when to stop refinement if the error estimate stops
+* decreasing. Refinement will stop when the next solution no longer
+* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
+* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
+* default value is 0.5. For 'aggressive' set to 0.9 to permit
+* convergence on extremely ill-conditioned matrices. See LAWN 165
+* for more details.
+*
+* DZ_UB (input) DOUBLE PRECISION
+* Determines when to start considering componentwise convergence.
+* Componentwise convergence is only considered after each component
+* of the solution Y is stable, which we definte as the relative
+* change in each component being less than DZ_UB. The default value
+* is 0.25, requiring the first bit to be stable. See LAWN 165 for
+* more details.
+*
+* IGNORE_CWISE (input) LOGICAL
+* If .TRUE. then ignore componentwise convergence. Default value
+* is .FALSE..
+*
+* INFO (output) INTEGER
+* = 0: Successful exit.
+* < 0: if INFO = -i, the ith argument to ZSYTRS had an illegal
+* value
+*
* =====================================================================
*
* .. Local Scalars ..
$ Y( 1, J ), 1, DCMPLX(1.0D+0), RES, 1, PREC_TYPE )
ELSE
CALL BLAS_ZSYMV2_X(UPLO2, N, DCMPLX(-1.0D+0), A, LDA,
- $ Y(1, J), Y_TAIL, 1, DCMPLX(1.0D+0), RES, 1,
+ $ Y(1, J), Y_TAIL, 1, DCMPLX(1.0D+0), RES, 1,
$ PREC_TYPE)
END IF
* Compute error bounds.
*
IF ( N_NORMS .GE. 1 ) THEN
- ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX)
+ ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DX_X / (1 - DXRATMAX)
END IF
IF ( N_NORMS .GE. 2 ) THEN
- ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX)
+ ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
+ $ FINAL_DZ_Z / (1 - DZRATMAX)
END IF
*
* Compute componentwise relative backward error from formula
DOUBLE PRECISION FUNCTION ZLA_SYRPVGRW( UPLO, N, INFO, A, LDA, AF,
- $ LDAF, IPIV, WORK )
+ $ LDAF, IPIV, WORK )
*
* -- LAPACK routine (version 3.2) --
* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
* Purpose
* =======
*
-* ZLA_SYRPVGRW computes ... .
+* ZLA_SYRPVGRW computes the reciprocal pivot growth factor
+* norm(A)/norm(U). The "max absolute element" norm is used. If this is
+* much less than 1, 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.
*
* Arguments
* =========
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
+* N (input) INTEGER
+* The number of linear equations, i.e., the order of the
+* matrix A. N >= 0.
+*
+* INFO (input) INTEGER
+* The value of INFO returned from ZSYTRF, .i.e., the pivot in
+* column INFO is exactly 0.
+*
+* NCOLS (input) INTEGER
+* The number of columns of the matrix A. NCOLS >= 0.
+*
+* A (input) COMPLEX*16 array, dimension (LDA,N)
+* On entry, the N-by-N matrix A.
+*
+* LDA (input) INTEGER
+* The leading dimension of the array A. LDA >= max(1,N).
+*
+* AF (input) COMPLEX*16 array, dimension (LDAF,N)
+* The block diagonal matrix D and the multipliers used to
+* obtain the factor U or L as computed by ZSYTRF.
+*
+* LDAF (input) INTEGER
+* The leading dimension of the array AF. LDAF >= max(1,N).
+*
+* IPIV (input) INTEGER array, dimension (N)
+* Details of the interchanges and the block structure of D
+* as determined by ZSYTRF.
+*
+* WORK (input) COMPLEX*16 array, dimension (2*N)
+*
* =====================================================================
*
* .. Local Scalars ..
*
* ZLARSCL2 performs a reciprocal diagonal scaling on an vector:
* x <-- inv(D) * x
-* where the diagonal matrix D is stored as a vector.
-* Eventually to be replaced by BLAS_sge_diag_scale in the new BLAS
+* where the DOUBLE PRECISION diagonal matrix D is stored as a vector.
+*
+* Eventually to be replaced by BLAS_zge_diag_scale in the new BLAS
* standard.
*
* Arguments
* =========
-* N (input) INTEGER
-* The size of the vectors X and D.
-*
-* D (input) DOUBLE PRECISION array, length N
-* Diagonal matrix D, stored as a vector of length N.
-* X (input/output) COMPLEX*16 array, length N
-* On entry, the vector X to be scaled by D.
-* On exit, the scaled vector.
-* ..
+*
+* M (input) INTEGER
+* The number of rows of D and X. M >= 0.
+*
+* N (input) INTEGER
+* The number of columns of D and X. N >= 0.
+*
+* D (input) DOUBLE PRECISION array, length M
+* Diagonal matrix D, stored as a vector of length M.
+*
+* X (input/output) COMPLEX*16 array, dimension (LDX,N)
+* On entry, the vector X to be scaled by D.
+* On exit, the scaled vector.
+*
+* LDX (input) INTEGER
+* The leading dimension of the vector X. LDX >= 0.
+*
+* =====================================================================
+*
* .. Local Scalars ..
INTEGER I, J
* ..
*
DO J = 1, N
DO I = 1, M
- X(I,J) = X(I,J) / D(I)
+ X( I, J ) = X( I, J ) / D( I )
END DO
END DO
-*
+
RETURN
END
-*
+
*
* ZLASCL2 performs a diagonal scaling on a vector:
* x <-- D * x
-* where the diagonal matrix D is stored as a vector.
-* Eventually to be replaced by BLAS_sge_diag_scale in the new BLAS
+* where the DOUBLE PRECISION diagonal matrix D is stored as a vector.
+*
+* Eventually to be replaced by BLAS_zge_diag_scale in the new BLAS
* standard.
*
* Arguments
* =========
-* N (input) INTEGER
-* The size of the vectors X and D.
-*
-* D (input) DOUBLE PRECISION array, length N
-* Diagonal matrix D, stored as a vector of length N.
-* X (input/output) COMPLEX*16 array, length N
-* On entry, the vector X to be scaled by D.
-* On exit, the scaled vector.
-* ..
+*
+* M (input) INTEGER
+* The number of rows of D and X. M >= 0.
+*
+* N (input) INTEGER
+* The number of columns of D and X. N >= 0.
+*
+* D (input) DOUBLE PRECISION array, length M
+* Diagonal matrix D, stored as a vector of length M.
+*
+* X (input/output) COMPLEX*16 array, dimension (LDX,N)
+* On entry, the vector X to be scaled by D.
+* On exit, the scaled vector.
+*
+* LDX (input) INTEGER
+* The leading dimension of the vector X. LDX >= 0.
+*
+* =====================================================================
+*
* .. Local Scalars ..
INTEGER I, J
* ..
*
DO J = 1, N
DO I = 1, M
- X(I,J) = X(I,J) * D(I)
+ X( I, J ) = X( I, J ) * D( I )
END DO
END DO
-*
+
RETURN
END
-*
+
- Subroutine ZPORFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, S, B,
+ SUBROUTINE ZPORFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, S, B,
$ LDB, X, LDX, RCOND, BERR, N_ERR_BNDS,
$ ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
$ WORK, RWORK, INFO )
* definite, and provides error bounds and backward error estimates
* for the solution. In addition to normwise error bound, the code
* provides maximum componentwise error bound if possible. See
-* comments for ERR_BNDS for details of the error bounds.
+* 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
- Subroutine ZSYRFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, IPIV,
+ 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 )
* 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_N and ERR_BNDS_C for details of the error bounds.
+* 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
* = 'E': The matrix A will be equilibrated if necessary, then
* copied to AF and factored.
*
+* UPLO (input) CHARACTER*1
+* = 'U': Upper triangle of A is stored;
+* = 'L': Lower triangle of A is stored.
+*
* N (input) INTEGER
* The number of linear equations, i.e., the order of the
* matrix A. N >= 0.