OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
cla_hercond_c.f
Go to the documentation of this file.
1*> \brief \b CLA_HERCOND_C computes the infinity norm condition number of op(A)*inv(diag(c)) for Hermitian 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_HERCOND_C + dependencies
10*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cla_hercond_c.f">
11*> [TGZ]</a>
12*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cla_hercond_c.f">
13*> [ZIP]</a>
14*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cla_hercond_c.f">
15*> [TXT]</a>
16*> \endhtmlonly
17*
18* Definition:
19* ===========
20*
21* REAL FUNCTION CLA_HERCOND_C( UPLO, N, A, LDA, AF, LDAF, IPIV, C,
22* CAPPLY, INFO, WORK, RWORK )
23*
24* .. Scalar Arguments ..
25* CHARACTER UPLO
26* LOGICAL CAPPLY
27* INTEGER N, LDA, LDAF, INFO
28* ..
29* .. Array Arguments ..
30* INTEGER IPIV( * )
31* COMPLEX A( LDA, * ), AF( LDAF, * ), WORK( * )
32* REAL C ( * ), RWORK( * )
33* ..
34*
35*
36*> \par Purpose:
37* =============
38*>
39*> \verbatim
40*>
41*> CLA_HERCOND_C computes the infinity norm condition number of
42*> op(A) * inv(diag(C)) where C is a REAL vector.
43*> \endverbatim
44*
45* Arguments:
46* ==========
47*
48*> \param[in] UPLO
49*> \verbatim
50*> UPLO is CHARACTER*1
51*> = 'U': Upper triangle of A is stored;
52*> = 'L': Lower triangle of A is stored.
53*> \endverbatim
54*>
55*> \param[in] N
56*> \verbatim
57*> N is INTEGER
58*> The number of linear equations, i.e., the order of the
59*> matrix A. N >= 0.
60*> \endverbatim
61*>
62*> \param[in] A
63*> \verbatim
64*> A is COMPLEX array, dimension (LDA,N)
65*> On entry, the N-by-N matrix A
66*> \endverbatim
67*>
68*> \param[in] LDA
69*> \verbatim
70*> LDA is INTEGER
71*> The leading dimension of the array A. LDA >= max(1,N).
72*> \endverbatim
73*>
74*> \param[in] AF
75*> \verbatim
76*> AF is COMPLEX array, dimension (LDAF,N)
77*> The block diagonal matrix D and the multipliers used to
78*> obtain the factor U or L as computed by CHETRF.
79*> \endverbatim
80*>
81*> \param[in] LDAF
82*> \verbatim
83*> LDAF is INTEGER
84*> The leading dimension of the array AF. LDAF >= max(1,N).
85*> \endverbatim
86*>
87*> \param[in] IPIV
88*> \verbatim
89*> IPIV is INTEGER array, dimension (N)
90*> Details of the interchanges and the block structure of D
91*> as determined by CHETRF.
92*> \endverbatim
93*>
94*> \param[in] C
95*> \verbatim
96*> C is REAL array, dimension (N)
97*> The vector C in the formula op(A) * inv(diag(C)).
98*> \endverbatim
99*>
100*> \param[in] CAPPLY
101*> \verbatim
102*> CAPPLY is LOGICAL
103*> If .TRUE. then access the vector C in the formula above.
104*> \endverbatim
105*>
106*> \param[out] INFO
107*> \verbatim
108*> INFO is INTEGER
109*> = 0: Successful exit.
110*> i > 0: The ith argument is invalid.
111*> \endverbatim
112*>
113*> \param[out] WORK
114*> \verbatim
115*> WORK is COMPLEX array, dimension (2*N).
116*> Workspace.
117*> \endverbatim
118*>
119*> \param[out] RWORK
120*> \verbatim
121*> RWORK is REAL array, dimension (N).
122*> Workspace.
123*> \endverbatim
124*
125* Authors:
126* ========
127*
128*> \author Univ. of Tennessee
129*> \author Univ. of California Berkeley
130*> \author Univ. of Colorado Denver
131*> \author NAG Ltd.
132*
133*> \ingroup complexHEcomputational
134*
135* =====================================================================
136 REAL function cla_hercond_c( uplo, n, a, lda, af, ldaf, ipiv, c,
137 $ capply, 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 a( lda, * ), af( ldaf, * ), work( * )
151 REAL c ( * ), rwork( * )
152* ..
153*
154* =====================================================================
155*
156* .. Local Scalars ..
157 INTEGER kase, i, j
158 REAL ainvnm, anorm, tmp
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, chetrs, 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_hercond_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_hercond_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.EQ. IF( N0 ) THEN
253 CLA_HERCOND_C = 1.0E+0
254 RETURN
255.EQ. ELSE IF( ANORM 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.NE. IF( KASE0 ) THEN
267.EQ. IF( KASE2 ) 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 CHETRS( 'u', N, 1, AF, LDAF, IPIV,
277 $ WORK, N, INFO )
278 ELSE
279 CALL CHETRS( '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**H).
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 CHETRS( 'u', N, 1, AF, LDAF, IPIV,
302 $ WORK, N, INFO )
303 ELSE
304 CALL CHETRS( '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.NE. IF( AINVNM 0.0E+0 )
320 $ CLA_HERCOND_C = 1.0E+0 / AINVNM
321*
322 RETURN
323*
324* End of CLA_HERCOND_C
325*
326 END
subroutine xerbla(srname, info)
XERBLA
Definition xerbla.f:60
logical function lsame(ca, cb)
LSAME
Definition lsame.f:53
subroutine chetrs(uplo, n, nrhs, a, lda, ipiv, b, ldb, info)
CHETRS
Definition chetrs.f:120
real function cla_hercond_c(uplo, n, a, lda, af, ldaf, ipiv, c, capply, info, work, rwork)
CLA_HERCOND_C computes the infinity norm condition number of op(A)*inv(diag(c)) for Hermitian 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:133
#define max(a, b)
Definition macros.h:21