LAPACK  3.5.0
LAPACK: Linear Algebra PACKage
 All Classes Files Functions Variables Typedefs Macros
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 *> \date November 2011
139 *
140 *> \ingroup complex_eig
141 *
142 * =====================================================================
143  SUBROUTINE cget22( TRANSA, TRANSE, TRANSW, N, A, LDA, E, LDE, W,
144  $ work, rwork, result )
145 *
146 * -- LAPACK test routine (version 3.4.0) --
147 * -- LAPACK is a software package provided by Univ. of Tennessee, --
148 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
149 * November 2011
150 *
151 * .. Scalar Arguments ..
152  CHARACTER transa, transe, transw
153  INTEGER lda, lde, n
154 * ..
155 * .. Array Arguments ..
156  REAL result( 2 ), rwork( * )
157  COMPLEX a( lda, * ), e( lde, * ), w( * ), work( * )
158 * ..
159 *
160 * =====================================================================
161 *
162 * .. Parameters ..
163  REAL zero, one
164  parameter( zero = 0.0e+0, one = 1.0e+0 )
165  COMPLEX czero, cone
166  parameter( czero = ( 0.0e+0, 0.0e+0 ),
167  $ cone = ( 1.0e+0, 0.0e+0 ) )
168 * ..
169 * .. Local Scalars ..
170  CHARACTER norma, norme
171  INTEGER itrnse, itrnsw, j, jcol, joff, jrow, jvec
172  REAL anorm, enorm, enrmax, enrmin, errnrm, temp1,
173  $ ulp, unfl
174  COMPLEX wtemp
175 * ..
176 * .. External Functions ..
177  LOGICAL lsame
178  REAL clange, slamch
179  EXTERNAL lsame, clange, slamch
180 * ..
181 * .. External Subroutines ..
182  EXTERNAL cgemm, claset
183 * ..
184 * .. Intrinsic Functions ..
185  INTRINSIC abs, aimag, conjg, max, min, real
186 * ..
187 * .. Executable Statements ..
188 *
189 * Initialize RESULT (in case N=0)
190 *
191  result( 1 ) = zero
192  result( 2 ) = zero
193  IF( n.LE.0 )
194  $ RETURN
195 *
196  unfl = slamch( 'Safe minimum' )
197  ulp = slamch( 'Precision' )
198 *
199  itrnse = 0
200  itrnsw = 0
201  norma = 'O'
202  norme = 'O'
203 *
204  IF( lsame( transa, 'T' ) .OR. lsame( transa, 'C' ) ) THEN
205  norma = 'I'
206  END IF
207 *
208  IF( lsame( transe, 'T' ) ) THEN
209  itrnse = 1
210  norme = 'I'
211  ELSE IF( lsame( transe, 'C' ) ) THEN
212  itrnse = 2
213  norme = 'I'
214  END IF
215 *
216  IF( lsame( transw, 'C' ) ) THEN
217  itrnsw = 1
218  END IF
219 *
220 * Normalization of E:
221 *
222  enrmin = one / ulp
223  enrmax = zero
224  IF( itrnse.EQ.0 ) THEN
225  DO 20 jvec = 1, n
226  temp1 = zero
227  DO 10 j = 1, n
228  temp1 = max( temp1, abs( REAL( E( J, JVEC ) ) )+
229  $ abs( aimag( e( j, jvec ) ) ) )
230  10 CONTINUE
231  enrmin = min( enrmin, temp1 )
232  enrmax = max( enrmax, temp1 )
233  20 CONTINUE
234  ELSE
235  DO 30 jvec = 1, n
236  rwork( jvec ) = zero
237  30 CONTINUE
238 *
239  DO 50 j = 1, n
240  DO 40 jvec = 1, n
241  rwork( jvec ) = max( rwork( jvec ),
242  $ abs( REAL( E( JVEC, J ) ) )+
243  $ abs( aimag( e( jvec, j ) ) ) )
244  40 CONTINUE
245  50 CONTINUE
246 *
247  DO 60 jvec = 1, n
248  enrmin = min( enrmin, rwork( jvec ) )
249  enrmax = max( enrmax, rwork( jvec ) )
250  60 CONTINUE
251  END IF
252 *
253 * Norm of A:
254 *
255  anorm = max( clange( norma, n, n, a, lda, rwork ), unfl )
256 *
257 * Norm of E:
258 *
259  enorm = max( clange( norme, n, n, e, lde, rwork ), ulp )
260 *
261 * Norm of error:
262 *
263 * Error = AE - EW
264 *
265  CALL claset( 'Full', n, n, czero, czero, work, n )
266 *
267  joff = 0
268  DO 100 jcol = 1, n
269  IF( itrnsw.EQ.0 ) THEN
270  wtemp = w( jcol )
271  ELSE
272  wtemp = conjg( w( jcol ) )
273  END IF
274 *
275  IF( itrnse.EQ.0 ) THEN
276  DO 70 jrow = 1, n
277  work( joff+jrow ) = e( jrow, jcol )*wtemp
278  70 CONTINUE
279  ELSE IF( itrnse.EQ.1 ) THEN
280  DO 80 jrow = 1, n
281  work( joff+jrow ) = e( jcol, jrow )*wtemp
282  80 CONTINUE
283  ELSE
284  DO 90 jrow = 1, n
285  work( joff+jrow ) = conjg( e( jcol, jrow ) )*wtemp
286  90 CONTINUE
287  END IF
288  joff = joff + n
289  100 CONTINUE
290 *
291  CALL cgemm( transa, transe, n, n, n, cone, a, lda, e, lde, -cone,
292  $ work, n )
293 *
294  errnrm = clange( 'One', n, n, work, n, rwork ) / enorm
295 *
296 * Compute RESULT(1) (avoiding under/overflow)
297 *
298  IF( anorm.GT.errnrm ) THEN
299  result( 1 ) = ( errnrm / anorm ) / ulp
300  ELSE
301  IF( anorm.LT.one ) THEN
302  result( 1 ) = ( min( errnrm, anorm ) / anorm ) / ulp
303  ELSE
304  result( 1 ) = min( errnrm / anorm, one ) / ulp
305  END IF
306  END IF
307 *
308 * Compute RESULT(2) : the normalization error in E.
309 *
310  result( 2 ) = max( abs( enrmax-one ), abs( enrmin-one ) ) /
311  $ ( REAL( n )*ulp )
312 *
313  RETURN
314 *
315 * End of CGET22
316 *
317  END