LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
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*> \htmlonly
9*> Download CLA_PORCOND_C + dependencies
10*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cla_porcond_c.f">
11*> [TGZ]</a>
12*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cla_porcond_c.f">
13*> [ZIP]</a>
14*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cla_porcond_c.f">
15*> [TXT]</a>
16*> \endhtmlonly
17*
18* Definition:
19* ===========
20*
21* REAL FUNCTION CLA_PORCOND_C( UPLO, N, A, LDA, AF, LDAF, C, CAPPLY,
22* INFO, WORK, RWORK )
23*
24* .. Scalar Arguments ..
25* CHARACTER UPLO
26* LOGICAL CAPPLY
27* INTEGER N, LDA, LDAF, INFO
28* ..
29* .. Array Arguments ..
30* COMPLEX A( LDA, * ), AF( LDAF, * ), WORK( * )
31* REAL C( * ), RWORK( * )
32* ..
33*
34*
35*> \par Purpose:
36* =============
37*>
38*> \verbatim
39*>
40*> CLA_PORCOND_C Computes the infinity norm condition number of
41*> op(A) * inv(diag(C)) where C is a REAL 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 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 array, dimension (LDAF,N)
76*> The triangular factor U or L from the Cholesky factorization
77*> A = U**H*U or A = L*L**H, as computed by CPOTRF.
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] C
87*> \verbatim
88*> C is REAL array, dimension (N)
89*> The vector C in the formula op(A) * inv(diag(C)).
90*> \endverbatim
91*>
92*> \param[in] CAPPLY
93*> \verbatim
94*> CAPPLY is LOGICAL
95*> If .TRUE. then access the vector C in the formula above.
96*> \endverbatim
97*>
98*> \param[out] INFO
99*> \verbatim
100*> INFO is INTEGER
101*> = 0: Successful exit.
102*> i > 0: The ith argument is invalid.
103*> \endverbatim
104*>
105*> \param[out] WORK
106*> \verbatim
107*> WORK is COMPLEX array, dimension (2*N).
108*> Workspace.
109*> \endverbatim
110*>
111*> \param[out] RWORK
112*> \verbatim
113*> RWORK is REAL array, dimension (N).
114*> Workspace.
115*> \endverbatim
116*
117* Authors:
118* ========
119*
120*> \author Univ. of Tennessee
121*> \author Univ. of California Berkeley
122*> \author Univ. of Colorado Denver
123*> \author NAG Ltd.
124*
125*> \ingroup la_porcond
126*
127* =====================================================================
128 REAL function cla_porcond_c( uplo, n, a, lda, af, ldaf, c, capply,
129 $ info, 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 a( lda, * ), af( ldaf, * ), work( * )
142 REAL c( * ), rwork( * )
143* ..
144*
145* =====================================================================
146*
147* .. Local Scalars ..
148 INTEGER kase
149 REAL ainvnm, anorm, tmp
150 INTEGER i, j
151 LOGICAL up, upper
152 COMPLEX 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 clacn2, cpotrs, xerbla
163* ..
164* .. Intrinsic Functions ..
165 INTRINSIC abs, max, real, aimag
166* ..
167* .. Statement Functions ..
168 REAL cabs1
169* ..
170* .. Statement Function Definitions ..
171 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
172* ..
173* .. Executable Statements ..
174*
175 cla_porcond_c = 0.0e+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( 'CLA_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.0e+0
198 IF ( up ) THEN
199 DO i = 1, n
200 tmp = 0.0e+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.0e+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 cla_porcond_c = 1.0e+0
246 RETURN
247 ELSE IF( anorm .EQ. 0.0e+0 ) THEN
248 RETURN
249 END IF
250*
251* Estimate the norm of inv(op(A)).
252*
253 ainvnm = 0.0e+0
254*
255 kase = 0
256 10 CONTINUE
257 CALL clacn2( 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 cpotrs( 'U', n, 1, af, ldaf,
269 $ work, n, info )
270 ELSE
271 CALL cpotrs( '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 cpotrs( 'U', n, 1, af, ldaf,
294 $ work, n, info )
295 ELSE
296 CALL cpotrs( '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.0e+0 )
312 $ cla_porcond_c = 1.0e+0 / ainvnm
313*
314 RETURN
315*
316* End of CLA_PORCOND_C
317*
318 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:133
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine cpotrs(uplo, n, nrhs, a, lda, b, ldb, info)
CPOTRS
Definition cpotrs.f:110