1*> \brief \b SPTT01 2* 3* =========== DOCUMENTATION =========== 4* 5* Online html documentation available at 6* http://www.netlib.org/lapack/explore-html/ 7* 8* Definition: 9* =========== 10* 11* SUBROUTINE SPTT01( N, D, E, DF, EF, WORK, RESID ) 12* 13* .. Scalar Arguments .. 14* INTEGER N 15* REAL RESID 16* .. 17* .. Array Arguments .. 18* REAL D( * ), DF( * ), E( * ), EF( * ), WORK( * ) 19* .. 20* 21* 22*> \par Purpose: 23* ============= 24*> 25*> \verbatim 26*> 27*> SPTT01 reconstructs a tridiagonal matrix A from its L*D*L' 28*> factorization and computes the residual 29*> norm(L*D*L' - A) / ( n * norm(A) * EPS ), 30*> where EPS is the machine epsilon. 31*> \endverbatim 32* 33* Arguments: 34* ========== 35* 36*> \param[in] N 37*> \verbatim 38*> N is INTEGTER 39*> The order of the matrix A. 40*> \endverbatim 41*> 42*> \param[in] D 43*> \verbatim 44*> D is REAL array, dimension (N) 45*> The n diagonal elements of the tridiagonal matrix A. 46*> \endverbatim 47*> 48*> \param[in] E 49*> \verbatim 50*> E is REAL array, dimension (N-1) 51*> The (n-1) subdiagonal elements of the tridiagonal matrix A. 52*> \endverbatim 53*> 54*> \param[in] DF 55*> \verbatim 56*> DF is REAL array, dimension (N) 57*> The n diagonal elements of the factor L from the L*D*L' 58*> factorization of A. 59*> \endverbatim 60*> 61*> \param[in] EF 62*> \verbatim 63*> EF is REAL array, dimension (N-1) 64*> The (n-1) subdiagonal elements of the factor L from the 65*> L*D*L' factorization of A. 66*> \endverbatim 67*> 68*> \param[out] WORK 69*> \verbatim 70*> WORK is REAL array, dimension (2*N) 71*> \endverbatim 72*> 73*> \param[out] RESID 74*> \verbatim 75*> RESID is REAL 76*> norm(L*D*L' - A) / (n * norm(A) * EPS) 77*> \endverbatim 78* 79* Authors: 80* ======== 81* 82*> \author Univ. of Tennessee 83*> \author Univ. of California Berkeley 84*> \author Univ. of Colorado Denver 85*> \author NAG Ltd. 86* 87*> \date November 2011 88* 89*> \ingroup single_lin 90* 91* ===================================================================== 92 SUBROUTINE SPTT01( N, D, E, DF, EF, WORK, RESID ) 93* 94* -- LAPACK test routine (version 3.4.0) -- 95* -- LAPACK is a software package provided by Univ. of Tennessee, -- 96* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 97* November 2011 98* 99* .. Scalar Arguments .. 100 INTEGER N 101 REAL RESID 102* .. 103* .. Array Arguments .. 104 REAL D( * ), DF( * ), E( * ), EF( * ), WORK( * ) 105* .. 106* 107* ===================================================================== 108* 109* .. Parameters .. 110 REAL ONE, ZERO 111 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) 112* .. 113* .. Local Scalars .. 114 INTEGER I 115 REAL ANORM, DE, EPS 116* .. 117* .. External Functions .. 118 REAL SLAMCH 119 EXTERNAL SLAMCH 120* .. 121* .. Intrinsic Functions .. 122 INTRINSIC ABS, MAX, REAL 123* .. 124* .. Executable Statements .. 125* 126* Quick return if possible 127* 128 IF( N.LE.0 ) THEN 129 RESID = ZERO 130 RETURN 131 END IF 132* 133 EPS = SLAMCH( 'Epsilon' ) 134* 135* Construct the difference L*D*L' - A. 136* 137 WORK( 1 ) = DF( 1 ) - D( 1 ) 138 DO 10 I = 1, N - 1 139 DE = DF( I )*EF( I ) 140 WORK( N+I ) = DE - E( I ) 141 WORK( 1+I ) = DE*EF( I ) + DF( I+1 ) - D( I+1 ) 142 10 CONTINUE 143* 144* Compute the 1-norms of the tridiagonal matrices A and WORK. 145* 146 IF( N.EQ.1 ) THEN 147 ANORM = D( 1 ) 148 RESID = ABS( WORK( 1 ) ) 149 ELSE 150 ANORM = MAX( D( 1 )+ABS( E( 1 ) ), D( N )+ABS( E( N-1 ) ) ) 151 RESID = MAX( ABS( WORK( 1 ) )+ABS( WORK( N+1 ) ), 152 $ ABS( WORK( N ) )+ABS( WORK( 2*N-1 ) ) ) 153 DO 20 I = 2, N - 1 154 ANORM = MAX( ANORM, D( I )+ABS( E( I ) )+ABS( E( I-1 ) ) ) 155 RESID = MAX( RESID, ABS( WORK( I ) )+ABS( WORK( N+I-1 ) )+ 156 $ ABS( WORK( N+I ) ) ) 157 20 CONTINUE 158 END IF 159* 160* Compute norm(L*D*L' - A) / (n * norm(A) * EPS) 161* 162 IF( ANORM.LE.ZERO ) THEN 163 IF( RESID.NE.ZERO ) 164 $ RESID = ONE / EPS 165 ELSE 166 RESID = ( ( RESID / REAL( N ) ) / ANORM ) / EPS 167 END IF 168* 169 RETURN 170* 171* End of SPTT01 172* 173 END 174