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