LAPACK 3.12.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches

◆ dgtt01()

 subroutine dgtt01 ( integer n, double precision, dimension( * ) dl, double precision, dimension( * ) d, double precision, dimension( * ) du, double precision, dimension( * ) dlf, double precision, dimension( * ) df, double precision, dimension( * ) duf, double precision, dimension( * ) du2, integer, dimension( * ) ipiv, double precision, dimension( ldwork, * ) work, integer ldwork, double precision, dimension( * ) rwork, double precision resid )

DGTT01

Purpose:
``` DGTT01 reconstructs a tridiagonal matrix A from its LU factorization
and computes the residual
norm(L*U - A) / ( norm(A) * EPS ),
where EPS is the machine epsilon.```
Parameters
 [in] N ``` N is INTEGER The order of the matrix A. N >= 0.``` [in] DL ``` DL is DOUBLE PRECISION array, dimension (N-1) The (n-1) sub-diagonal elements of A.``` [in] D ``` D is DOUBLE PRECISION array, dimension (N) The diagonal elements of A.``` [in] DU ``` DU is DOUBLE PRECISION array, dimension (N-1) The (n-1) super-diagonal elements of A.``` [in] DLF ``` DLF is DOUBLE PRECISION array, dimension (N-1) The (n-1) multipliers that define the matrix L from the LU factorization of A.``` [in] DF ``` DF is DOUBLE PRECISION array, dimension (N) The n diagonal elements of the upper triangular matrix U from the LU factorization of A.``` [in] DUF ``` DUF is DOUBLE PRECISION array, dimension (N-1) The (n-1) elements of the first super-diagonal of U.``` [in] DU2 ``` DU2 is DOUBLE PRECISION array, dimension (N-2) The (n-2) elements of the second super-diagonal of U.``` [in] IPIV ``` IPIV is INTEGER array, dimension (N) The pivot indices; for 1 <= i <= n, row i of the matrix was interchanged with row IPIV(i). IPIV(i) will always be either i or i+1; IPIV(i) = i indicates a row interchange was not required.``` [out] WORK ` WORK is DOUBLE PRECISION array, dimension (LDWORK,N)` [in] LDWORK ``` LDWORK is INTEGER The leading dimension of the array WORK. LDWORK >= max(1,N).``` [out] RWORK ` RWORK is DOUBLE PRECISION array, dimension (N)` [out] RESID ``` RESID is DOUBLE PRECISION The scaled residual: norm(L*U - A) / (norm(A) * EPS)```

Definition at line 132 of file dgtt01.f.

134*
135* -- LAPACK test routine --
136* -- LAPACK is a software package provided by Univ. of Tennessee, --
137* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
138*
139* .. Scalar Arguments ..
140 INTEGER LDWORK, N
141 DOUBLE PRECISION RESID
142* ..
143* .. Array Arguments ..
144 INTEGER IPIV( * )
145 DOUBLE PRECISION D( * ), DF( * ), DL( * ), DLF( * ), DU( * ),
146 \$ DU2( * ), DUF( * ), RWORK( * ),
147 \$ WORK( LDWORK, * )
148* ..
149*
150* =====================================================================
151*
152* .. Parameters ..
153 DOUBLE PRECISION ONE, ZERO
154 parameter( one = 1.0d+0, zero = 0.0d+0 )
155* ..
156* .. Local Scalars ..
157 INTEGER I, IP, J, LASTJ
158 DOUBLE PRECISION ANORM, EPS, LI
159* ..
160* .. External Functions ..
161 DOUBLE PRECISION DLAMCH, DLANGT, DLANHS
162 EXTERNAL dlamch, dlangt, dlanhs
163* ..
164* .. Intrinsic Functions ..
165 INTRINSIC min
166* ..
167* .. External Subroutines ..
168 EXTERNAL daxpy, dswap
169* ..
170* .. Executable Statements ..
171*
172* Quick return if possible
173*
174 IF( n.LE.0 ) THEN
175 resid = zero
176 RETURN
177 END IF
178*
179 eps = dlamch( 'Epsilon' )
180*
181* Copy the matrix U to WORK.
182*
183 DO 20 j = 1, n
184 DO 10 i = 1, n
185 work( i, j ) = zero
186 10 CONTINUE
187 20 CONTINUE
188 DO 30 i = 1, n
189 IF( i.EQ.1 ) THEN
190 work( i, i ) = df( i )
191 IF( n.GE.2 )
192 \$ work( i, i+1 ) = duf( i )
193 IF( n.GE.3 )
194 \$ work( i, i+2 ) = du2( i )
195 ELSE IF( i.EQ.n ) THEN
196 work( i, i ) = df( i )
197 ELSE
198 work( i, i ) = df( i )
199 work( i, i+1 ) = duf( i )
200 IF( i.LT.n-1 )
201 \$ work( i, i+2 ) = du2( i )
202 END IF
203 30 CONTINUE
204*
205* Multiply on the left by L.
206*
207 lastj = n
208 DO 40 i = n - 1, 1, -1
209 li = dlf( i )
210 CALL daxpy( lastj-i+1, li, work( i, i ), ldwork,
211 \$ work( i+1, i ), ldwork )
212 ip = ipiv( i )
213 IF( ip.EQ.i ) THEN
214 lastj = min( i+2, n )
215 ELSE
216 CALL dswap( lastj-i+1, work( i, i ), ldwork, work( i+1, i ),
217 \$ ldwork )
218 END IF
219 40 CONTINUE
220*
221* Subtract the matrix A.
222*
223 work( 1, 1 ) = work( 1, 1 ) - d( 1 )
224 IF( n.GT.1 ) THEN
225 work( 1, 2 ) = work( 1, 2 ) - du( 1 )
226 work( n, n-1 ) = work( n, n-1 ) - dl( n-1 )
227 work( n, n ) = work( n, n ) - d( n )
228 DO 50 i = 2, n - 1
229 work( i, i-1 ) = work( i, i-1 ) - dl( i-1 )
230 work( i, i ) = work( i, i ) - d( i )
231 work( i, i+1 ) = work( i, i+1 ) - du( i )
232 50 CONTINUE
233 END IF
234*
235* Compute the 1-norm of the tridiagonal matrix A.
236*
237 anorm = dlangt( '1', n, dl, d, du )
238*
239* Compute the 1-norm of WORK, which is only guaranteed to be
240* upper Hessenberg.
241*
242 resid = dlanhs( '1', n, work, ldwork, rwork )
243*
244* Compute norm(L*U - A) / (norm(A) * EPS)
245*
246 IF( anorm.LE.zero ) THEN
247 IF( resid.NE.zero )
248 \$ resid = one / eps
249 ELSE
250 resid = ( resid / anorm ) / eps
251 END IF
252*
253 RETURN
254*
255* End of DGTT01
256*
subroutine daxpy(n, da, dx, incx, dy, incy)
DAXPY
Definition daxpy.f:89
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
double precision function dlangt(norm, n, dl, d, du)
DLANGT returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition dlangt.f:106
double precision function dlanhs(norm, n, a, lda, work)
DLANHS returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition dlanhs.f:108
subroutine dswap(n, dx, incx, dy, incy)
DSWAP
Definition dswap.f:82
Here is the call graph for this function:
Here is the caller graph for this function: