Language Reference

TRISOLV Function

solves linear systems with triangular matrices

TRISOLV( code, r, b\lt, piv>)

The TRISOLV function returns the following value:


x
is the n x 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 x 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 x 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.

Consider the following example:

  
    R = { 1  0  0  0, 
          3  2  0  0, 
          1 -3  5  0, 
          2  7  9 -1 }; 
  
    b = {1, 1, 4, -6 }; 
    x = trisolv(4, R, b); 
    print x; 
  
  
  
                                X 
  
                                    1 
                                   -1 
                                    0 
                                    1
 

Also see the example in the QR call section.

Previous Page | Next Page | Top of Page