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