TRISOL
Syntax | Return Value | Arguments | Keywords | Example | Version History | See Also
The TRISOL function solves tridiagonal systems of linear equations that have the form: ATU = R
Note
Because IDL subscripts are in column-row order, the equation above is written ATU = R rather than AU = R. The result U is a vector of length n whose type is identical to A.
TRISOL is based on the routine tridag described in section 2.4 of Numerical Recipes in C: The Art of Scientific Computing (Second Edition), published by Cambridge University Press, and is used by permission.
Note
If you are working with complex inputs, use the LA_TRISOL procedure instead.
Syntax
Result = TRISOL( A, B, C, R [, /DOUBLE] )
Return Value
Returns a vector containing the solutions.
Arguments
A
A vector of length n containing the n-1 sub-diagonal elements of AT. The first element of A, A0, is ignored.
B
An n-element vector containing the main diagonal elements of AT.
C
An n-element vector containing the n-1 super-diagonal elements of AT. The last element of C, Cn-1, is ignored.
R
An n-element vector containing the right hand side of the linear system
ATU = R.
Keywords
DOUBLE
Set this keyword to force the computation to be done in double-precision arithmetic.
Example
To solve a tridiagonal linear system, begin with an array representing a real tridiagonal linear system. (Note that only three vectors need be specified; there is no need to enter the entire array shown.)

IDL prints:
The exact solution vector is [-1.0, 2.0, 2.0, -1.0].
Version History
See Also
CRAMER, GS_ITER, LA_TRISOL, LU_COMPLEX, CHOLSOL, LUSOL, SVSOL, TRISOL