3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE SGET53( A, LDA, B, LDB, SCALE, WR, WI, RESULT, INFO )
13 * .. Scalar Arguments ..
14 * INTEGER INFO, LDA, LDB
15 * REAL RESULT, SCALE, WI, WR
17 * .. Array Arguments ..
18 * REAL A( LDA, * ), B( LDB, * )
27 *> SGET53 checks the generalized eigenvalues computed by SLAG2.
29 *> The basic test for an eigenvalue is:
31 *> | det( s A - w B ) |
32 *> RESULT = ---------------------------------------------------
33 *> ulp max( s norm(A), |w| norm(B) )*norm( s A - w B )
35 *> Two "safety checks" are performed:
37 *> (1) ulp*max( s*norm(A), |w|*norm(B) ) must be at least
38 *> safe_minimum. This insures that the test performed is
39 *> not essentially det(0*A + 0*B)=0.
41 *> (2) s*norm(A) + |w|*norm(B) must be less than 1/safe_minimum.
42 *> This insures that s*A - w*B will not overflow.
44 *> If these tests are not passed, then s and w are scaled and
45 *> tested anyway, if this is possible.
53 *> A is REAL array, dimension (LDA, 2)
60 *> The leading dimension of A. It must be at least 2.
65 *> B is REAL array, dimension (LDB, N)
66 *> The 2x2 upper-triangular matrix B.
72 *> The leading dimension of B. It must be at least 2.
78 *> The "scale factor" s in the formula s A - w B . It is
79 *> assumed to be non-negative.
85 *> The real part of the eigenvalue w in the formula
92 *> The imaginary part of the eigenvalue w in the formula
99 *> If INFO is 2 or less, the value computed by the test
101 *> If INFO=3, this will just be 1/ulp.
107 *> =0: The input data pass the "safety checks".
108 *> =1: s*norm(A) + |w|*norm(B) > 1/safe_minimum.
109 *> =2: ulp*max( s*norm(A), |w|*norm(B) ) < safe_minimum
110 *> =3: same as INFO=2, but s and w could not be scaled so
111 *> as to compute the test.
117 *> \author Univ. of Tennessee
118 *> \author Univ. of California Berkeley
119 *> \author Univ. of Colorado Denver
122 *> \date November 2011
124 *> \ingroup single_eig
126 * =====================================================================
127 SUBROUTINE SGET53( A, LDA, B, LDB, SCALE, WR, WI, RESULT, INFO )
129 * -- LAPACK test routine (version 3.4.0) --
130 * -- LAPACK is a software package provided by Univ. of Tennessee, --
131 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
134 * .. Scalar Arguments ..
135 INTEGER INFO, LDA, LDB
136 REAL RESULT, SCALE, WI, WR
138 * .. Array Arguments ..
139 REAL A( LDA, * ), B( LDB, * )
142 * =====================================================================
146 PARAMETER ( ZERO = 0.0, ONE = 1.0 )
148 * .. Local Scalars ..
149 REAL ABSW, ANORM, BNORM, CI11, CI12, CI22, CNORM,
150 $ CR11, CR12, CR21, CR22, CSCALE, DETI, DETR, S1,
151 $ SAFMIN, SCALES, SIGMIN, TEMP, ULP, WIS, WRS
153 * .. External Functions ..
157 * .. Intrinsic Functions ..
158 INTRINSIC ABS, MAX, SQRT
160 * .. Executable Statements ..
170 * Machine constants and norms
172 SAFMIN = SLAMCH( 'Safe minimum' )
173 ULP = SLAMCH( 'Epsilon' )*SLAMCH( 'Base' )
174 ABSW = ABS( WRS ) + ABS( WIS )
175 ANORM = MAX( ABS( A( 1, 1 ) )+ABS( A( 2, 1 ) ),
176 $ ABS( A( 1, 2 ) )+ABS( A( 2, 2 ) ), SAFMIN )
177 BNORM = MAX( ABS( B( 1, 1 ) ), ABS( B( 1, 2 ) )+ABS( B( 2, 2 ) ),
180 * Check for possible overflow.
182 TEMP = ( SAFMIN*BNORM )*ABSW + ( SAFMIN*ANORM )*SCALES
183 IF( TEMP.GE.ONE ) THEN
185 * Scale down to avoid overflow
192 ABSW = ABS( WRS ) + ABS( WIS )
194 S1 = MAX( ULP*MAX( SCALES*ANORM, ABSW*BNORM ),
195 $ SAFMIN*MAX( SCALES, ABSW ) )
197 * Check for W and SCALE essentially zero.
199 IF( S1.LT.SAFMIN ) THEN
201 IF( SCALES.LT.SAFMIN .AND. ABSW.LT.SAFMIN ) THEN
207 * Scale up to avoid underflow
209 TEMP = ONE / MAX( SCALES*ANORM+ABSW*BNORM, SAFMIN )
213 ABSW = ABS( WRS ) + ABS( WIS )
214 S1 = MAX( ULP*MAX( SCALES*ANORM, ABSW*BNORM ),
215 $ SAFMIN*MAX( SCALES, ABSW ) )
216 IF( S1.LT.SAFMIN ) THEN
223 * Compute C = s A - w B
225 CR11 = SCALES*A( 1, 1 ) - WRS*B( 1, 1 )
226 CI11 = -WIS*B( 1, 1 )
227 CR21 = SCALES*A( 2, 1 )
228 CR12 = SCALES*A( 1, 2 ) - WRS*B( 1, 2 )
229 CI12 = -WIS*B( 1, 2 )
230 CR22 = SCALES*A( 2, 2 ) - WRS*B( 2, 2 )
231 CI22 = -WIS*B( 2, 2 )
233 * Compute the smallest singular value of s A - w B:
236 * sigma_min = ------------------
239 CNORM = MAX( ABS( CR11 )+ABS( CI11 )+ABS( CR21 ),
240 $ ABS( CR12 )+ABS( CI12 )+ABS( CR22 )+ABS( CI22 ), SAFMIN )
241 CSCALE = ONE / SQRT( CNORM )
242 DETR = ( CSCALE*CR11 )*( CSCALE*CR22 ) -
243 $ ( CSCALE*CI11 )*( CSCALE*CI22 ) -
244 $ ( CSCALE*CR12 )*( CSCALE*CR21 )
245 DETI = ( CSCALE*CR11 )*( CSCALE*CI22 ) +
246 $ ( CSCALE*CI11 )*( CSCALE*CR22 ) -
247 $ ( CSCALE*CI12 )*( CSCALE*CR21 )
248 SIGMIN = ABS( DETR ) + ABS( DETI )