# p?trrfs

Provides error bounds and backward error estimates for the solution to a system of linear equations with a distributed triangular coefficient matrix.

## Syntax

call pstrrfs(uplo, trans, diag, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, x, ix, jx, descx, ferr, berr, work, lwork, iwork, liwork, info)

call pdtrrfs(uplo, trans, diag, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, x, ix, jx, descx, ferr, berr, work, lwork, iwork, liwork, info)

call pctrrfs(uplo, trans, diag, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, x, ix, jx, descx, ferr, berr, work, lwork, rwork, lrwork, info)

call pztrrfs(uplo, trans, diag, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, x, ix, jx, descx, ferr, berr, work, lwork, rwork, lrwork, info)

## Description

The routine p?trrfs provides error bounds and backward error estimates for the solution to one of the systems of linear equations

`sub(A)*sub(X) = sub(B)`,

`sub(A)T*sub(X) = sub(B)`, or

`sub(A)H*sub(X) = sub(B)` ,

where `sub(A) = A(ia:ia+n-1, ja:ja+n-1)` is a triangular matrix,

`sub(B) = B(ib:ib+n-1, jb:jb+nrhs-1)`, and

`sub(X) = X(ix:ix+n-1, jx:jx+nrhs-1)`.

The solution matrix X must be computed by p?trtrs or some other means before entering this routine. The routine p?trrfs does not do iterative refinement because doing so cannot improve the backward error.

## Input Parameters

uplo

  (global) CHARACTER*1. Must be 'U' or 'L'.

  If `uplo = 'U'`, sub(A) is upper triangular. If `uplo = 'L'`, sub(A) is lower triangular.

trans

  (global) CHARACTER*1. Must be 'N' or 'T' or 'C'.

  Specifies the form of the system of equations:

  If `trans = 'N'`, the system has the form `sub(A)*sub(X) = sub(B)` (No transpose);

  If `trans = 'T'`, the system has the form `sub((A)T*sub(X) = sub(B)` (Transpose);

  If `trans = 'C'`, the system has the form `sub(A)H*sub(X) = sub(B)` (Conjugate transpose).

diag

  CHARACTER*1. Must be 'N' or 'U'.

  If `diag = 'N'`, then sub(A) is non-unit triangular.

  If `diag = 'U'`, then sub(A) is unit triangular.

n

  (global) INTEGER. The order of the distributed matrix sub(A) `(n≥0)`.

nrhs

  (global) INTEGER. The number of right-hand sides, that is, the number of columns of the matrices sub(B) and sub(X) `(nrhs≥0)`.

a, b, x

  (local)

  REAL for pstrrfs

  DOUBLE PRECISION for pdtrrfs

  COMPLEX for pctrrfs

  DOUBLE COMPLEX for pztrrfs.

  Pointers into the local memory to arrays of local dimension `a(lld_a,LOCc(ja+n-1))`, `b(lld_b,LOCc(jb+nrhs-1))`, and `x(lld_x,LOCc(jx+nrhs-1))`, respectively.

  The array a contains the local pieces of the original triangular distributed matrix sub(A).

  If `uplo = 'U'`, the leading n-by-n upper triangular part of sub(A) contains the upper triangular part of the matrix, and its strictly lower triangular part is not referenced.

  If `uplo = 'L'`, the leading n-by-n lower triangular part of sub(A) contains the lower triangular part of the distributed matrix, and its strictly upper triangular part is not referenced.

  If `diag = 'U'`, the diagonal elements of sub(A) are also not referenced and are assumed to be 1.

  On entry, the array b contains the local pieces of the distributed matrix of right hand sides sub(B).

  On entry, the array x contains the local pieces of the solution vectors sub(X).

ia, ja

  (global) INTEGER. The row and column indices in the global array A indicating the first row and the first column of the submatrix sub(A), respectively.

desca

  (global and local) INTEGER array, dimension (dlen_). The array descriptor for the distributed matrix A.

ib, jb

  (global) INTEGER. The row and column indices in the global array B indicating the first row and the first column of the submatrix sub(B), respectively.

descb

  (global and local) INTEGER array, dimension (dlen_). The array descriptor for the distributed matrix B.

ix, jx

  (global) INTEGER. The row and column indices in the global array X indicating the first row and the first column of the submatrix sub(X), respectively.

descx

  (global and local) INTEGER array, dimension (dlen_). The array descriptor for the distributed matrix X.

work

  (local)

  REAL for pstrrfs

  DOUBLE PRECISION for pdtrrfs

  COMPLEX for pctrrfs

  DOUBLE COMPLEX for pztrrfs.

  The array work of dimension (lwork) is a workspace array.

lwork

  (local) INTEGER. The dimension of the array work.

  For real flavors:

  lwork must be at least `lwork ≥ 3*LOCr(n+mod(ia-1,mb_a))`

  For complex flavors:

  lwork must be at least

  `lwork ≥ 2*LOCr(n+mod(ia-1,mb_a))`

iwork

  (local) INTEGER. Workspace array, DIMENSION (liwork). Used in real flavors only.

liwork

  (local or global) INTEGER. The dimension of the array iwork; used in real flavors only. Must be at least

  `liwork ≥ LOCr(n+mod(ib-1,mb_b))`.

rwork

  (local) REAL for pctrrfs

  DOUBLE PRECISION for pztrrfs

  Workspace array, DIMENSION (lrwork). Used in complex flavors only.

lrwork

  (local or global) INTEGER. The dimension of the array rwork; used in complex flavors only. Must be at least `lrwork ≥ LOCr(n+mod(ib-1,mb_b)))`.

## Output Parameters

ferr, berr

  REAL for single precision flavors.

  DOUBLE PRECISION for double precision flavors.

  Arrays, dimension `LOCc(jb+nrhs-1)` each.

  The array ferr contains the estimated forward error bound for each solution vector of sub(X).

  If XTRUE is the true solution corresponding to sub(X), ferr is an estimated upper bound for the magnitude of the largest element in (sub(X) - XTRUE) divided by the magnitude of the largest element in sub(X). The estimate is as reliable as the estimate for rcond, and is almost always a slight overestimate of the true error.

  This array is tied to the distributed matrix X.

  The array berr contains the component-wise relative backward error of each solution vector (that is, the smallest relative change in any entry of sub(A) or sub(B) that makes sub(X) an exact solution). This array is tied to the distributed matrix X.

`work(1)`

  On exit, `work(1)` contains the minimum value of lwork required for optimum performance.

`iwork(1)`

  On exit, `iwork(1)` contains the minimum value of liwork required for optimum performance (for real flavors).

`rwork(1)`

  On exit, `rwork(1)` contains the minimum value of lrwork required for optimum performance (for complex flavors).

info

  (global) INTEGER. If `info=0`, the execution is successful.

  info < 0:

  If the i-th argument is an array and the j-th entry had an illegal value, then `info = -(i*100+j)`; if the i-th argument is a scalar and had an illegal value, then info = -i.

Parent topic: Refining the Solution and Estimating Its Error