3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE SGET51( ITYPE, N, A, LDA, B, LDB, U, LDU, V, LDV, WORK,
14 * .. Scalar Arguments ..
15 * INTEGER ITYPE, LDA, LDB, LDU, LDV, N
18 * .. Array Arguments ..
19 * REAL A( LDA, * ), B( LDB, * ), U( LDU, * ),
20 * $ V( LDV, * ), WORK( * )
29 *> SGET51 generally checks a decomposition of the form
33 *> where ' means transpose and U and V are orthogonal.
35 *> Specifically, if ITYPE=1
37 *> RESULT = | A - U B V' | / ( |A| n ulp )
41 *> RESULT = | A - B | / ( |A| n ulp )
45 *> RESULT = | I - UU' | / ( n ulp )
54 *> Specifies the type of tests to be performed.
55 *> =1: RESULT = | A - U B V' | / ( |A| n ulp )
56 *> =2: RESULT = | A - B | / ( |A| n ulp )
57 *> =3: RESULT = | I - UU' | / ( n ulp )
63 *> The size of the matrix. If it is zero, SGET51 does nothing.
64 *> It must be at least zero.
69 *> A is REAL array, dimension (LDA, N)
70 *> The original (unfactored) matrix.
76 *> The leading dimension of A. It must be at least 1
82 *> B is REAL array, dimension (LDB, N)
83 *> The factored matrix.
89 *> The leading dimension of B. It must be at least 1
95 *> U is REAL array, dimension (LDU, N)
96 *> The orthogonal matrix on the left-hand side in the
98 *> Not referenced if ITYPE=2
104 *> The leading dimension of U. LDU must be at least N and
110 *> V is REAL array, dimension (LDV, N)
111 *> The orthogonal matrix on the left-hand side in the
113 *> Not referenced if ITYPE=2
119 *> The leading dimension of V. LDV must be at least N and
125 *> WORK is REAL array, dimension (2*N**2)
128 *> \param[out] RESULT
131 *> The values computed by the test specified by ITYPE. The
132 *> value is currently limited to 1/ulp, to avoid overflow.
133 *> Errors are flagged by RESULT=10/ulp.
139 *> \author Univ. of Tennessee
140 *> \author Univ. of California Berkeley
141 *> \author Univ. of Colorado Denver
144 *> \date November 2011
146 *> \ingroup single_eig
148 * =====================================================================
149 SUBROUTINE SGET51( ITYPE, N, A, LDA, B, LDB, U, LDU, V, LDV, WORK,
152 * -- LAPACK test routine (version 3.4.0) --
153 * -- LAPACK is a software package provided by Univ. of Tennessee, --
154 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
157 * .. Scalar Arguments ..
158 INTEGER ITYPE, LDA, LDB, LDU, LDV, N
161 * .. Array Arguments ..
162 REAL A( LDA, * ), B( LDB, * ), U( LDU, * ),
163 $ V( LDV, * ), WORK( * )
166 * =====================================================================
170 PARAMETER ( ZERO = 0.0, ONE = 1.0E0, TEN = 10.0E0 )
172 * .. Local Scalars ..
173 INTEGER JCOL, JDIAG, JROW
174 REAL ANORM, ULP, UNFL, WNORM
176 * .. External Functions ..
178 EXTERNAL SLAMCH, SLANGE
180 * .. External Subroutines ..
181 EXTERNAL SGEMM, SLACPY
183 * .. Intrinsic Functions ..
184 INTRINSIC MAX, MIN, REAL
186 * .. Executable Statements ..
194 UNFL = SLAMCH( 'Safe minimum' )
195 ULP = SLAMCH( 'Epsilon' )*SLAMCH( 'Base' )
199 IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN
204 IF( ITYPE.LE.2 ) THEN
206 * Tests scaled by the norm(A)
208 ANORM = MAX( SLANGE( '1', N, N, A, LDA, WORK ), UNFL )
210 IF( ITYPE.EQ.1 ) THEN
212 * ITYPE=1: Compute W = A - UBV'
214 CALL SLACPY( ' ', N, N, A, LDA, WORK, N )
215 CALL SGEMM( 'N', 'N', N, N, N, ONE, U, LDU, B, LDB, ZERO,
216 $ WORK( N**2+1 ), N )
218 CALL SGEMM( 'N', 'C', N, N, N, -ONE, WORK( N**2+1 ), N, V,
219 $ LDV, ONE, WORK, N )
223 * ITYPE=2: Compute W = A - B
225 CALL SLACPY( ' ', N, N, B, LDB, WORK, N )
229 WORK( JROW+N*( JCOL-1 ) ) = WORK( JROW+N*( JCOL-1 ) )
235 * Compute norm(W)/ ( ulp*norm(A) )
237 WNORM = SLANGE( '1', N, N, WORK, N, WORK( N**2+1 ) )
239 IF( ANORM.GT.WNORM ) THEN
240 RESULT = ( WNORM / ANORM ) / ( N*ULP )
242 IF( ANORM.LT.ONE ) THEN
243 RESULT = ( MIN( WNORM, N*ANORM ) / ANORM ) / ( N*ULP )
245 RESULT = MIN( WNORM / ANORM, REAL( N ) ) / ( N*ULP )
251 * Tests not scaled by norm(A)
253 * ITYPE=3: Compute UU' - I
255 CALL SGEMM( 'N', 'C', N, N, N, ONE, U, LDU, U, LDU, ZERO, WORK,
259 WORK( ( N+1 )*( JDIAG-1 )+1 ) = WORK( ( N+1 )*( JDIAG-1 )+
263 RESULT = MIN( SLANGE( '1', N, N, WORK, N, WORK( N**2+1 ) ),
264 $ REAL( N ) ) / ( N*ULP )