LSLTR
Solves a real tridiagonal system of linear equations.
Required Arguments
C — Vector of length N containing the subdiagonal of the tridiagonal matrix in C(2) through C(N). (Input/Output)
On output C is destroyed.
D — Vector of length N containing the diagonal of the tridiagonal matrix. (Input/Output)
On output D is destroyed.
E — Vector of length N containing the superdiagonal of the tridiagonal matrix in E(1) through E(N − 1). (Input/Output)
On output E is destroyed.
B — Vector of length N containing the right-hand side of the linear system on entry and the solution vector on return. (Input/Output)
Optional Arguments
N — Order of the tridiagonal matrix. (Input)
Default: N = size (C,1).
FORTRAN 90 Interface
Generic: CALL LSLTR (C, D, E, B [, …])
Specific: The specific interface names are S_LSLTR and D_LSLTR.
FORTRAN 77 Interface
Single: CALL LSLTR (N, C, D, E, B)
Double: The double precision name is DLSLTR.
Description
Routine LSLTR factors and solves the real tridiagonal linear system Ax = b. LSLTR is intended just for tridiagonal systems. The coefficient matrix does not have to be symmetric. The algorithm is Gaussian elimination with partial pivoting for numerical stability. See Dongarra (1979), LINPACK subprograms SGTSL/DGTSL, for details. When computing on vector or parallel computers the cyclic reduction algorithm, LSLCR, should be considered as an alternative method to solve the system.
Comments
Informational error
Type |
Code |
Description |
4 |
2 |
An element along the diagonal became exactly zero during execution. |
Example
A system of n = 4 linear equations is solved.
USE LSLTR_INT
USE WRRRL_INT
! Declaration of variables
INTEGER N
PARAMETER (N=4)
!
REAL B(N), C(N), D(N), E(N)
CHARACTER CLABEL(1)*6, FMT*8, RLABEL(1)*4
!
DATA FMT/’(E13.6)’/
DATA CLABEL/’NUMBER’/
DATA RLABEL/’NONE’/
! C(*), D(*), E(*), and B(*)
! contain the subdiagonal, diagonal,
! superdiagonal and right hand side.
DATA C/0.0, 0.0, -4.0, 9.0/, D/6.0, 4.0, -4.0, -9.0/
DATA E/-3.0, 7.0, -8.0, 0.0/, B/48.0, -81.0, -12.0, -144.0/
!
!
CALL LSLTR (C, D, E, B)
! Output the solution.
CALL WRRRL (’Solution:’, B, RLABEL, CLABEL, 1, N, 1, FMT=FMT)
END
Solution:
1 2 3 4
0.400000E+01 -0.800000E+01 - 0.700000E+01 0.900000E+01