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