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