LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dget51.f
Go to the documentation of this file.
1*> \brief \b DGET51
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 DGET51( ITYPE, N, A, LDA, B, LDB, U, LDU, V, LDV, WORK,
12* RESULT )
13*
14* .. Scalar Arguments ..
15* INTEGER ITYPE, LDA, LDB, LDU, LDV, N
16* DOUBLE PRECISION RESULT
17* ..
18* .. Array Arguments ..
19* DOUBLE PRECISION A( LDA, * ), B( LDB, * ), U( LDU, * ),
20* $ V( LDV, * ), WORK( * )
21* ..
22*
23*
24*> \par Purpose:
25* =============
26*>
27*> \verbatim
28*>
29*> DGET51 generally checks a decomposition of the form
30*>
31*> A = U B V'
32*>
33*> where ' means transpose and U and V are orthogonal.
34*>
35*> Specifically, if ITYPE=1
36*>
37*> RESULT = | A - U B V' | / ( |A| n ulp )
38*>
39*> If ITYPE=2, then:
40*>
41*> RESULT = | A - B | / ( |A| n ulp )
42*>
43*> If ITYPE=3, then:
44*>
45*> RESULT = | I - UU' | / ( n ulp )
46*> \endverbatim
47*
48* Arguments:
49* ==========
50*
51*> \param[in] ITYPE
52*> \verbatim
53*> ITYPE is INTEGER
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 )
58*> \endverbatim
59*>
60*> \param[in] N
61*> \verbatim
62*> N is INTEGER
63*> The size of the matrix. If it is zero, DGET51 does nothing.
64*> It must be at least zero.
65*> \endverbatim
66*>
67*> \param[in] A
68*> \verbatim
69*> A is DOUBLE PRECISION array, dimension (LDA, N)
70*> The original (unfactored) matrix.
71*> \endverbatim
72*>
73*> \param[in] LDA
74*> \verbatim
75*> LDA is INTEGER
76*> The leading dimension of A. It must be at least 1
77*> and at least N.
78*> \endverbatim
79*>
80*> \param[in] B
81*> \verbatim
82*> B is DOUBLE PRECISION array, dimension (LDB, N)
83*> The factored matrix.
84*> \endverbatim
85*>
86*> \param[in] LDB
87*> \verbatim
88*> LDB is INTEGER
89*> The leading dimension of B. It must be at least 1
90*> and at least N.
91*> \endverbatim
92*>
93*> \param[in] U
94*> \verbatim
95*> U is DOUBLE PRECISION array, dimension (LDU, N)
96*> The orthogonal matrix on the left-hand side in the
97*> decomposition.
98*> Not referenced if ITYPE=2
99*> \endverbatim
100*>
101*> \param[in] LDU
102*> \verbatim
103*> LDU is INTEGER
104*> The leading dimension of U. LDU must be at least N and
105*> at least 1.
106*> \endverbatim
107*>
108*> \param[in] V
109*> \verbatim
110*> V is DOUBLE PRECISION array, dimension (LDV, N)
111*> The orthogonal matrix on the left-hand side in the
112*> decomposition.
113*> Not referenced if ITYPE=2
114*> \endverbatim
115*>
116*> \param[in] LDV
117*> \verbatim
118*> LDV is INTEGER
119*> The leading dimension of V. LDV must be at least N and
120*> at least 1.
121*> \endverbatim
122*>
123*> \param[out] WORK
124*> \verbatim
125*> WORK is DOUBLE PRECISION array, dimension (2*N**2)
126*> \endverbatim
127*>
128*> \param[out] RESULT
129*> \verbatim
130*> RESULT is DOUBLE PRECISION
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.
134*> \endverbatim
135*
136* Authors:
137* ========
138*
139*> \author Univ. of Tennessee
140*> \author Univ. of California Berkeley
141*> \author Univ. of Colorado Denver
142*> \author NAG Ltd.
143*
144*> \ingroup double_eig
145*
146* =====================================================================
147 SUBROUTINE dget51( ITYPE, N, A, LDA, B, LDB, U, LDU, V, LDV, WORK,
148 $ RESULT )
149*
150* -- LAPACK test routine --
151* -- LAPACK is a software package provided by Univ. of Tennessee, --
152* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
153*
154* .. Scalar Arguments ..
155 INTEGER ITYPE, LDA, LDB, LDU, LDV, N
156 DOUBLE PRECISION RESULT
157* ..
158* .. Array Arguments ..
159 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), U( LDU, * ),
160 $ v( ldv, * ), work( * )
161* ..
162*
163* =====================================================================
164*
165* .. Parameters ..
166 DOUBLE PRECISION ZERO, ONE, TEN
167 parameter( zero = 0.0d0, one = 1.0d0, ten = 10.0d0 )
168* ..
169* .. Local Scalars ..
170 INTEGER JCOL, JDIAG, JROW
171 DOUBLE PRECISION ANORM, ULP, UNFL, WNORM
172* ..
173* .. External Functions ..
174 DOUBLE PRECISION DLAMCH, DLANGE
175 EXTERNAL dlamch, dlange
176* ..
177* .. External Subroutines ..
178 EXTERNAL dgemm, dlacpy
179* ..
180* .. Intrinsic Functions ..
181 INTRINSIC dble, max, min
182* ..
183* .. Executable Statements ..
184*
185 result = zero
186 IF( n.LE.0 )
187 $ RETURN
188*
189* Constants
190*
191 unfl = dlamch( 'Safe minimum' )
192 ulp = dlamch( 'Epsilon' )*dlamch( 'Base' )
193*
194* Some Error Checks
195*
196 IF( itype.LT.1 .OR. itype.GT.3 ) THEN
197 result = ten / ulp
198 RETURN
199 END IF
200*
201 IF( itype.LE.2 ) THEN
202*
203* Tests scaled by the norm(A)
204*
205 anorm = max( dlange( '1', n, n, a, lda, work ), unfl )
206*
207 IF( itype.EQ.1 ) THEN
208*
209* ITYPE=1: Compute W = A - UBV'
210*
211 CALL dlacpy( ' ', n, n, a, lda, work, n )
212 CALL dgemm( 'N', 'N', n, n, n, one, u, ldu, b, ldb, zero,
213 $ work( n**2+1 ), n )
214*
215 CALL dgemm( 'N', 'C', n, n, n, -one, work( n**2+1 ), n, v,
216 $ ldv, one, work, n )
217*
218 ELSE
219*
220* ITYPE=2: Compute W = A - B
221*
222 CALL dlacpy( ' ', n, n, b, ldb, work, n )
223*
224 DO 20 jcol = 1, n
225 DO 10 jrow = 1, n
226 work( jrow+n*( jcol-1 ) ) = work( jrow+n*( jcol-1 ) )
227 $ - a( jrow, jcol )
228 10 CONTINUE
229 20 CONTINUE
230 END IF
231*
232* Compute norm(W)/ ( ulp*norm(A) )
233*
234 wnorm = dlange( '1', n, n, work, n, work( n**2+1 ) )
235*
236 IF( anorm.GT.wnorm ) THEN
237 result = ( wnorm / anorm ) / ( n*ulp )
238 ELSE
239 IF( anorm.LT.one ) THEN
240 result = ( min( wnorm, n*anorm ) / anorm ) / ( n*ulp )
241 ELSE
242 result = min( wnorm / anorm, dble( n ) ) / ( n*ulp )
243 END IF
244 END IF
245*
246 ELSE
247*
248* Tests not scaled by norm(A)
249*
250* ITYPE=3: Compute UU' - I
251*
252 CALL dgemm( 'N', 'C', n, n, n, one, u, ldu, u, ldu, zero, work,
253 $ n )
254*
255 DO 30 jdiag = 1, n
256 work( ( n+1 )*( jdiag-1 )+1 ) = work( ( n+1 )*( jdiag-1 )+
257 $ 1 ) - one
258 30 CONTINUE
259*
260 result = min( dlange( '1', n, n, work, n, work( n**2+1 ) ),
261 $ dble( n ) ) / ( n*ulp )
262 END IF
263*
264 RETURN
265*
266* End of DGET51
267*
268 END
subroutine dlacpy(UPLO, M, N, A, LDA, B, LDB)
DLACPY copies all or part of one two-dimensional array to another.
Definition: dlacpy.f:103
subroutine dgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
DGEMM
Definition: dgemm.f:187
subroutine dget51(ITYPE, N, A, LDA, B, LDB, U, LDU, V, LDV, WORK, RESULT)
DGET51
Definition: dget51.f:149