001:       SUBROUTINE DPTTRS( 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:       DOUBLE PRECISION   B( LDB, * ), D( * ), E( * )
013: *     ..
014: *
015: *  Purpose
016: *  =======
017: *
018: *  DPTTRS solves a tridiagonal system of the form
019: *     A * X = B
020: *  using the L*D*L' factorization of A computed by DPTTRF.  D is a
021: *  diagonal matrix specified in the vector D, L is a unit bidiagonal
022: *  matrix whose subdiagonal is specified in the vector E, and X and B
023: *  are N by NRHS matrices.
024: *
025: *  Arguments
026: *  =========
027: *
028: *  N       (input) INTEGER
029: *          The order of the tridiagonal 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) DOUBLE PRECISION array, dimension (N)
036: *          The n diagonal elements of the diagonal matrix D from the
037: *          L*D*L' factorization of A.
038: *
039: *  E       (input) DOUBLE PRECISION array, dimension (N-1)
040: *          The (n-1) subdiagonal elements of the unit bidiagonal factor
041: *          L from the L*D*L' factorization of A.  E can also be regarded
042: *          as the superdiagonal of the unit bidiagonal factor U from the
043: *          factorization A = U'*D*U.
044: *
045: *  B       (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
046: *          On entry, the right hand side vectors B for the system of
047: *          linear equations.
048: *          On exit, the solution vectors, X.
049: *
050: *  LDB     (input) INTEGER
051: *          The leading dimension of the array B.  LDB >= max(1,N).
052: *
053: *  INFO    (output) INTEGER
054: *          = 0: successful exit
055: *          < 0: if INFO = -k, the k-th argument had an illegal value
056: *
057: *  =====================================================================
058: *
059: *     .. Local Scalars ..
060:       INTEGER            J, JB, NB
061: *     ..
062: *     .. External Functions ..
063:       INTEGER            ILAENV
064:       EXTERNAL           ILAENV
065: *     ..
066: *     .. External Subroutines ..
067:       EXTERNAL           DPTTS2, XERBLA
068: *     ..
069: *     .. Intrinsic Functions ..
070:       INTRINSIC          MAX, MIN
071: *     ..
072: *     .. Executable Statements ..
073: *
074: *     Test the input arguments.
075: *
076:       INFO = 0
077:       IF( N.LT.0 ) THEN
078:          INFO = -1
079:       ELSE IF( NRHS.LT.0 ) THEN
080:          INFO = -2
081:       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
082:          INFO = -6
083:       END IF
084:       IF( INFO.NE.0 ) THEN
085:          CALL XERBLA( 'DPTTRS', -INFO )
086:          RETURN
087:       END IF
088: *
089: *     Quick return if possible
090: *
091:       IF( N.EQ.0 .OR. NRHS.EQ.0 )
092:      \$   RETURN
093: *
094: *     Determine the number of right-hand sides to solve at a time.
095: *
096:       IF( NRHS.EQ.1 ) THEN
097:          NB = 1
098:       ELSE
099:          NB = MAX( 1, ILAENV( 1, 'DPTTRS', ' ', N, NRHS, -1, -1 ) )
100:       END IF
101: *
102:       IF( NB.GE.NRHS ) THEN
103:          CALL DPTTS2( N, NRHS, D, E, B, LDB )
104:       ELSE
105:          DO 10 J = 1, NRHS, NB
106:             JB = MIN( NRHS-J+1, NB )
107:             CALL DPTTS2( N, JB, D, E, B( 1, J ), LDB )
108:    10    CONTINUE
109:       END IF
110: *
111:       RETURN
112: *
113: *     End of DPTTRS
114: *
115:       END
116: