TRISOLV
(form, R, b <, piv> ) ;
The TRISOLV function efficiently solves linear systems that involve a triangular matrix.
The TRISOLV function returns the matrix that contains solutions of the linear systems specified by form, R, and b.
The arguments to the TRISOLV function are as follows:
specifies which of the following form of a triangular linear system is to be solved:
solve , upper triangular
solve , upper triangular
solve , lower triangular
solve , lower triangular
specifies the nonsingular upper (form=1,2) or lower (form=3,4) triangular coefficient matrix . Only the upper or lower triangle of argument matrix R is used; the other triangle can contain any information.
specifies the matrix, , of right-hand sides .
specifies an optional vector that relates the order of the columns of matrix to the order of the columns of an original coefficient matrix for which matrix has been computed as a factor. For example, the vector piv can be the result of the QR decomposition of a matrix whose columns were permuted in the order .
For form=1 and form=3, the solution is obtained by backward elimination. For form=2 and form=4, the solution is obtained by forward substitution.
If TRISOLV recognizes the upper or lower triangular matrix 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;
Figure 23.357: Solution of a Triangular System
x |
---|
1 |
-1 |
0 |
1 |
Also see the example in the QR call section.