!----------------------------------------------------------------- ! ! Purpose ! ======= ! ! LA_GERFS improves the computed solution X of a system of linear ! equations A X = B or A^T X = B ! and provides error bounds and backward error estimates for ! the solution. LA_GERFS uses the LU factors computed by LA_GETRF. ! ! Arguments ! ========= ! SUBROUTINE LA_GERFS (A, AF, IPIV, B, X, TRANS, FERR, BERR, INFO) ! (), INTENT(IN) :: A(:,:), AF(:,:), ! INTEGER, INTENT(IN) :: IPIV(:) ! (), INTENT(INOUT) :: ! REAL(), INTENT(OUT), OPTIONAL :: ! CHARACTER(LEN=1), INTENT(IN), OPTIONAL :: TRANS ! INTEGER, INTENT(OUT), OPTIONAL :: INFO ! where ! ::= REAL | COMPLEX ! ::= KIND(1.0) | KIND(1.0D0) ! ::= B(:,:) | B(:) ! ::= X(:,:) | X(:) ! ::= FERR(:), BERR(:) | FERR, BERR ! ! ===================== ! ! A (input) either REAL or COMPLEX square array, ! shape (:,:), size(A,1) == size(A,2). ! The original matrix A. ! ! AF (input) either REAL or COMPLEX square array, ! shape (:,:), size(AF,1) == size(AF,2) == size(A,1). ! The factors L and U from the factorization A = PLU ! as computed by LA_GETRF. ! ! IPIV (input) INTEGER array, shape (:), size(IPIV) == size(A,1). ! The pivot indices from LA_GETRF; for 1<=i<=size(A,1), row i ! of the matrix was interchanged with row IPIV(i). ! ! B (input) either REAL or COMPLEX rectangular array, ! shape either (:,:) or (:), size(B,1) or size(B) == size(A,1). ! The right hand side vector(s) of matrix B for ! the system of equations AX = B. ! ! X (input/output) either REAL or COMPLEX rectangular array, ! shape either (:,:) or (:), size(X,1) or size(X) == size(A,1). ! On entry, the solution matrix X, as computed by LA_GETRS. ! On exit, the improved solution matrix X. ! ! TRANS Optional (input) CHARACTER*1 ! If TRANS is present, it 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) ! otherwise TRANS = 'N' is assumed. ! ! FERR Optional (output) either REAL array of shape (:) or REAL ! scalar. If it is an array, size(FERR) == size(X,2). ! The estimated forward error bound for each solution vector ! X(j) (the j-th column of the solution matrix X). ! If XTRUE is the true solution corresponding to X(j), FERR(j) ! is an estimated upper bound for the magnitude of the largest ! element in (X(j) - XTRUE) divided by the magnitude of the ! largest element in X(j). The estimate is as reliable as ! the estimate for RCOND, and is almost always a slight ! overestimate of the true error. ! ! BERR Optional (output) either REAL array of shape (:) or REAL ! scalar. If it is an array, size(BERR) == size(X,2). ! The componentwise relative backward error of each solution ! vector X(j) (i.e., the smallest relative change in ! any element of A or B that makes X(j) an exact solution). ! ! INFO Optional (output) INTEGER. ! If INFO is present ! = 0: successful exit ! < 0: if INFO = -k, the k-th argument had an illegal value ! If INFO is not present and an error occurs, then the program is ! terminated with an error message. ! ! Internal Parameters ! =================== ! ! ITMAX is the maximum number of steps of iterative refinement. ! It is set to 5 in the LAPACK77 subroutines ! ----------------------------------- .