 LAPACK  3.10.0 LAPACK: Linear Algebra PACKage

## ◆ sgtt01()

 subroutine sgtt01 ( integer N, real, dimension( * ) DL, real, dimension( * ) D, real, dimension( * ) DU, real, dimension( * ) DLF, real, dimension( * ) DF, real, dimension( * ) DUF, real, dimension( * ) DU2, integer, dimension( * ) IPIV, real, dimension( ldwork, * ) WORK, integer LDWORK, real, dimension( * ) RWORK, real RESID )

SGTT01

Purpose:
``` SGTT01 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 INTEGTER The order of the matrix A. N >= 0.``` [in] DL ``` DL is REAL array, dimension (N-1) The (n-1) sub-diagonal elements of A.``` [in] D ``` D is REAL array, dimension (N) The diagonal elements of A.``` [in] DU ``` DU is REAL array, dimension (N-1) The (n-1) super-diagonal elements of A.``` [in] DLF ``` DLF is REAL array, dimension (N-1) The (n-1) multipliers that define the matrix L from the LU factorization of A.``` [in] DF ``` DF is REAL array, dimension (N) The n diagonal elements of the upper triangular matrix U from the LU factorization of A.``` [in] DUF ``` DUF is REAL array, dimension (N-1) The (n-1) elements of the first super-diagonal of U.``` [in] DU2 ``` DU2 is REAL 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 REAL array, dimension (LDWORK,N)` [in] LDWORK ``` LDWORK is INTEGER The leading dimension of the array WORK. LDWORK >= max(1,N).``` [out] RWORK ` RWORK is REAL array, dimension (N)` [out] RESID ``` RESID is REAL The scaled residual: norm(L*U - A) / (norm(A) * EPS)```

Definition at line 132 of file sgtt01.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  REAL RESID
142 * ..
143 * .. Array Arguments ..
144  INTEGER IPIV( * )
145  REAL D( * ), DF( * ), DL( * ), DLF( * ), DU( * ),
146  \$ DU2( * ), DUF( * ), RWORK( * ),
147  \$ WORK( LDWORK, * )
148 * ..
149 *
150 * =====================================================================
151 *
152 * .. Parameters ..
153  REAL ONE, ZERO
154  parameter( one = 1.0e+0, zero = 0.0e+0 )
155 * ..
156 * .. Local Scalars ..
157  INTEGER I, IP, J, LASTJ
158  REAL ANORM, EPS, LI
159 * ..
160 * .. External Functions ..
161  REAL SLAMCH, SLANGT, SLANHS
162  EXTERNAL slamch, slangt, slanhs
163 * ..
164 * .. Intrinsic Functions ..
165  INTRINSIC min
166 * ..
167 * .. External Subroutines ..
168  EXTERNAL saxpy, sswap
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 = slamch( '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 saxpy( 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 sswap( 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 = slangt( '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 = slanhs( '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 SGTT01
256 *
real function slangt(NORM, N, DL, D, DU)
SLANGT returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: slangt.f:106
real function slanhs(NORM, N, A, LDA, WORK)
SLANHS returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: slanhs.f:108
subroutine sswap(N, SX, INCX, SY, INCY)
SSWAP
Definition: sswap.f:82
subroutine saxpy(N, SA, SX, INCX, SY, INCY)
SAXPY
Definition: saxpy.f:89
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the call graph for this function:
Here is the caller graph for this function: