001:       SUBROUTINE SPTSV( N, NRHS, D, E, B, LDB, INFO )
002: *
003: *  -- LAPACK routine (version 3.2) --
004: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
005: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
006: *     November 2006
007: *
008: *     .. Scalar Arguments ..
009:       INTEGER            INFO, LDB, N, NRHS
010: *     ..
011: *     .. Array Arguments ..
012:       REAL               B( LDB, * ), D( * ), E( * )
013: *     ..
014: *
015: *  Purpose
016: *  =======
017: *
018: *  SPTSV computes the solution to a real system of linear equations
019: *  A*X = B, where A is an N-by-N symmetric positive definite tridiagonal
020: *  matrix, and X and B are N-by-NRHS matrices.
021: *
022: *  A is factored as A = L*D*L**T, and the factored form of A is then
023: *  used to solve the system of equations.
024: *
025: *  Arguments
026: *  =========
027: *
028: *  N       (input) INTEGER
029: *          The order of the matrix A.  N >= 0.
030: *
031: *  NRHS    (input) INTEGER
032: *          The number of right hand sides, i.e., the number of columns
033: *          of the matrix B.  NRHS >= 0.
034: *
035: *  D       (input/output) REAL array, dimension (N)
036: *          On entry, the n diagonal elements of the tridiagonal matrix
037: *          A.  On exit, the n diagonal elements of the diagonal matrix
038: *          D from the factorization A = L*D*L**T.
039: *
040: *  E       (input/output) REAL array, dimension (N-1)
041: *          On entry, the (n-1) subdiagonal elements of the tridiagonal
042: *          matrix A.  On exit, the (n-1) subdiagonal elements of the
043: *          unit bidiagonal factor L from the L*D*L**T factorization of
044: *          A.  (E can also be regarded as the superdiagonal of the unit
045: *          bidiagonal factor U from the U**T*D*U factorization of A.)
046: *
047: *  B       (input/output) REAL array, dimension (LDB,NRHS)
048: *          On entry, the N-by-NRHS right hand side matrix B.
049: *          On exit, if INFO = 0, the N-by-NRHS solution matrix X.
050: *
051: *  LDB     (input) INTEGER
052: *          The leading dimension of the array B.  LDB >= max(1,N).
053: *
054: *  INFO    (output) INTEGER
055: *          = 0:  successful exit
056: *          < 0:  if INFO = -i, the i-th argument had an illegal value
057: *          > 0:  if INFO = i, the leading minor of order i is not
058: *                positive definite, and the solution has not been
059: *                computed.  The factorization has not been completed
060: *                unless i = N.
061: *
062: *  =====================================================================
063: *
064: *     .. External Subroutines ..
065:       EXTERNAL           SPTTRF, SPTTRS, XERBLA
066: *     ..
067: *     .. Intrinsic Functions ..
068:       INTRINSIC          MAX
069: *     ..
070: *     .. Executable Statements ..
071: *
072: *     Test the input parameters.
073: *
074:       INFO = 0
075:       IF( N.LT.0 ) THEN
076:          INFO = -1
077:       ELSE IF( NRHS.LT.0 ) THEN
078:          INFO = -2
079:       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
080:          INFO = -6
081:       END IF
082:       IF( INFO.NE.0 ) THEN
083:          CALL XERBLA( 'SPTSV ', -INFO )
084:          RETURN
085:       END IF
086: *
087: *     Compute the L*D*L' (or U'*D*U) factorization of A.
088: *
089:       CALL SPTTRF( N, D, E, INFO )
090:       IF( INFO.EQ.0 ) THEN
091: *
092: *        Solve the system A*X = B, overwriting B with X.
093: *
094:          CALL SPTTRS( N, NRHS, D, E, B, LDB, INFO )
095:       END IF
096:       RETURN
097: *
098: *     End of SPTSV
099: *
100:       END
101: