LAPACK  3.10.1
LAPACK: Linear Algebra PACKage
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 *> \htmlonly
9 *> Download CLA_SYRCOND_C + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cla_syrcond_c.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cla_syrcond_c.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cla_syrcond_c.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * REAL FUNCTION CLA_SYRCOND_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_SYRCOND_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 CSYTRF.
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 CSYTRF.
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 complexSYcomputational
134 *
135 * =====================================================================
136  REAL function cla_syrcond_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
158  REAL ainvnm, anorm, tmp
159  INTEGER i, j
160  LOGICAL up, upper
161  COMPLEX 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 clacn2, csytrs, xerbla
172 * ..
173 * .. Intrinsic Functions ..
174  INTRINSIC abs, max
175 * ..
176 * .. Statement Functions ..
177  REAL cabs1
178 * ..
179 * .. Statement Function Definitions ..
180  cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
181 * ..
182 * .. Executable Statements ..
183 *
184  cla_syrcond_c = 0.0e+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( 'CLA_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.0e+0
207  IF ( up ) THEN
208  DO i = 1, n
209  tmp = 0.0e+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.0e+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  cla_syrcond_c = 1.0e+0
255  RETURN
256  ELSE IF( anorm .EQ. 0.0e+0 ) THEN
257  RETURN
258  END IF
259 *
260 * Estimate the norm of inv(op(A)).
261 *
262  ainvnm = 0.0e+0
263 *
264  kase = 0
265  10 CONTINUE
266  CALL clacn2( 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 csytrs( 'U', n, 1, af, ldaf, ipiv,
278  $ work, n, info )
279  ELSE
280  CALL csytrs( '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 csytrs( 'U', n, 1, af, ldaf, ipiv,
303  $ work, n, info )
304  ELSE
305  CALL csytrs( '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.0e+0 )
321  $ cla_syrcond_c = 1.0e+0 / ainvnm
322 *
323  RETURN
324 *
325 * End of CLA_SYRCOND_C
326 *
327  END
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
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
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 csytrs(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
CSYTRS
Definition: csytrs.f:120