LAPACK  3.4.2
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
zget51.f
Go to the documentation of this file.
1 *> \brief \b ZGET51
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 ZGET51( ITYPE, N, A, LDA, B, LDB, U, LDU, V, LDV, WORK,
12 * RWORK, RESULT )
13 *
14 * .. Scalar Arguments ..
15 * INTEGER ITYPE, LDA, LDB, LDU, LDV, N
16 * DOUBLE PRECISION RESULT
17 * ..
18 * .. Array Arguments ..
19 * DOUBLE PRECISION RWORK( * )
20 * COMPLEX*16 A( LDA, * ), B( LDB, * ), U( LDU, * ),
21 * $ V( LDV, * ), WORK( * )
22 * ..
23 *
24 *
25 *> \par Purpose:
26 * =============
27 *>
28 *> \verbatim
29 *>
30 *> ZGET51 generally checks a decomposition of the form
31 *>
32 *> A = U B VC>
33 *> where * means conjugate transpose and U and V are unitary.
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, ZGET51 does nothing.
64 *> It must be at least zero.
65 *> \endverbatim
66 *>
67 *> \param[in] A
68 *> \verbatim
69 *> A is COMPLEX*16 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 COMPLEX*16 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 COMPLEX*16 array, dimension (LDU, N)
96 *> The unitary 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 COMPLEX*16 array, dimension (LDV, N)
111 *> The unitary 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 COMPLEX*16 array, dimension (2*N**2)
126 *> \endverbatim
127 *>
128 *> \param[out] RWORK
129 *> \verbatim
130 *> RWORK is DOUBLE PRECISION array, dimension (N)
131 *> \endverbatim
132 *>
133 *> \param[out] RESULT
134 *> \verbatim
135 *> RESULT is DOUBLE PRECISION
136 *> The values computed by the test specified by ITYPE. The
137 *> value is currently limited to 1/ulp, to avoid overflow.
138 *> Errors are flagged by RESULT=10/ulp.
139 *> \endverbatim
140 *
141 * Authors:
142 * ========
143 *
144 *> \author Univ. of Tennessee
145 *> \author Univ. of California Berkeley
146 *> \author Univ. of Colorado Denver
147 *> \author NAG Ltd.
148 *
149 *> \date November 2011
150 *
151 *> \ingroup complex16_eig
152 *
153 * =====================================================================
154  SUBROUTINE zget51( ITYPE, N, A, LDA, B, LDB, U, LDU, V, LDV, WORK,
155  $ rwork, result )
156 *
157 * -- LAPACK test routine (version 3.4.0) --
158 * -- LAPACK is a software package provided by Univ. of Tennessee, --
159 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
160 * November 2011
161 *
162 * .. Scalar Arguments ..
163  INTEGER itype, lda, ldb, ldu, ldv, n
164  DOUBLE PRECISION result
165 * ..
166 * .. Array Arguments ..
167  DOUBLE PRECISION rwork( * )
168  COMPLEX*16 a( lda, * ), b( ldb, * ), u( ldu, * ),
169  $ v( ldv, * ), work( * )
170 * ..
171 *
172 * =====================================================================
173 *
174 * .. Parameters ..
175  DOUBLE PRECISION zero, one, ten
176  parameter( zero = 0.0d+0, one = 1.0d+0, ten = 10.0d+0 )
177  COMPLEX*16 czero, cone
178  parameter( czero = ( 0.0d+0, 0.0d+0 ),
179  $ cone = ( 1.0d+0, 0.0d+0 ) )
180 * ..
181 * .. Local Scalars ..
182  INTEGER jcol, jdiag, jrow
183  DOUBLE PRECISION anorm, ulp, unfl, wnorm
184 * ..
185 * .. External Functions ..
186  DOUBLE PRECISION dlamch, zlange
187  EXTERNAL dlamch, zlange
188 * ..
189 * .. External Subroutines ..
190  EXTERNAL zgemm, zlacpy
191 * ..
192 * .. Intrinsic Functions ..
193  INTRINSIC dble, max, min
194 * ..
195 * .. Executable Statements ..
196 *
197  result = zero
198  IF( n.LE.0 )
199  $ return
200 *
201 * Constants
202 *
203  unfl = dlamch( 'Safe minimum' )
204  ulp = dlamch( 'Epsilon' )*dlamch( 'Base' )
205 *
206 * Some Error Checks
207 *
208  IF( itype.LT.1 .OR. itype.GT.3 ) THEN
209  result = ten / ulp
210  return
211  END IF
212 *
213  IF( itype.LE.2 ) THEN
214 *
215 * Tests scaled by the norm(A)
216 *
217  anorm = max( zlange( '1', n, n, a, lda, rwork ), unfl )
218 *
219  IF( itype.EQ.1 ) THEN
220 *
221 * ITYPE=1: Compute W = A - UBV'
222 *
223  CALL zlacpy( ' ', n, n, a, lda, work, n )
224  CALL zgemm( 'N', 'N', n, n, n, cone, u, ldu, b, ldb, czero,
225  $ work( n**2+1 ), n )
226 *
227  CALL zgemm( 'N', 'C', n, n, n, -cone, work( n**2+1 ), n, v,
228  $ ldv, cone, work, n )
229 *
230  ELSE
231 *
232 * ITYPE=2: Compute W = A - B
233 *
234  CALL zlacpy( ' ', n, n, b, ldb, work, n )
235 *
236  DO 20 jcol = 1, n
237  DO 10 jrow = 1, n
238  work( jrow+n*( jcol-1 ) ) = work( jrow+n*( jcol-1 ) )
239  $ - a( jrow, jcol )
240  10 continue
241  20 continue
242  END IF
243 *
244 * Compute norm(W)/ ( ulp*norm(A) )
245 *
246  wnorm = zlange( '1', n, n, work, n, rwork )
247 *
248  IF( anorm.GT.wnorm ) THEN
249  result = ( wnorm / anorm ) / ( n*ulp )
250  ELSE
251  IF( anorm.LT.one ) THEN
252  result = ( min( wnorm, n*anorm ) / anorm ) / ( n*ulp )
253  ELSE
254  result = min( wnorm / anorm, dble( n ) ) / ( n*ulp )
255  END IF
256  END IF
257 *
258  ELSE
259 *
260 * Tests not scaled by norm(A)
261 *
262 * ITYPE=3: Compute UU' - I
263 *
264  CALL zgemm( 'N', 'C', n, n, n, cone, u, ldu, u, ldu, czero,
265  $ work, n )
266 *
267  DO 30 jdiag = 1, n
268  work( ( n+1 )*( jdiag-1 )+1 ) = work( ( n+1 )*( jdiag-1 )+
269  $ 1 ) - cone
270  30 continue
271 *
272  result = min( zlange( '1', n, n, work, n, rwork ),
273  $ dble( n ) ) / ( n*ulp )
274  END IF
275 *
276  return
277 *
278 * End of ZGET51
279 *
280  END