LAPACK 3.3.0

sptsv.f

Go to the documentation of this file.
00001       SUBROUTINE SPTSV( 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 *  SPTSV computes the solution to a real system of linear equations
00019 *  A*X = B, where A is an N-by-N symmetric positive definite tridiagonal
00020 *  matrix, and X and B are N-by-NRHS matrices.
00021 *
00022 *  A is factored as A = L*D*L**T, and the factored form of A is then
00023 *  used to solve the system of equations.
00024 *
00025 *  Arguments
00026 *  =========
00027 *
00028 *  N       (input) INTEGER
00029 *          The order of the 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/output) REAL array, dimension (N)
00036 *          On entry, the n diagonal elements of the tridiagonal matrix
00037 *          A.  On exit, the n diagonal elements of the diagonal matrix
00038 *          D from the factorization A = L*D*L**T.
00039 *
00040 *  E       (input/output) REAL array, dimension (N-1)
00041 *          On entry, the (n-1) subdiagonal elements of the tridiagonal
00042 *          matrix A.  On exit, the (n-1) subdiagonal elements of the
00043 *          unit bidiagonal factor L from the L*D*L**T factorization of
00044 *          A.  (E can also be regarded as the superdiagonal of the unit
00045 *          bidiagonal factor U from the U**T*D*U factorization of A.)
00046 *
00047 *  B       (input/output) REAL array, dimension (LDB,NRHS)
00048 *          On entry, the N-by-NRHS right hand side matrix B.
00049 *          On exit, if INFO = 0, the N-by-NRHS solution matrix X.
00050 *
00051 *  LDB     (input) INTEGER
00052 *          The leading dimension of the array B.  LDB >= max(1,N).
00053 *
00054 *  INFO    (output) INTEGER
00055 *          = 0:  successful exit
00056 *          < 0:  if INFO = -i, the i-th argument had an illegal value
00057 *          > 0:  if INFO = i, the leading minor of order i is not
00058 *                positive definite, and the solution has not been
00059 *                computed.  The factorization has not been completed
00060 *                unless i = N.
00061 *
00062 *  =====================================================================
00063 *
00064 *     .. External Subroutines ..
00065       EXTERNAL           SPTTRF, SPTTRS, XERBLA
00066 *     ..
00067 *     .. Intrinsic Functions ..
00068       INTRINSIC          MAX
00069 *     ..
00070 *     .. Executable Statements ..
00071 *
00072 *     Test the input parameters.
00073 *
00074       INFO = 0
00075       IF( N.LT.0 ) THEN
00076          INFO = -1
00077       ELSE IF( NRHS.LT.0 ) THEN
00078          INFO = -2
00079       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
00080          INFO = -6
00081       END IF
00082       IF( INFO.NE.0 ) THEN
00083          CALL XERBLA( 'SPTSV ', -INFO )
00084          RETURN
00085       END IF
00086 *
00087 *     Compute the L*D*L' (or U'*D*U) factorization of A.
00088 *
00089       CALL SPTTRF( N, D, E, INFO )
00090       IF( INFO.EQ.0 ) THEN
00091 *
00092 *        Solve the system A*X = B, overwriting B with X.
00093 *
00094          CALL SPTTRS( N, NRHS, D, E, B, LDB, INFO )
00095       END IF
00096       RETURN
00097 *
00098 *     End of SPTSV
00099 *
00100       END
 All Files Functions