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