# p?trtrs

Solves a system of linear equations with a triangular distributed matrix.

## Syntax

call pstrtrs(uplo, trans, diag, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, info)

call pdtrtrs(uplo, trans, diag, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, info)

call pctrtrs(uplo, trans, diag, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, info)

call pztrtrs(uplo, trans, diag, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, info)

## Description

This routine solves for X one of the following systems of linear equations:

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

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

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

where `sub(A) = A(ia:ia+n-1, ja:ja+n-1)` is a triangular distributed matrix of order n, and sub(B) denotes the distributed matrix `B(ib:ib+n-1, jb:jb+nrhs-1)`.

A check is made to verify that sub(A) is nonsingular.

## Input Parameters

uplo

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

  Indicates whether sub(A) is upper or lower triangular:

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

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

trans

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

  Indicates the form of the equations:

  If `trans = 'N'`, then `sub(A)*X = sub(B)` is solved for X.

  If `trans = 'T'`, then `sub(A)T*X = sub(B)` is solved for X.

  If `trans = 'C'`, then `sub(A)H*X = sub(B)` is solved for X.

diag

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

  If `diag = 'N'`, then sub(A) is not a unit triangular matrix.

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

n

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

nrhs

  (global) INTEGER. The number of right-hand sides; i.e., the number of columns of the distributed matrix sub(B) `(nrhs≥0)`.

a, b

  (local)

  REAL for pstrtrs

  DOUBLE PRECISION for pdtrtrs

  COMPLEX for pctrtrs

  DOUBLE COMPLEX for pztrtrs.

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

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

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

  If `uplo = 'L'`, the leading n-by-n lower triangular part of sub(A) contains the lower triangular matrix, and the strictly upper triangular part of sub(A) 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 right hand side distributed matrix sub(B).

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.

## Output Parameters

b

  On exit, if `info=0`, sub(B) is overwritten by the solution matrix X.

info

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

  `info < 0`:

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

  `info > 0`:

  if info = i, the i-th diagonal element of sub(A) is zero, indicating that the submatrix is singular and the solutions X have not been computed.

Parent topic: Routines for Solving Systems of Linear Equations