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