1 *> \brief \b SPTTS2 solves a tridiagonal system of the form AX=B using the L D LH factorization computed by spttrf.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SPTTS2 + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sptts2.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sptts2.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sptts2.f">
21 * SUBROUTINE SPTTS2( N, NRHS, D, E, B, LDB )
23 * .. Scalar Arguments ..
24 * INTEGER LDB, N, NRHS
26 * .. Array Arguments ..
27 * REAL B( LDB, * ), D( * ), E( * )
36 *> SPTTS2 solves a tridiagonal system of the form
38 *> using the L*D*L**T factorization of A computed by SPTTRF. D is a
39 *> diagonal matrix specified in the vector D, L is a unit bidiagonal
40 *> matrix whose subdiagonal is specified in the vector E, and X and B
41 *> are N by NRHS matrices.
50 *> The order of the tridiagonal matrix A. N >= 0.
56 *> The number of right hand sides, i.e., the number of columns
57 *> of the matrix B. NRHS >= 0.
62 *> D is REAL array, dimension (N)
63 *> The n diagonal elements of the diagonal matrix D from the
64 *> L*D*L**T factorization of A.
69 *> E is REAL array, dimension (N-1)
70 *> The (n-1) subdiagonal elements of the unit bidiagonal factor
71 *> L from the L*D*L**T factorization of A. E can also be regarded
72 *> as the superdiagonal of the unit bidiagonal factor U from the
73 *> factorization A = U**T*D*U.
78 *> B is REAL array, dimension (LDB,NRHS)
79 *> On entry, the right hand side vectors B for the system of
81 *> On exit, the solution vectors, X.
87 *> The leading dimension of the array B. LDB >= max(1,N).
93 *> \author Univ. of Tennessee
94 *> \author Univ. of California Berkeley
95 *> \author Univ. of Colorado Denver
98 *> \date September 2012
100 *> \ingroup realPTcomputational
102 * =====================================================================
103 SUBROUTINE SPTTS2( N, NRHS, D, E, B, LDB )
105 * -- LAPACK computational routine (version 3.4.2) --
106 * -- LAPACK is a software package provided by Univ. of Tennessee, --
107 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
110 * .. Scalar Arguments ..
113 * .. Array Arguments ..
114 REAL B( LDB, * ), D( * ), E( * )
117 * =====================================================================
119 * .. Local Scalars ..
122 * .. External Subroutines ..
125 * .. Executable Statements ..
127 * Quick return if possible
131 $ CALL SSCAL( NRHS, 1. / D( 1 ), B, LDB )
135 * Solve A * X = B using the factorization A = L*D*L**T,
136 * overwriting each right hand side vector with its solution.
143 B( I, J ) = B( I, J ) - B( I-1, J )*E( I-1 )
146 * Solve D * L**T * x = b.
148 B( N, J ) = B( N, J ) / D( N )
149 DO 20 I = N - 1, 1, -1
150 B( I, J ) = B( I, J ) / D( I ) - B( I+1, J )*E( I )