LAPACK 3.3.0

spttrs.f

Go to the documentation of this file.
00001       SUBROUTINE SPTTRS( N, NRHS, D, E, B, LDB, INFO )
00002 *
00003 *  -- LAPACK routine (version 3.2) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            INFO, LDB, N, NRHS
00010 *     ..
00011 *     .. Array Arguments ..
00012       REAL               B( LDB, * ), D( * ), E( * )
00013 *     ..
00014 *
00015 *  Purpose
00016 *  =======
00017 *
00018 *  SPTTRS solves a tridiagonal system of the form
00019 *     A * X = B
00020 *  using the L*D*L' factorization of A computed by SPTTRF.  D is a
00021 *  diagonal matrix specified in the vector D, L is a unit bidiagonal
00022 *  matrix whose subdiagonal is specified in the vector E, and X and B
00023 *  are N by NRHS matrices.
00024 *
00025 *  Arguments
00026 *  =========
00027 *
00028 *  N       (input) INTEGER
00029 *          The order of the tridiagonal matrix A.  N >= 0.
00030 *
00031 *  NRHS    (input) INTEGER
00032 *          The number of right hand sides, i.e., the number of columns
00033 *          of the matrix B.  NRHS >= 0.
00034 *
00035 *  D       (input) REAL array, dimension (N)
00036 *          The n diagonal elements of the diagonal matrix D from the
00037 *          L*D*L' factorization of A.
00038 *
00039 *  E       (input) REAL array, dimension (N-1)
00040 *          The (n-1) subdiagonal elements of the unit bidiagonal factor
00041 *          L from the L*D*L' factorization of A.  E can also be regarded
00042 *          as the superdiagonal of the unit bidiagonal factor U from the
00043 *          factorization A = U'*D*U.
00044 *
00045 *  B       (input/output) REAL array, dimension (LDB,NRHS)
00046 *          On entry, the right hand side vectors B for the system of
00047 *          linear equations.
00048 *          On exit, the solution vectors, X.
00049 *
00050 *  LDB     (input) INTEGER
00051 *          The leading dimension of the array B.  LDB >= max(1,N).
00052 *
00053 *  INFO    (output) INTEGER
00054 *          = 0: successful exit
00055 *          < 0: if INFO = -k, the k-th argument had an illegal value
00056 *
00057 *  =====================================================================
00058 *
00059 *     .. Local Scalars ..
00060       INTEGER            J, JB, NB
00061 *     ..
00062 *     .. External Functions ..
00063       INTEGER            ILAENV
00064       EXTERNAL           ILAENV
00065 *     ..
00066 *     .. External Subroutines ..
00067       EXTERNAL           SPTTS2, XERBLA
00068 *     ..
00069 *     .. Intrinsic Functions ..
00070       INTRINSIC          MAX, MIN
00071 *     ..
00072 *     .. Executable Statements ..
00073 *
00074 *     Test the input arguments.
00075 *
00076       INFO = 0
00077       IF( N.LT.0 ) THEN
00078          INFO = -1
00079       ELSE IF( NRHS.LT.0 ) THEN
00080          INFO = -2
00081       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
00082          INFO = -6
00083       END IF
00084       IF( INFO.NE.0 ) THEN
00085          CALL XERBLA( 'SPTTRS', -INFO )
00086          RETURN
00087       END IF
00088 *
00089 *     Quick return if possible
00090 *
00091       IF( N.EQ.0 .OR. NRHS.EQ.0 )
00092      $   RETURN
00093 *
00094 *     Determine the number of right-hand sides to solve at a time.
00095 *
00096       IF( NRHS.EQ.1 ) THEN
00097          NB = 1
00098       ELSE
00099          NB = MAX( 1, ILAENV( 1, 'SPTTRS', ' ', N, NRHS, -1, -1 ) )
00100       END IF
00101 *
00102       IF( NB.GE.NRHS ) THEN
00103          CALL SPTTS2( N, NRHS, D, E, B, LDB )
00104       ELSE
00105          DO 10 J = 1, NRHS, NB
00106             JB = MIN( NRHS-J+1, NB )
00107             CALL SPTTS2( N, JB, D, E, B( 1, J ), LDB )
00108    10    CONTINUE
00109       END IF
00110 *
00111       RETURN
00112 *
00113 *     End of SPTTRS
00114 *
00115       END
 All Files Functions