LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zla_hercond_c.f
Go to the documentation of this file.
1*> \brief \b ZLA_HERCOND_C computes the infinity norm condition number of op(A)*inv(diag(c)) for Hermitian indefinite matrices.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZLA_HERCOND_C + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zla_hercond_c.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zla_hercond_c.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zla_hercond_c.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* DOUBLE PRECISION FUNCTION ZLA_HERCOND_C( UPLO, N, A, LDA, AF,
20* LDAF, IPIV, C, CAPPLY,
21* INFO, WORK, RWORK )
22*
23* .. Scalar Arguments ..
24* CHARACTER UPLO
25* LOGICAL CAPPLY
26* INTEGER N, LDA, LDAF, INFO
27* ..
28* .. Array Arguments ..
29* INTEGER IPIV( * )
30* COMPLEX*16 A( LDA, * ), AF( LDAF, * ), WORK( * )
31* DOUBLE PRECISION C ( * ), RWORK( * )
32* ..
33*
34*
35*> \par Purpose:
36* =============
37*>
38*> \verbatim
39*>
40*> ZLA_HERCOND_C computes the infinity norm condition number of
41*> op(A) * inv(diag(C)) where C is a DOUBLE PRECISION vector.
42*> \endverbatim
43*
44* Arguments:
45* ==========
46*
47*> \param[in] UPLO
48*> \verbatim
49*> UPLO is CHARACTER*1
50*> = 'U': Upper triangle of A is stored;
51*> = 'L': Lower triangle of A is stored.
52*> \endverbatim
53*>
54*> \param[in] N
55*> \verbatim
56*> N is INTEGER
57*> The number of linear equations, i.e., the order of the
58*> matrix A. N >= 0.
59*> \endverbatim
60*>
61*> \param[in] A
62*> \verbatim
63*> A is COMPLEX*16 array, dimension (LDA,N)
64*> On entry, the N-by-N matrix A
65*> \endverbatim
66*>
67*> \param[in] LDA
68*> \verbatim
69*> LDA is INTEGER
70*> The leading dimension of the array A. LDA >= max(1,N).
71*> \endverbatim
72*>
73*> \param[in] AF
74*> \verbatim
75*> AF is COMPLEX*16 array, dimension (LDAF,N)
76*> The block diagonal matrix D and the multipliers used to
77*> obtain the factor U or L as computed by ZHETRF.
78*> \endverbatim
79*>
80*> \param[in] LDAF
81*> \verbatim
82*> LDAF is INTEGER
83*> The leading dimension of the array AF. LDAF >= max(1,N).
84*> \endverbatim
85*>
86*> \param[in] IPIV
87*> \verbatim
88*> IPIV is INTEGER array, dimension (N)
89*> Details of the interchanges and the block structure of D
90*> as determined by CHETRF.
91*> \endverbatim
92*>
93*> \param[in] C
94*> \verbatim
95*> C is DOUBLE PRECISION array, dimension (N)
96*> The vector C in the formula op(A) * inv(diag(C)).
97*> \endverbatim
98*>
99*> \param[in] CAPPLY
100*> \verbatim
101*> CAPPLY is LOGICAL
102*> If .TRUE. then access the vector C in the formula above.
103*> \endverbatim
104*>
105*> \param[out] INFO
106*> \verbatim
107*> INFO is INTEGER
108*> = 0: Successful exit.
109*> i > 0: The ith argument is invalid.
110*> \endverbatim
111*>
112*> \param[out] WORK
113*> \verbatim
114*> WORK is COMPLEX*16 array, dimension (2*N).
115*> Workspace.
116*> \endverbatim
117*>
118*> \param[out] RWORK
119*> \verbatim
120*> RWORK is DOUBLE PRECISION array, dimension (N).
121*> Workspace.
122*> \endverbatim
123*
124* Authors:
125* ========
126*
127*> \author Univ. of Tennessee
128*> \author Univ. of California Berkeley
129*> \author Univ. of Colorado Denver
130*> \author NAG Ltd.
131*
132*> \ingroup la_hercond
133*
134* =====================================================================
135 DOUBLE PRECISION FUNCTION zla_hercond_c( UPLO, N, A, LDA, AF,
136 $ LDAF, IPIV, C, CAPPLY,
137 $ INFO, WORK, RWORK )
138*
139* -- LAPACK computational routine --
140* -- LAPACK is a software package provided by Univ. of Tennessee, --
141* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
142*
143* .. Scalar Arguments ..
144 CHARACTER uplo
145 LOGICAL capply
146 INTEGER n, lda, ldaf, info
147* ..
148* .. Array Arguments ..
149 INTEGER ipiv( * )
150 COMPLEX*16 a( lda, * ), af( ldaf, * ), work( * )
151 DOUBLE PRECISION c ( * ), rwork( * )
152* ..
153*
154* =====================================================================
155*
156* .. Local Scalars ..
157 INTEGER kase, i, j
158 DOUBLE PRECISION ainvnm, anorm, tmp
159 LOGICAL up, upper
160 COMPLEX*16 zdum
161* ..
162* .. Local Arrays ..
163 INTEGER isave( 3 )
164* ..
165* .. External Functions ..
166 LOGICAL lsame
167 EXTERNAL lsame
168* ..
169* .. External Subroutines ..
170 EXTERNAL zlacn2, zhetrs, xerbla
171* ..
172* .. Intrinsic Functions ..
173 INTRINSIC abs, max
174* ..
175* .. Statement Functions ..
176 DOUBLE PRECISION cabs1
177* ..
178* .. Statement Function Definitions ..
179 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
180* ..
181* .. Executable Statements ..
182*
183 zla_hercond_c = 0.0d+0
184*
185 info = 0
186 upper = lsame( uplo, 'U' )
187 IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
188 info = -1
189 ELSE IF( n.LT.0 ) THEN
190 info = -2
191 ELSE IF( lda.LT.max( 1, n ) ) THEN
192 info = -4
193 ELSE IF( ldaf.LT.max( 1, n ) ) THEN
194 info = -6
195 END IF
196 IF( info.NE.0 ) THEN
197 CALL xerbla( 'ZLA_HERCOND_C', -info )
198 RETURN
199 END IF
200 up = .false.
201 IF ( lsame( uplo, 'U' ) ) up = .true.
202*
203* Compute norm of op(A)*op2(C).
204*
205 anorm = 0.0d+0
206 IF ( up ) THEN
207 DO i = 1, n
208 tmp = 0.0d+0
209 IF ( capply ) THEN
210 DO j = 1, i
211 tmp = tmp + cabs1( a( j, i ) ) / c( j )
212 END DO
213 DO j = i+1, n
214 tmp = tmp + cabs1( a( i, j ) ) / c( j )
215 END DO
216 ELSE
217 DO j = 1, i
218 tmp = tmp + cabs1( a( j, i ) )
219 END DO
220 DO j = i+1, n
221 tmp = tmp + cabs1( a( i, j ) )
222 END DO
223 END IF
224 rwork( i ) = tmp
225 anorm = max( anorm, tmp )
226 END DO
227 ELSE
228 DO i = 1, n
229 tmp = 0.0d+0
230 IF ( capply ) THEN
231 DO j = 1, i
232 tmp = tmp + cabs1( a( i, j ) ) / c( j )
233 END DO
234 DO j = i+1, n
235 tmp = tmp + cabs1( a( j, i ) ) / c( j )
236 END DO
237 ELSE
238 DO j = 1, i
239 tmp = tmp + cabs1( a( i, j ) )
240 END DO
241 DO j = i+1, n
242 tmp = tmp + cabs1( a( j, i ) )
243 END DO
244 END IF
245 rwork( i ) = tmp
246 anorm = max( anorm, tmp )
247 END DO
248 END IF
249*
250* Quick return if possible.
251*
252 IF( n.EQ.0 ) THEN
253 zla_hercond_c = 1.0d+0
254 RETURN
255 ELSE IF( anorm .EQ. 0.0d+0 ) THEN
256 RETURN
257 END IF
258*
259* Estimate the norm of inv(op(A)).
260*
261 ainvnm = 0.0d+0
262*
263 kase = 0
264 10 CONTINUE
265 CALL zlacn2( n, work( n+1 ), work, ainvnm, kase, isave )
266 IF( kase.NE.0 ) THEN
267 IF( kase.EQ.2 ) THEN
268*
269* Multiply by R.
270*
271 DO i = 1, n
272 work( i ) = work( i ) * rwork( i )
273 END DO
274*
275 IF ( up ) THEN
276 CALL zhetrs( 'U', n, 1, af, ldaf, ipiv,
277 $ work, n, info )
278 ELSE
279 CALL zhetrs( 'L', n, 1, af, ldaf, ipiv,
280 $ work, n, info )
281 ENDIF
282*
283* Multiply by inv(C).
284*
285 IF ( capply ) THEN
286 DO i = 1, n
287 work( i ) = work( i ) * c( i )
288 END DO
289 END IF
290 ELSE
291*
292* Multiply by inv(C**H).
293*
294 IF ( capply ) THEN
295 DO i = 1, n
296 work( i ) = work( i ) * c( i )
297 END DO
298 END IF
299*
300 IF ( up ) THEN
301 CALL zhetrs( 'U', n, 1, af, ldaf, ipiv,
302 $ work, n, info )
303 ELSE
304 CALL zhetrs( 'L', n, 1, af, ldaf, ipiv,
305 $ work, n, info )
306 END IF
307*
308* Multiply by R.
309*
310 DO i = 1, n
311 work( i ) = work( i ) * rwork( i )
312 END DO
313 END IF
314 GO TO 10
315 END IF
316*
317* Compute the estimate of the reciprocal condition number.
318*
319 IF( ainvnm .NE. 0.0d+0 )
320 $ zla_hercond_c = 1.0d+0 / ainvnm
321*
322 RETURN
323*
324* End of ZLA_HERCOND_C
325*
326 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zhetrs(uplo, n, nrhs, a, lda, ipiv, b, ldb, info)
ZHETRS
Definition zhetrs.f:118
double precision function zla_hercond_c(uplo, n, a, lda, af, ldaf, ipiv, c, capply, info, work, rwork)
ZLA_HERCOND_C computes the infinity norm condition number of op(A)*inv(diag(c)) for Hermitian indefin...
subroutine zlacn2(n, v, x, est, kase, isave)
ZLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition zlacn2.f:131
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48