3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SGTTRF + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sgttrf.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sgttrf.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgttrf.f">
21 * SUBROUTINE SGTTRF( N, DL, D, DU, DU2, IPIV, INFO )
23 * .. Scalar Arguments ..
26 * .. Array Arguments ..
28 * REAL D( * ), DL( * ), DU( * ), DU2( * )
37 *> SGTTRF computes an LU factorization of a real tridiagonal matrix A
38 *> using elimination with partial pivoting and row interchanges.
40 *> The factorization has the form
42 *> where L is a product of permutation and unit lower bidiagonal
43 *> matrices and U is upper triangular with nonzeros in only the main
44 *> diagonal and first two superdiagonals.
53 *> The order of the matrix A.
58 *> DL is REAL array, dimension (N-1)
59 *> On entry, DL must contain the (n-1) sub-diagonal elements of
62 *> On exit, DL is overwritten by the (n-1) multipliers that
63 *> define the matrix L from the LU factorization of A.
68 *> D is REAL array, dimension (N)
69 *> On entry, D must contain the diagonal elements of A.
71 *> On exit, D is overwritten by the n diagonal elements of the
72 *> upper triangular matrix U from the LU factorization of A.
77 *> DU is REAL array, dimension (N-1)
78 *> On entry, DU must contain the (n-1) super-diagonal elements
81 *> On exit, DU is overwritten by the (n-1) elements of the first
82 *> super-diagonal of U.
87 *> DU2 is REAL array, dimension (N-2)
88 *> On exit, DU2 is overwritten by the (n-2) elements of the
89 *> second super-diagonal of U.
94 *> IPIV is INTEGER array, dimension (N)
95 *> The pivot indices; for 1 <= i <= n, row i of the matrix was
96 *> interchanged with row IPIV(i). IPIV(i) will always be either
97 *> i or i+1; IPIV(i) = i indicates a row interchange was not
104 *> = 0: successful exit
105 *> < 0: if INFO = -k, the k-th argument had an illegal value
106 *> > 0: if INFO = k, U(k,k) is exactly zero. The factorization
107 *> has been completed, but the factor U is exactly
108 *> singular, and division by zero will occur if it is used
109 *> to solve a system of equations.
115 *> \author Univ. of Tennessee
116 *> \author Univ. of California Berkeley
117 *> \author Univ. of Colorado Denver
120 *> \date September 2012
122 *> \ingroup realGTcomputational
124 * =====================================================================
125 SUBROUTINE SGTTRF( N, DL, D, DU, DU2, IPIV, INFO )
127 * -- LAPACK computational routine (version 3.4.2) --
128 * -- LAPACK is a software package provided by Univ. of Tennessee, --
129 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * .. Scalar Arguments ..
135 * .. Array Arguments ..
137 REAL D( * ), DL( * ), DU( * ), DU2( * )
140 * =====================================================================
144 PARAMETER ( ZERO = 0.0E+0 )
146 * .. Local Scalars ..
150 * .. Intrinsic Functions ..
153 * .. External Subroutines ..
156 * .. Executable Statements ..
161 CALL XERBLA( 'SGTTRF', -INFO )
165 * Quick return if possible
170 * Initialize IPIV(i) = i and DU2(I) = 0
180 IF( ABS( D( I ) ).GE.ABS( DL( I ) ) ) THEN
182 * No row interchange required, eliminate DL(I)
184 IF( D( I ).NE.ZERO ) THEN
185 FACT = DL( I ) / D( I )
187 D( I+1 ) = D( I+1 ) - FACT*DU( I )
191 * Interchange rows I and I+1, eliminate DL(I)
193 FACT = D( I ) / DL( I )
198 D( I+1 ) = TEMP - FACT*D( I+1 )
200 DU( I+1 ) = -FACT*DU( I+1 )
206 IF( ABS( D( I ) ).GE.ABS( DL( I ) ) ) THEN
207 IF( D( I ).NE.ZERO ) THEN
208 FACT = DL( I ) / D( I )
210 D( I+1 ) = D( I+1 ) - FACT*DU( I )
213 FACT = D( I ) / DL( I )
218 D( I+1 ) = TEMP - FACT*D( I+1 )
223 * Check for a zero on the diagonal of U.
226 IF( D( I ).EQ.ZERO ) THEN