## TRISOLV Function

**solves linear systems with triangular matrices**
**TRISOLV(** *code, **r*, *b*<, piv>**)**

The TRISOLV function returns the following value:
*x*
- is the
*n* ×*p* matrix **X** containing *p* solutions of
the *p* linear systems specified by *code*, *r*, and *b*.

The inputs to the TRISOLV function are as follows:
*code*
- specifies which of the following forms of
triangular linear system has to be solved:
*code*=1
- solve
**R****x** = **b**, **R** upper triangular

*code*=2
- solve
**R**' **x** = **b**, **R** upper triangular

*code*=3
- solve
**R**' **x** = **b**, **R** lower triangular

*code*=4
- solve
**R****x** = **b**, **R** lower triangular

*r*
- specifies the
*n* ×*n* nonsingular upper (*code*=1,2)
or lower (*code*=3,4) triangular coefficient matrix **R**.
Only the upper or lower triangle of argument matrix *r*
is used; the other triangle can contain any information.

*b*
- specifies the
*n* ×*p* matrix,
**B**, of *p* right-hand sides **b**_{k}.

*piv*
- specifies an optional
*n* vector that relates the
order of the columns of matrix **R** to the order of
the columns of an original coefficient matrix **A**
for which matrix **R** has been computed as a factor.
For example, the vector *piv* can be the result of
the QR decomposition of a matrix **A** whose columns were
permuted in the order **A**_{piv[1]}, ... , **A**_{piv[n]}.

For *code*=1 and *code*=3, the
solution is obtained by backward elimination.
For *code*=2 and *code*=4, the
solution is obtained by forward substitution.
If TRISOLV recognizes the upper or lower triangular matrix
**R** as a singular matrix (that is, one that contains at least
one zero diagonal element), it exits with an error message.

See the example in the QR call section.

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.