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