LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
chet22.f
Go to the documentation of this file.
1 *> \brief \b CHET22
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 CHET22( ITYPE, UPLO, N, M, KBAND, A, LDA, D, E, U, LDU,
12 * V, LDV, TAU, WORK, RWORK, RESULT )
13 *
14 * .. Scalar Arguments ..
15 * CHARACTER UPLO
16 * INTEGER ITYPE, KBAND, LDA, LDU, LDV, M, N
17 * ..
18 * .. Array Arguments ..
19 * REAL D( * ), E( * ), RESULT( 2 ), RWORK( * )
20 * COMPLEX A( LDA, * ), TAU( * ), U( LDU, * ),
21 * $ V( LDV, * ), WORK( * )
22 * ..
23 *
24 *
25 *> \par Purpose:
26 * =============
27 *>
28 *> \verbatim
29 *>
30 *> CHET22 generally checks a decomposition of the form
31 *>
32 *> A U = U S
33 *>
34 *> where A is complex Hermitian, the columns of U are orthonormal,
35 *> and S is diagonal (if KBAND=0) or symmetric tridiagonal (if
36 *> KBAND=1). If ITYPE=1, then U is represented as a dense matrix,
37 *> otherwise the U is expressed as a product of Householder
38 *> transformations, whose vectors are stored in the array "V" and
39 *> whose scaling constants are in "TAU"; we shall use the letter
40 *> "V" to refer to the product of Householder transformations
41 *> (which should be equal to U).
42 *>
43 *> Specifically, if ITYPE=1, then:
44 *>
45 *> RESULT(1) = | U' A U - S | / ( |A| m ulp ) *andC> RESULT(2) = | I - U'U | / ( m ulp )
46 *> \endverbatim
47 *
48 * Arguments:
49 * ==========
50 *
51 *> \verbatim
52 *> ITYPE INTEGER
53 *> Specifies the type of tests to be performed.
54 *> 1: U expressed as a dense orthogonal matrix:
55 *> RESULT(1) = | A - U S U' | / ( |A| n ulp ) *andC> RESULT(2) = | I - UU' | / ( n ulp )
56 *>
57 *> UPLO CHARACTER
58 *> If UPLO='U', the upper triangle of A will be used and the
59 *> (strictly) lower triangle will not be referenced. If
60 *> UPLO='L', the lower triangle of A will be used and the
61 *> (strictly) upper triangle will not be referenced.
62 *> Not modified.
63 *>
64 *> N INTEGER
65 *> The size of the matrix. If it is zero, CHET22 does nothing.
66 *> It must be at least zero.
67 *> Not modified.
68 *>
69 *> M INTEGER
70 *> The number of columns of U. If it is zero, CHET22 does
71 *> nothing. It must be at least zero.
72 *> Not modified.
73 *>
74 *> KBAND INTEGER
75 *> The bandwidth of the matrix. It may only be zero or one.
76 *> If zero, then S is diagonal, and E is not referenced. If
77 *> one, then S is symmetric tri-diagonal.
78 *> Not modified.
79 *>
80 *> A COMPLEX array, dimension (LDA , N)
81 *> The original (unfactored) matrix. It is assumed to be
82 *> symmetric, and only the upper (UPLO='U') or only the lower
83 *> (UPLO='L') will be referenced.
84 *> Not modified.
85 *>
86 *> LDA INTEGER
87 *> The leading dimension of A. It must be at least 1
88 *> and at least N.
89 *> Not modified.
90 *>
91 *> D REAL array, dimension (N)
92 *> The diagonal of the (symmetric tri-) diagonal matrix.
93 *> Not modified.
94 *>
95 *> E REAL array, dimension (N)
96 *> The off-diagonal of the (symmetric tri-) diagonal matrix.
97 *> E(1) is ignored, E(2) is the (1,2) and (2,1) element, etc.
98 *> Not referenced if KBAND=0.
99 *> Not modified.
100 *>
101 *> U COMPLEX array, dimension (LDU, N)
102 *> If ITYPE=1, this contains the orthogonal matrix in
103 *> the decomposition, expressed as a dense matrix.
104 *> Not modified.
105 *>
106 *> LDU INTEGER
107 *> The leading dimension of U. LDU must be at least N and
108 *> at least 1.
109 *> Not modified.
110 *>
111 *> V COMPLEX array, dimension (LDV, N)
112 *> If ITYPE=2 or 3, the lower triangle of this array contains
113 *> the Householder vectors used to describe the orthogonal
114 *> matrix in the decomposition. If ITYPE=1, then it is not
115 *> referenced.
116 *> Not modified.
117 *>
118 *> LDV INTEGER
119 *> The leading dimension of V. LDV must be at least N and
120 *> at least 1.
121 *> Not modified.
122 *>
123 *> TAU COMPLEX array, dimension (N)
124 *> If ITYPE >= 2, then TAU(j) is the scalar factor of
125 *> v(j) v(j)' in the Householder transformation H(j) of
126 *> the product U = H(1)...H(n-2)
127 *> If ITYPE < 2, then TAU is not referenced.
128 *> Not modified.
129 *>
130 *> WORK COMPLEX array, dimension (2*N**2)
131 *> Workspace.
132 *> Modified.
133 *>
134 *> RWORK REAL array, dimension (N)
135 *> Workspace.
136 *> Modified.
137 *>
138 *> RESULT REAL array, dimension (2)
139 *> The values computed by the two tests described above. The
140 *> values are currently limited to 1/ulp, to avoid overflow.
141 *> RESULT(1) is always modified. RESULT(2) is modified only
142 *> if LDU is at least N.
143 *> Modified.
144 *> \endverbatim
145 *
146 * Authors:
147 * ========
148 *
149 *> \author Univ. of Tennessee
150 *> \author Univ. of California Berkeley
151 *> \author Univ. of Colorado Denver
152 *> \author NAG Ltd.
153 *
154 *> \date November 2011
155 *
156 *> \ingroup complex_eig
157 *
158 * =====================================================================
159  SUBROUTINE chet22( ITYPE, UPLO, N, M, KBAND, A, LDA, D, E, U, LDU,
160  $ v, ldv, tau, work, rwork, result )
161 *
162 * -- LAPACK test routine (version 3.4.0) --
163 * -- LAPACK is a software package provided by Univ. of Tennessee, --
164 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
165 * November 2011
166 *
167 * .. Scalar Arguments ..
168  CHARACTER UPLO
169  INTEGER ITYPE, KBAND, LDA, LDU, LDV, M, N
170 * ..
171 * .. Array Arguments ..
172  REAL D( * ), E( * ), RESULT( 2 ), RWORK( * )
173  COMPLEX A( lda, * ), TAU( * ), U( ldu, * ),
174  $ v( ldv, * ), work( * )
175 * ..
176 *
177 * =====================================================================
178 *
179 * .. Parameters ..
180  REAL ZERO, ONE
181  parameter ( zero = 0.0e0, one = 1.0e0 )
182  COMPLEX CZERO, CONE
183  parameter ( czero = ( 0.0e0, 0.0e0 ),
184  $ cone = ( 1.0e0, 0.0e0 ) )
185 * ..
186 * .. Local Scalars ..
187  INTEGER J, JJ, JJ1, JJ2, NN, NNP1
188  REAL ANORM, ULP, UNFL, WNORM
189 * ..
190 * .. External Functions ..
191  REAL CLANHE, SLAMCH
192  EXTERNAL clanhe, slamch
193 * ..
194 * .. External Subroutines ..
195  EXTERNAL cgemm, chemm
196 * ..
197 * .. Intrinsic Functions ..
198  INTRINSIC max, min, real
199 * ..
200 * .. Executable Statements ..
201 *
202  result( 1 ) = zero
203  result( 2 ) = zero
204  IF( n.LE.0 .OR. m.LE.0 )
205  $ RETURN
206 *
207  unfl = slamch( 'Safe minimum' )
208  ulp = slamch( 'Precision' )
209 *
210 * Do Test 1
211 *
212 * Norm of A:
213 *
214  anorm = max( clanhe( '1', uplo, n, a, lda, rwork ), unfl )
215 *
216 * Compute error matrix:
217 *
218 * ITYPE=1: error = U' A U - S
219 *
220  CALL chemm( 'L', uplo, n, m, cone, a, lda, u, ldu, czero, work,
221  $ n )
222  nn = n*n
223  nnp1 = nn + 1
224  CALL cgemm( 'C', 'N', m, m, n, cone, u, ldu, work, n, czero,
225  $ work( nnp1 ), n )
226  DO 10 j = 1, m
227  jj = nn + ( j-1 )*n + j
228  work( jj ) = work( jj ) - d( j )
229  10 CONTINUE
230  IF( kband.EQ.1 .AND. n.GT.1 ) THEN
231  DO 20 j = 2, m
232  jj1 = nn + ( j-1 )*n + j - 1
233  jj2 = nn + ( j-2 )*n + j
234  work( jj1 ) = work( jj1 ) - e( j-1 )
235  work( jj2 ) = work( jj2 ) - e( j-1 )
236  20 CONTINUE
237  END IF
238  wnorm = clanhe( '1', uplo, m, work( nnp1 ), n, rwork )
239 *
240  IF( anorm.GT.wnorm ) THEN
241  result( 1 ) = ( wnorm / anorm ) / ( m*ulp )
242  ELSE
243  IF( anorm.LT.one ) THEN
244  result( 1 ) = ( min( wnorm, m*anorm ) / anorm ) / ( m*ulp )
245  ELSE
246  result( 1 ) = min( wnorm / anorm, REAL( M ) ) / ( M*ULP )
247  END IF
248  END IF
249 *
250 * Do Test 2
251 *
252 * Compute U'U - I
253 *
254  IF( itype.EQ.1 )
255  $ CALL cunt01( 'Columns', n, m, u, ldu, work, 2*n*n, rwork,
256  $ result( 2 ) )
257 *
258  RETURN
259 *
260 * End of CHET22
261 *
262  END
subroutine chet22(ITYPE, UPLO, N, M, KBAND, A, LDA, D, E, U, LDU, V, LDV, TAU, WORK, RWORK, RESULT)
CHET22
Definition: chet22.f:161
subroutine chemm(SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CHEMM
Definition: chemm.f:193
subroutine cgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CGEMM
Definition: cgemm.f:189
subroutine cunt01(ROWCOL, M, N, U, LDU, WORK, LWORK, RWORK, RESID)
CUNT01
Definition: cunt01.f:128