cptsl(3P)
NAME
cptsl - solve the linear system Ax = b for a symmetric positive definite tridiagonal matrix A and vectors b and x.
SYNOPSIS
CALL DPTSL (N, DDIAG, DOFFD, DB)
CALL SPTSL (N, SDIAG, SOFFD, SB)
CALL ZPTSL (N, ZDIAG, ZOFFD, ZB)
CALL CPTSL (N, CDIAG, COFFD, CB)
void dptsl(long int n, double ∗d, double ∗e, double ∗b)
void sptsl(long int n, float ∗d, float ∗e, float ∗b)
void zptsl(long int n, doublecomplex ∗d, doublecomplex ∗e,
doublecomplex ∗b)
void cptsl(long int n, complex ∗d, complex ∗e, complex ∗b)
ARGUMENTS
NOrder of the matrix A. N >= 0.
xDIAGMain diagonal elements of A.
xOFFDOff diagonal elements of A. OFFD(1) through OFFD(N∗1) contains
the off diagonal elements; OFFD(N) is not referenced.
xBOn entry, the right-hand side vector b.
On exit, the solution vector x.
SAMPLE PROGRAM
PROGRAM TEST
IMPLICIT NONE
C
INTEGER N
PARAMETER (N = 4)
C
DOUBLE PRECISION B(N), SUBD(N), DIAG(N)
C
EXTERNAL DPTSL
C
C Initialize the arrays SUBD and DIAG to store the subdiagonal
C and diagonal of the tridiagonal positive definite matrix A
C shown below. Initialize the array B to store the right hand
C side vector b shown below.
C
C 2 -1 6
C A = -1 2 -1 b = 12
C -1 2 -1 12
C -1 2 6
C
DATA SUBD / -1.0D0, -1.0D0, -1.0D0, 8D8 /
DATA DIAG / 4∗2.0D0 /
DATA B / 6.0D0, 1.2D1, 1.2D1, 6.0D0 /
C
PRINT 1000
PRINT 1010, DIAG(1), SUBD(1)
PRINT 1020, SUBD(1), DIAG(2), SUBD(2)
PRINT 1030, SUBD(2), DIAG(3), SUBD(3)
PRINT 1040, SUBD(3), DIAG(4)
PRINT 1050
PRINT 1060, B
CALL DPTSL (N, DIAG, SUBD, B)
PRINT 1070
PRINT 1060, B
C
1000 FORMAT (1X, ’A:’)
1010 FORMAT (1X, 2(2X, F4.1))
1020 FORMAT (1X, 3(2X, F4.1))
1030 FORMAT (1X, 6X, 3(2X, F4.1))
1040 FORMAT (1X, 12X, 2(2X, F4.1))
1050 FORMAT (/1X, ’b:’)
1060 FORMAT (3X, F6.1)
1070 FORMAT (/1X, ’A∗∗(-1) ∗ b:’)
C
END
SAMPLE OUTPUT
A:
2.0 -1.0
-1.0 2.0 -1.0
-1.0 2.0 -1.0
-1.0 2.0
b:
6.0
12.0
12.0
6.0
A∗∗(-1) ∗ b:
18.0
30.0
30.0
18.0
Sun, Inc. — Last change: 20 Sep 1996