LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
chet01_rook.f
Go to the documentation of this file.
1*> \brief \b CHET01_ROOK
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 CHET01_ROOK( UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C, LDC,
12* RWORK, RESID )
13*
14* .. Scalar Arguments ..
15* CHARACTER UPLO
16* INTEGER LDA, LDAFAC, LDC, N
17* REAL RESID
18* ..
19* .. Array Arguments ..
20* INTEGER IPIV( * )
21* REAL RWORK( * )
22* COMPLEX A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * )
23* ..
24*
25*
26*> \par Purpose:
27* =============
28*>
29*> \verbatim
30*>
31*> CHET01_ROOK reconstructs a complex Hermitian indefinite matrix A from its
32*> block L*D*L' or U*D*U' factorization and computes the residual
33*> norm( C - A ) / ( N * norm(A) * EPS ),
34*> where C is the reconstructed matrix, EPS is the machine epsilon,
35*> L' is the transpose of L, and U' is the transpose of U.
36*> \endverbatim
37*
38* Arguments:
39* ==========
40*
41*> \param[in] UPLO
42*> \verbatim
43*> UPLO is CHARACTER*1
44*> Specifies whether the upper or lower triangular part of the
45*> complex Hermitian matrix A is stored:
46*> = 'U': Upper triangular
47*> = 'L': Lower triangular
48*> \endverbatim
49*>
50*> \param[in] N
51*> \verbatim
52*> N is INTEGER
53*> The number of rows and columns of the matrix A. N >= 0.
54*> \endverbatim
55*>
56*> \param[in] A
57*> \verbatim
58*> A is COMPLEX array, dimension (LDA,N)
59*> The original complex Hermitian matrix A.
60*> \endverbatim
61*>
62*> \param[in] LDA
63*> \verbatim
64*> LDA is INTEGER
65*> The leading dimension of the array A. LDA >= max(1,N)
66*> \endverbatim
67*>
68*> \param[in] AFAC
69*> \verbatim
70*> AFAC is COMPLEX array, dimension (LDAFAC,N)
71*> The factored form of the matrix A. AFAC contains the block
72*> diagonal matrix D and the multipliers used to obtain the
73*> factor L or U from the block L*D*L' or U*D*U' factorization
74*> as computed by CSYTRF_ROOK.
75*> \endverbatim
76*>
77*> \param[in] LDAFAC
78*> \verbatim
79*> LDAFAC is INTEGER
80*> The leading dimension of the array AFAC. LDAFAC >= max(1,N).
81*> \endverbatim
82*>
83*> \param[in] IPIV
84*> \verbatim
85*> IPIV is INTEGER array, dimension (N)
86*> The pivot indices from CSYTRF_ROOK.
87*> \endverbatim
88*>
89*> \param[out] C
90*> \verbatim
91*> C is COMPLEX array, dimension (LDC,N)
92*> \endverbatim
93*>
94*> \param[in] LDC
95*> \verbatim
96*> LDC is INTEGER
97*> The leading dimension of the array C. LDC >= max(1,N).
98*> \endverbatim
99*>
100*> \param[out] RWORK
101*> \verbatim
102*> RWORK is REAL array, dimension (N)
103*> \endverbatim
104*>
105*> \param[out] RESID
106*> \verbatim
107*> RESID is REAL
108*> If UPLO = 'L', norm(L*D*L' - A) / ( N * norm(A) * EPS )
109*> If UPLO = 'U', norm(U*D*U' - A) / ( N * norm(A) * EPS )
110*> \endverbatim
111*
112* Authors:
113* ========
114*
115*> \author Univ. of Tennessee
116*> \author Univ. of California Berkeley
117*> \author Univ. of Colorado Denver
118*> \author NAG Ltd.
119*
120*> \ingroup complex_lin
121*
122* =====================================================================
123 SUBROUTINE chet01_rook( UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C,
124 $ LDC, RWORK, RESID )
125*
126* -- LAPACK test routine --
127* -- LAPACK is a software package provided by Univ. of Tennessee, --
128* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
129*
130* .. Scalar Arguments ..
131 CHARACTER UPLO
132 INTEGER LDA, LDAFAC, LDC, N
133 REAL RESID
134* ..
135* .. Array Arguments ..
136 INTEGER IPIV( * )
137 REAL RWORK( * )
138 COMPLEX A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * )
139* ..
140*
141* =====================================================================
142*
143* .. Parameters ..
144 REAL ZERO, ONE
145 parameter( zero = 0.0e+0, one = 1.0e+0 )
146 COMPLEX CZERO, CONE
147 parameter( czero = ( 0.0e+0, 0.0e+0 ),
148 $ cone = ( 1.0e+0, 0.0e+0 ) )
149* ..
150* .. Local Scalars ..
151 INTEGER I, INFO, J
152 REAL ANORM, EPS
153* ..
154* .. External Functions ..
155 LOGICAL LSAME
156 REAL CLANHE, SLAMCH
157 EXTERNAL lsame, clanhe, slamch
158* ..
159* .. External Subroutines ..
160 EXTERNAL claset, clavhe_rook
161* ..
162* .. Intrinsic Functions ..
163 INTRINSIC aimag, real
164* ..
165* .. Executable Statements ..
166*
167* Quick exit if N = 0.
168*
169 IF( n.LE.0 ) THEN
170 resid = zero
171 RETURN
172 END IF
173*
174* Determine EPS and the norm of A.
175*
176 eps = slamch( 'Epsilon' )
177 anorm = clanhe( '1', uplo, n, a, lda, rwork )
178*
179* Check the imaginary parts of the diagonal elements and return with
180* an error code if any are nonzero.
181*
182 DO 10 j = 1, n
183 IF( aimag( afac( j, j ) ).NE.zero ) THEN
184 resid = one / eps
185 RETURN
186 END IF
187 10 CONTINUE
188*
189* Initialize C to the identity matrix.
190*
191 CALL claset( 'Full', n, n, czero, cone, c, ldc )
192*
193* Call CLAVHE_ROOK to form the product D * U' (or D * L' ).
194*
195 CALL clavhe_rook( uplo, 'Conjugate', 'Non-unit', n, n, afac,
196 $ ldafac, ipiv, c, ldc, info )
197*
198* Call CLAVHE_ROOK again to multiply by U (or L ).
199*
200 CALL clavhe_rook( uplo, 'No transpose', 'Unit', n, n, afac,
201 $ ldafac, ipiv, c, ldc, info )
202*
203* Compute the difference C - A .
204*
205 IF( lsame( uplo, 'U' ) ) THEN
206 DO 30 j = 1, n
207 DO 20 i = 1, j - 1
208 c( i, j ) = c( i, j ) - a( i, j )
209 20 CONTINUE
210 c( j, j ) = c( j, j ) - real( a( j, j ) )
211 30 CONTINUE
212 ELSE
213 DO 50 j = 1, n
214 c( j, j ) = c( j, j ) - real( a( j, j ) )
215 DO 40 i = j + 1, n
216 c( i, j ) = c( i, j ) - a( i, j )
217 40 CONTINUE
218 50 CONTINUE
219 END IF
220*
221* Compute norm( C - A ) / ( N * norm(A) * EPS )
222*
223 resid = clanhe( '1', uplo, n, c, ldc, rwork )
224*
225 IF( anorm.LE.zero ) THEN
226 IF( resid.NE.zero )
227 $ resid = one / eps
228 ELSE
229 resid = ( ( resid/real( n ) )/anorm ) / eps
230 END IF
231*
232 RETURN
233*
234* End of CHET01_ROOK
235*
236 END
subroutine chet01_rook(uplo, n, a, lda, afac, ldafac, ipiv, c, ldc, rwork, resid)
CHET01_ROOK
subroutine clavhe_rook(uplo, trans, diag, n, nrhs, a, lda, ipiv, b, ldb, info)
CLAVHE_ROOK
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