LAPACK 3.3.1
Linear Algebra PACKage

dptts2.f

Go to the documentation of this file.
00001       SUBROUTINE DPTTS2( N, NRHS, D, E, B, LDB )
00002 *
00003 *  -- LAPACK routine (version 3.3.1) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *  -- April 2011                                                      --
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            LDB, N, NRHS
00010 *     ..
00011 *     .. Array Arguments ..
00012       DOUBLE PRECISION   B( LDB, * ), D( * ), E( * )
00013 *     ..
00014 *
00015 *  Purpose
00016 *  =======
00017 *
00018 *  DPTTS2 solves a tridiagonal system of the form
00019 *     A * X = B
00020 *  using the L*D*L**T factorization of A computed by DPTTRF.  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) DOUBLE PRECISION array, dimension (N)
00036 *          The n diagonal elements of the diagonal matrix D from the
00037 *          L*D*L**T factorization of A.
00038 *
00039 *  E       (input) DOUBLE PRECISION array, dimension (N-1)
00040 *          The (n-1) subdiagonal elements of the unit bidiagonal factor
00041 *          L from the L*D*L**T factorization of A.  E can also be regarded
00042 *          as the superdiagonal of the unit bidiagonal factor U from the
00043 *          factorization A = U**T*D*U.
00044 *
00045 *  B       (input/output) DOUBLE PRECISION 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 *  =====================================================================
00054 *
00055 *     .. Local Scalars ..
00056       INTEGER            I, J
00057 *     ..
00058 *     .. External Subroutines ..
00059       EXTERNAL           DSCAL
00060 *     ..
00061 *     .. Executable Statements ..
00062 *
00063 *     Quick return if possible
00064 *
00065       IF( N.LE.1 ) THEN
00066          IF( N.EQ.1 )
00067      $      CALL DSCAL( NRHS, 1.D0 / D( 1 ), B, LDB )
00068          RETURN
00069       END IF
00070 *
00071 *     Solve A * X = B using the factorization A = L*D*L**T,
00072 *     overwriting each right hand side vector with its solution.
00073 *
00074       DO 30 J = 1, NRHS
00075 *
00076 *           Solve L * x = b.
00077 *
00078          DO 10 I = 2, N
00079             B( I, J ) = B( I, J ) - B( I-1, J )*E( I-1 )
00080    10    CONTINUE
00081 *
00082 *           Solve D * L**T * x = b.
00083 *
00084          B( N, J ) = B( N, J ) / D( N )
00085          DO 20 I = N - 1, 1, -1
00086             B( I, J ) = B( I, J ) / D( I ) - B( I+1, J )*E( I )
00087    20    CONTINUE
00088    30 CONTINUE
00089 *
00090       RETURN
00091 *
00092 *     End of DPTTS2
00093 *
00094       END
 All Files Functions