3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE SGTT01( N, DL, D, DU, DLF, DF, DUF, DU2, IPIV, WORK,
12 * LDWORK, RWORK, RESID )
14 * .. Scalar Arguments ..
18 * .. Array Arguments ..
20 * REAL D( * ), DF( * ), DL( * ), DLF( * ), DU( * ),
21 * $ DU2( * ), DUF( * ), RWORK( * ),
31 *> SGTT01 reconstructs a tridiagonal matrix A from its LU factorization
32 *> and computes the residual
33 *> norm(L*U - A) / ( norm(A) * EPS ),
34 *> where EPS is the machine epsilon.
43 *> The order of the matrix A. N >= 0.
48 *> DL is REAL array, dimension (N-1)
49 *> The (n-1) sub-diagonal elements of A.
54 *> D is REAL array, dimension (N)
55 *> The diagonal elements of A.
60 *> DU is REAL array, dimension (N-1)
61 *> The (n-1) super-diagonal elements of A.
66 *> DLF is REAL array, dimension (N-1)
67 *> The (n-1) multipliers that define the matrix L from the
68 *> LU factorization of A.
73 *> DF is REAL array, dimension (N)
74 *> The n diagonal elements of the upper triangular matrix U from
75 *> the LU factorization of A.
80 *> DUF is REAL array, dimension (N-1)
81 *> The (n-1) elements of the first super-diagonal of U.
86 *> DU2 is REAL array, dimension (N-2)
87 *> The (n-2) elements of the second super-diagonal of U.
92 *> IPIV is INTEGER array, dimension (N)
93 *> The pivot indices; for 1 <= i <= n, row i of the matrix was
94 *> interchanged with row IPIV(i). IPIV(i) will always be either
95 *> i or i+1; IPIV(i) = i indicates a row interchange was not
101 *> WORK is REAL array, dimension (LDWORK,N)
107 *> The leading dimension of the array WORK. LDWORK >= max(1,N).
112 *> RWORK is REAL array, dimension (N)
118 *> The scaled residual: norm(L*U - A) / (norm(A) * EPS)
124 *> \author Univ. of Tennessee
125 *> \author Univ. of California Berkeley
126 *> \author Univ. of Colorado Denver
129 *> \date November 2011
131 *> \ingroup single_lin
133 * =====================================================================
134 SUBROUTINE SGTT01( N, DL, D, DU, DLF, DF, DUF, DU2, IPIV, WORK,
135 $ LDWORK, RWORK, RESID )
137 * -- LAPACK test routine (version 3.4.0) --
138 * -- LAPACK is a software package provided by Univ. of Tennessee, --
139 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
142 * .. Scalar Arguments ..
146 * .. Array Arguments ..
148 REAL D( * ), DF( * ), DL( * ), DLF( * ), DU( * ),
149 $ DU2( * ), DUF( * ), RWORK( * ),
153 * =====================================================================
157 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
159 * .. Local Scalars ..
160 INTEGER I, IP, J, LASTJ
163 * .. External Functions ..
164 REAL SLAMCH, SLANGT, SLANHS
165 EXTERNAL SLAMCH, SLANGT, SLANHS
167 * .. Intrinsic Functions ..
170 * .. External Subroutines ..
171 EXTERNAL SAXPY, SSWAP
173 * .. Executable Statements ..
175 * Quick return if possible
182 EPS = SLAMCH( 'Epsilon' )
184 * Copy the matrix U to WORK.
193 WORK( I, I ) = DF( I )
195 $ WORK( I, I+1 ) = DUF( I )
197 $ WORK( I, I+2 ) = DU2( I )
198 ELSE IF( I.EQ.N ) THEN
199 WORK( I, I ) = DF( I )
201 WORK( I, I ) = DF( I )
202 WORK( I, I+1 ) = DUF( I )
204 $ WORK( I, I+2 ) = DU2( I )
208 * Multiply on the left by L.
211 DO 40 I = N - 1, 1, -1
213 CALL SAXPY( LASTJ-I+1, LI, WORK( I, I ), LDWORK,
214 $ WORK( I+1, I ), LDWORK )
217 LASTJ = MIN( I+2, N )
219 CALL SSWAP( LASTJ-I+1, WORK( I, I ), LDWORK, WORK( I+1, I ),
224 * Subtract the matrix A.
226 WORK( 1, 1 ) = WORK( 1, 1 ) - D( 1 )
228 WORK( 1, 2 ) = WORK( 1, 2 ) - DU( 1 )
229 WORK( N, N-1 ) = WORK( N, N-1 ) - DL( N-1 )
230 WORK( N, N ) = WORK( N, N ) - D( N )
232 WORK( I, I-1 ) = WORK( I, I-1 ) - DL( I-1 )
233 WORK( I, I ) = WORK( I, I ) - D( I )
234 WORK( I, I+1 ) = WORK( I, I+1 ) - DU( I )
238 * Compute the 1-norm of the tridiagonal matrix A.
240 ANORM = SLANGT( '1', N, DL, D, DU )
242 * Compute the 1-norm of WORK, which is only guaranteed to be
245 RESID = SLANHS( '1', N, WORK, LDWORK, RWORK )
247 * Compute norm(L*U - A) / (norm(A) * EPS)
249 IF( ANORM.LE.ZERO ) THEN
253 RESID = ( RESID / ANORM ) / EPS