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

## ◆ sptt01()

 subroutine sptt01 ( integer N, real, dimension( * ) D, real, dimension( * ) E, real, dimension( * ) DF, real, dimension( * ) EF, real, dimension( * ) WORK, real RESID )

SPTT01

Purpose:
``` SPTT01 reconstructs a tridiagonal matrix A from its L*D*L'
factorization and computes the residual
norm(L*D*L' - A) / ( n * norm(A) * EPS ),
where EPS is the machine epsilon.```
Parameters
 [in] N ``` N is INTEGTER The order of the matrix A.``` [in] D ``` D is REAL array, dimension (N) The n diagonal elements of the tridiagonal matrix A.``` [in] E ``` E is REAL array, dimension (N-1) The (n-1) subdiagonal elements of the tridiagonal matrix A.``` [in] DF ``` DF is REAL array, dimension (N) The n diagonal elements of the factor L from the L*D*L' factorization of A.``` [in] EF ``` EF is REAL array, dimension (N-1) The (n-1) subdiagonal elements of the factor L from the L*D*L' factorization of A.``` [out] WORK ` WORK is REAL array, dimension (2*N)` [out] RESID ``` RESID is REAL norm(L*D*L' - A) / (n * norm(A) * EPS)```

Definition at line 90 of file sptt01.f.

91*
92* -- LAPACK test routine --
93* -- LAPACK is a software package provided by Univ. of Tennessee, --
94* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
95*
96* .. Scalar Arguments ..
97 INTEGER N
98 REAL RESID
99* ..
100* .. Array Arguments ..
101 REAL D( * ), DF( * ), E( * ), EF( * ), WORK( * )
102* ..
103*
104* =====================================================================
105*
106* .. Parameters ..
107 REAL ONE, ZERO
108 parameter( one = 1.0e+0, zero = 0.0e+0 )
109* ..
110* .. Local Scalars ..
111 INTEGER I
112 REAL ANORM, DE, EPS
113* ..
114* .. External Functions ..
115 REAL SLAMCH
116 EXTERNAL slamch
117* ..
118* .. Intrinsic Functions ..
119 INTRINSIC abs, max, real
120* ..
121* .. Executable Statements ..
122*
123* Quick return if possible
124*
125 IF( n.LE.0 ) THEN
126 resid = zero
127 RETURN
128 END IF
129*
130 eps = slamch( 'Epsilon' )
131*
132* Construct the difference L*D*L' - A.
133*
134 work( 1 ) = df( 1 ) - d( 1 )
135 DO 10 i = 1, n - 1
136 de = df( i )*ef( i )
137 work( n+i ) = de - e( i )
138 work( 1+i ) = de*ef( i ) + df( i+1 ) - d( i+1 )
139 10 CONTINUE
140*
141* Compute the 1-norms of the tridiagonal matrices A and WORK.
142*
143 IF( n.EQ.1 ) THEN
144 anorm = d( 1 )
145 resid = abs( work( 1 ) )
146 ELSE
147 anorm = max( d( 1 )+abs( e( 1 ) ), d( n )+abs( e( n-1 ) ) )
148 resid = max( abs( work( 1 ) )+abs( work( n+1 ) ),
149 \$ abs( work( n ) )+abs( work( 2*n-1 ) ) )
150 DO 20 i = 2, n - 1
151 anorm = max( anorm, d( i )+abs( e( i ) )+abs( e( i-1 ) ) )
152 resid = max( resid, abs( work( i ) )+abs( work( n+i-1 ) )+
153 \$ abs( work( n+i ) ) )
154 20 CONTINUE
155 END IF
156*
157* Compute norm(L*D*L' - A) / (n * norm(A) * EPS)
158*
159 IF( anorm.LE.zero ) THEN
160 IF( resid.NE.zero )
161 \$ resid = one / eps
162 ELSE
163 resid = ( ( resid / real( n ) ) / anorm ) / eps
164 END IF
165*
166 RETURN
167*
168* End of SPTT01
169*
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the caller graph for this function: