# p?getrs

Solves a system of distributed linear equations with a general square matrix, using the LU factorization computed by p?getrf.

## Syntax

call psgetrs(trans, n, nrhs, a, ia, ja, desca, ipiv, b, ib, jb, descb, info)

call pdgetrs(trans, n, nrhs, a, ia, ja, desca, ipiv, b, ib, jb, descb, info)

call pcgetrs(trans, n, nrhs, a, ia, ja, desca, ipiv, b, ib, jb, descb, info)

call pzgetrs(trans, n, nrhs, a, ia, ja, desca, ipiv, b, ib, jb, descb, info)

## Description

This routine solves a system of distributed linear equations with a general n-by-n distributed matrix `sub(A) = A(ia:ia+n-1, ja:ja+n-1)` using the LU factorization computed by p?getrf.

The system has one of the following forms specified by trans:

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

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

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

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

Before calling this routine, you must call p?getrf to compute the LU factorization of sub(A).

## Input Parameters

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.

n

  (global) INTEGER. The number of linear equations; the order of the submatrix `sub(A) (n≥0)`.

nrhs

  (global) INTEGER. The number of right hand sides; the number of columns of the distributed submatrix `sub(B) (nrhs≥0)`.

a, b

  (global)

  REAL for psgetrs

  DOUBLE PRECISION for pdgetrs

  COMPLEX for pcgetrs

  DOUBLE COMPLEX for pzgetrs.

  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.

  On entry, the array a contains the local pieces of the factors L and U from the factorization `sub(A) = P*L*U`; the unit diagonal elements of L are not stored. On entry, the array b contains the right hand sides 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.

ipiv

  (local) INTEGER array.

  The dimension of ipiv is (`LOCr(m_a) + mb_a)`. This array contains the pivoting information: local row i of the matrix was interchanged with the global row ipiv(i).

  This array is tied to 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, overwritten by the solution distributed matrix X.

info

  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: Routines for Solving Systems of Linear Equations