3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE SSTT22( N, M, KBAND, AD, AE, SD, SE, U, LDU, WORK,
14 * .. Scalar Arguments ..
15 * INTEGER KBAND, LDU, LDWORK, M, N
17 * .. Array Arguments ..
18 * REAL AD( * ), AE( * ), RESULT( 2 ), SD( * ),
19 * $ SE( * ), U( LDU, * ), WORK( LDWORK, * )
28 *> SSTT22 checks a set of M eigenvalues and eigenvectors,
32 *> where A is symmetric tridiagonal, the columns of U are orthogonal,
33 *> and S is diagonal (if KBAND=0) or symmetric tridiagonal (if KBAND=1).
34 *> Two tests are performed:
36 *> RESULT(1) = | U' A U - S | / ( |A| m ulp )
38 *> RESULT(2) = | I - U'U | / ( m ulp )
47 *> The size of the matrix. If it is zero, SSTT22 does nothing.
48 *> It must be at least zero.
54 *> The number of eigenpairs to check. If it is zero, SSTT22
55 *> does nothing. It must be at least zero.
61 *> The bandwidth of the matrix S. It may only be zero or one.
62 *> If zero, then S is diagonal, and SE is not referenced. If
63 *> one, then S is symmetric tri-diagonal.
68 *> AD is REAL array, dimension (N)
69 *> The diagonal of the original (unfactored) matrix A. A is
70 *> assumed to be symmetric tridiagonal.
75 *> AE is REAL array, dimension (N)
76 *> The off-diagonal of the original (unfactored) matrix A. A
77 *> is assumed to be symmetric tridiagonal. AE(1) is ignored,
78 *> AE(2) is the (1,2) and (2,1) element, etc.
83 *> SD is REAL array, dimension (N)
84 *> The diagonal of the (symmetric tri-) diagonal matrix S.
89 *> SE is REAL array, dimension (N)
90 *> The off-diagonal of the (symmetric tri-) diagonal matrix S.
91 *> Not referenced if KBSND=0. If KBAND=1, then AE(1) is
92 *> ignored, SE(2) is the (1,2) and (2,1) element, etc.
97 *> U is REAL array, dimension (LDU, N)
98 *> The orthogonal matrix in the decomposition.
104 *> The leading dimension of U. LDU must be at least N.
109 *> WORK is REAL array, dimension (LDWORK, M+1)
115 *> The leading dimension of WORK. LDWORK must be at least
119 *> \param[out] RESULT
121 *> RESULT is REAL array, dimension (2)
122 *> The values computed by the two tests described above. The
123 *> values are currently limited to 1/ulp, to avoid overflow.
129 *> \author Univ. of Tennessee
130 *> \author Univ. of California Berkeley
131 *> \author Univ. of Colorado Denver
134 *> \date November 2011
136 *> \ingroup single_eig
138 * =====================================================================
139 SUBROUTINE SSTT22( N, M, KBAND, AD, AE, SD, SE, U, LDU, WORK,
142 * -- LAPACK test routine (version 3.4.0) --
143 * -- LAPACK is a software package provided by Univ. of Tennessee, --
144 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
147 * .. Scalar Arguments ..
148 INTEGER KBAND, LDU, LDWORK, M, N
150 * .. Array Arguments ..
151 REAL AD( * ), AE( * ), RESULT( 2 ), SD( * ),
152 $ SE( * ), U( LDU, * ), WORK( LDWORK, * )
155 * =====================================================================
159 PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
161 * .. Local Scalars ..
163 REAL ANORM, AUKJ, ULP, UNFL, WNORM
165 * .. External Functions ..
166 REAL SLAMCH, SLANGE, SLANSY
167 EXTERNAL SLAMCH, SLANGE, SLANSY
169 * .. External Subroutines ..
172 * .. Intrinsic Functions ..
173 INTRINSIC ABS, MAX, MIN, REAL
175 * .. Executable Statements ..
179 IF( N.LE.0 .OR. M.LE.0 )
182 UNFL = SLAMCH( 'Safe minimum' )
183 ULP = SLAMCH( 'Epsilon' )
187 * Compute the 1-norm of A.
190 ANORM = ABS( AD( 1 ) ) + ABS( AE( 1 ) )
192 ANORM = MAX( ANORM, ABS( AD( J ) )+ABS( AE( J ) )+
195 ANORM = MAX( ANORM, ABS( AD( N ) )+ABS( AE( N-1 ) ) )
197 ANORM = ABS( AD( 1 ) )
199 ANORM = MAX( ANORM, UNFL )
207 AUKJ = AD( K )*U( K, J )
209 $ AUKJ = AUKJ + AE( K )*U( K+1, J )
211 $ AUKJ = AUKJ + AE( K-1 )*U( K-1, J )
212 WORK( I, J ) = WORK( I, J ) + U( K, I )*AUKJ
215 WORK( I, I ) = WORK( I, I ) - SD( I )
216 IF( KBAND.EQ.1 ) THEN
218 $ WORK( I, I-1 ) = WORK( I, I-1 ) - SE( I-1 )
220 $ WORK( I, I+1 ) = WORK( I, I+1 ) - SE( I )
224 WNORM = SLANSY( '1', 'L', M, WORK, M, WORK( 1, M+1 ) )
226 IF( ANORM.GT.WNORM ) THEN
227 RESULT( 1 ) = ( WNORM / ANORM ) / ( M*ULP )
229 IF( ANORM.LT.ONE ) THEN
230 RESULT( 1 ) = ( MIN( WNORM, M*ANORM ) / ANORM ) / ( M*ULP )
232 RESULT( 1 ) = MIN( WNORM / ANORM, REAL( M ) ) / ( M*ULP )
240 CALL SGEMM( 'T', 'N', M, M, N, ONE, U, LDU, U, LDU, ZERO, WORK,
244 WORK( J, J ) = WORK( J, J ) - ONE
247 RESULT( 2 ) = MIN( REAL( M ), SLANGE( '1', M, M, WORK, M, WORK( 1,
248 $ M+1 ) ) ) / ( M*ULP )