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