LAPACK  3.9.1
LAPACK: Linear Algebra PACKage
cget22.f
Go to the documentation of this file.
1 *> \brief \b CGET22
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 CGET22( TRANSA, TRANSE, TRANSW, N, A, LDA, E, LDE, W,
12 * WORK, RWORK, RESULT )
13 *
14 * .. Scalar Arguments ..
15 * CHARACTER TRANSA, TRANSE, TRANSW
16 * INTEGER LDA, LDE, N
17 * ..
18 * .. Array Arguments ..
19 * REAL RESULT( 2 ), RWORK( * )
20 * COMPLEX A( LDA, * ), E( LDE, * ), W( * ), WORK( * )
21 * ..
22 *
23 *
24 *> \par Purpose:
25 * =============
26 *>
27 *> \verbatim
28 *>
29 *> CGET22 does an eigenvector check.
30 *>
31 *> The basic test is:
32 *>
33 *> RESULT(1) = | A E - E W | / ( |A| |E| ulp )
34 *>
35 *> using the 1-norm. It also tests the normalization of E:
36 *>
37 *> RESULT(2) = max | m-norm(E(j)) - 1 | / ( n ulp )
38 *> j
39 *>
40 *> where E(j) is the j-th eigenvector, and m-norm is the max-norm of a
41 *> vector. The max-norm of a complex n-vector x in this case is the
42 *> maximum of |re(x(i)| + |im(x(i)| over i = 1, ..., n.
43 *> \endverbatim
44 *
45 * Arguments:
46 * ==========
47 *
48 *> \param[in] TRANSA
49 *> \verbatim
50 *> TRANSA is CHARACTER*1
51 *> Specifies whether or not A is transposed.
52 *> = 'N': No transpose
53 *> = 'T': Transpose
54 *> = 'C': Conjugate transpose
55 *> \endverbatim
56 *>
57 *> \param[in] TRANSE
58 *> \verbatim
59 *> TRANSE is CHARACTER*1
60 *> Specifies whether or not E is transposed.
61 *> = 'N': No transpose, eigenvectors are in columns of E
62 *> = 'T': Transpose, eigenvectors are in rows of E
63 *> = 'C': Conjugate transpose, eigenvectors are in rows of E
64 *> \endverbatim
65 *>
66 *> \param[in] TRANSW
67 *> \verbatim
68 *> TRANSW is CHARACTER*1
69 *> Specifies whether or not W is transposed.
70 *> = 'N': No transpose
71 *> = 'T': Transpose, same as TRANSW = 'N'
72 *> = 'C': Conjugate transpose, use -WI(j) instead of WI(j)
73 *> \endverbatim
74 *>
75 *> \param[in] N
76 *> \verbatim
77 *> N is INTEGER
78 *> The order of the matrix A. N >= 0.
79 *> \endverbatim
80 *>
81 *> \param[in] A
82 *> \verbatim
83 *> A is COMPLEX array, dimension (LDA,N)
84 *> The matrix whose eigenvectors are in E.
85 *> \endverbatim
86 *>
87 *> \param[in] LDA
88 *> \verbatim
89 *> LDA is INTEGER
90 *> The leading dimension of the array A. LDA >= max(1,N).
91 *> \endverbatim
92 *>
93 *> \param[in] E
94 *> \verbatim
95 *> E is COMPLEX array, dimension (LDE,N)
96 *> The matrix of eigenvectors. If TRANSE = 'N', the eigenvectors
97 *> are stored in the columns of E, if TRANSE = 'T' or 'C', the
98 *> eigenvectors are stored in the rows of E.
99 *> \endverbatim
100 *>
101 *> \param[in] LDE
102 *> \verbatim
103 *> LDE is INTEGER
104 *> The leading dimension of the array E. LDE >= max(1,N).
105 *> \endverbatim
106 *>
107 *> \param[in] W
108 *> \verbatim
109 *> W is COMPLEX array, dimension (N)
110 *> The eigenvalues of A.
111 *> \endverbatim
112 *>
113 *> \param[out] WORK
114 *> \verbatim
115 *> WORK is COMPLEX array, dimension (N*N)
116 *> \endverbatim
117 *>
118 *> \param[out] RWORK
119 *> \verbatim
120 *> RWORK is REAL array, dimension (N)
121 *> \endverbatim
122 *>
123 *> \param[out] RESULT
124 *> \verbatim
125 *> RESULT is REAL array, dimension (2)
126 *> RESULT(1) = | A E - E W | / ( |A| |E| ulp )
127 *> RESULT(2) = max | m-norm(E(j)) - 1 | / ( n ulp )
128 *> \endverbatim
129 *
130 * Authors:
131 * ========
132 *
133 *> \author Univ. of Tennessee
134 *> \author Univ. of California Berkeley
135 *> \author Univ. of Colorado Denver
136 *> \author NAG Ltd.
137 *
138 *> \ingroup complex_eig
139 *
140 * =====================================================================
141  SUBROUTINE cget22( TRANSA, TRANSE, TRANSW, N, A, LDA, E, LDE, W,
142  $ WORK, RWORK, RESULT )
143 *
144 * -- LAPACK test routine --
145 * -- LAPACK is a software package provided by Univ. of Tennessee, --
146 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
147 *
148 * .. Scalar Arguments ..
149  CHARACTER TRANSA, TRANSE, TRANSW
150  INTEGER LDA, LDE, N
151 * ..
152 * .. Array Arguments ..
153  REAL RESULT( 2 ), RWORK( * )
154  COMPLEX A( LDA, * ), E( LDE, * ), W( * ), WORK( * )
155 * ..
156 *
157 * =====================================================================
158 *
159 * .. Parameters ..
160  REAL ZERO, ONE
161  parameter( zero = 0.0e+0, one = 1.0e+0 )
162  COMPLEX CZERO, CONE
163  parameter( czero = ( 0.0e+0, 0.0e+0 ),
164  $ cone = ( 1.0e+0, 0.0e+0 ) )
165 * ..
166 * .. Local Scalars ..
167  CHARACTER NORMA, NORME
168  INTEGER ITRNSE, ITRNSW, J, JCOL, JOFF, JROW, JVEC
169  REAL ANORM, ENORM, ENRMAX, ENRMIN, ERRNRM, TEMP1,
170  $ ulp, unfl
171  COMPLEX WTEMP
172 * ..
173 * .. External Functions ..
174  LOGICAL LSAME
175  REAL CLANGE, SLAMCH
176  EXTERNAL lsame, clange, slamch
177 * ..
178 * .. External Subroutines ..
179  EXTERNAL cgemm, claset
180 * ..
181 * .. Intrinsic Functions ..
182  INTRINSIC abs, aimag, conjg, max, min, real
183 * ..
184 * .. Executable Statements ..
185 *
186 * Initialize RESULT (in case N=0)
187 *
188  result( 1 ) = zero
189  result( 2 ) = zero
190  IF( n.LE.0 )
191  $ RETURN
192 *
193  unfl = slamch( 'Safe minimum' )
194  ulp = slamch( 'Precision' )
195 *
196  itrnse = 0
197  itrnsw = 0
198  norma = 'O'
199  norme = 'O'
200 *
201  IF( lsame( transa, 'T' ) .OR. lsame( transa, 'C' ) ) THEN
202  norma = 'I'
203  END IF
204 *
205  IF( lsame( transe, 'T' ) ) THEN
206  itrnse = 1
207  norme = 'I'
208  ELSE IF( lsame( transe, 'C' ) ) THEN
209  itrnse = 2
210  norme = 'I'
211  END IF
212 *
213  IF( lsame( transw, 'C' ) ) THEN
214  itrnsw = 1
215  END IF
216 *
217 * Normalization of E:
218 *
219  enrmin = one / ulp
220  enrmax = zero
221  IF( itrnse.EQ.0 ) THEN
222  DO 20 jvec = 1, n
223  temp1 = zero
224  DO 10 j = 1, n
225  temp1 = max( temp1, abs( real( e( j, jvec ) ) )+
226  $ abs( aimag( e( j, jvec ) ) ) )
227  10 CONTINUE
228  enrmin = min( enrmin, temp1 )
229  enrmax = max( enrmax, temp1 )
230  20 CONTINUE
231  ELSE
232  DO 30 jvec = 1, n
233  rwork( jvec ) = zero
234  30 CONTINUE
235 *
236  DO 50 j = 1, n
237  DO 40 jvec = 1, n
238  rwork( jvec ) = max( rwork( jvec ),
239  $ abs( real( e( jvec, j ) ) )+
240  $ abs( aimag( e( jvec, j ) ) ) )
241  40 CONTINUE
242  50 CONTINUE
243 *
244  DO 60 jvec = 1, n
245  enrmin = min( enrmin, rwork( jvec ) )
246  enrmax = max( enrmax, rwork( jvec ) )
247  60 CONTINUE
248  END IF
249 *
250 * Norm of A:
251 *
252  anorm = max( clange( norma, n, n, a, lda, rwork ), unfl )
253 *
254 * Norm of E:
255 *
256  enorm = max( clange( norme, n, n, e, lde, rwork ), ulp )
257 *
258 * Norm of error:
259 *
260 * Error = AE - EW
261 *
262  CALL claset( 'Full', n, n, czero, czero, work, n )
263 *
264  joff = 0
265  DO 100 jcol = 1, n
266  IF( itrnsw.EQ.0 ) THEN
267  wtemp = w( jcol )
268  ELSE
269  wtemp = conjg( w( jcol ) )
270  END IF
271 *
272  IF( itrnse.EQ.0 ) THEN
273  DO 70 jrow = 1, n
274  work( joff+jrow ) = e( jrow, jcol )*wtemp
275  70 CONTINUE
276  ELSE IF( itrnse.EQ.1 ) THEN
277  DO 80 jrow = 1, n
278  work( joff+jrow ) = e( jcol, jrow )*wtemp
279  80 CONTINUE
280  ELSE
281  DO 90 jrow = 1, n
282  work( joff+jrow ) = conjg( e( jcol, jrow ) )*wtemp
283  90 CONTINUE
284  END IF
285  joff = joff + n
286  100 CONTINUE
287 *
288  CALL cgemm( transa, transe, n, n, n, cone, a, lda, e, lde, -cone,
289  $ work, n )
290 *
291  errnrm = clange( 'One', n, n, work, n, rwork ) / enorm
292 *
293 * Compute RESULT(1) (avoiding under/overflow)
294 *
295  IF( anorm.GT.errnrm ) THEN
296  result( 1 ) = ( errnrm / anorm ) / ulp
297  ELSE
298  IF( anorm.LT.one ) THEN
299  result( 1 ) = ( min( errnrm, anorm ) / anorm ) / ulp
300  ELSE
301  result( 1 ) = min( errnrm / anorm, one ) / ulp
302  END IF
303  END IF
304 *
305 * Compute RESULT(2) : the normalization error in E.
306 *
307  result( 2 ) = max( abs( enrmax-one ), abs( enrmin-one ) ) /
308  $ ( real( n )*ulp )
309 *
310  RETURN
311 *
312 * End of CGET22
313 *
314  END
subroutine cgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CGEMM
Definition: cgemm.f:187
subroutine cget22(TRANSA, TRANSE, TRANSW, N, A, LDA, E, LDE, W, WORK, RWORK, RESULT)
CGET22
Definition: cget22.f:143
subroutine claset(UPLO, M, N, ALPHA, BETA, A, LDA)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition: claset.f:106