1 *> \brief \b SLA_SYRCOND estimates the Skeel condition number for a symmetric indefinite matrix.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SLA_SYRCOND + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sla_syrcond.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sla_syrcond.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sla_syrcond.f">
21 * REAL FUNCTION SLA_SYRCOND( UPLO, N, A, LDA, AF, LDAF, IPIV, CMODE,
22 * C, INFO, WORK, IWORK )
24 * .. Scalar Arguments ..
26 * INTEGER N, LDA, LDAF, INFO, CMODE
29 * INTEGER IWORK( * ), IPIV( * )
30 * REAL A( LDA, * ), AF( LDAF, * ), WORK( * ), C( * )
39 *> SLA_SYRCOND estimates the Skeel condition number of op(A) * op2(C)
40 *> where op2 is determined by CMODE as follows
41 *> CMODE = 1 op2(C) = C
42 *> CMODE = 0 op2(C) = I
43 *> CMODE = -1 op2(C) = inv(C)
44 *> The Skeel condition number cond(A) = norminf( |inv(A)||A| )
45 *> is computed by computing scaling factors R such that
46 *> diag(R)*A*op2(C) is row equilibrated and computing the standard
47 *> infinity-norm condition number.
55 *> UPLO is CHARACTER*1
56 *> = 'U': Upper triangle of A is stored;
57 *> = 'L': Lower triangle of A is stored.
63 *> The number of linear equations, i.e., the order of the
69 *> A is REAL array, dimension (LDA,N)
70 *> On entry, the N-by-N matrix A.
76 *> The leading dimension of the array A. LDA >= max(1,N).
81 *> AF is REAL array, dimension (LDAF,N)
82 *> The block diagonal matrix D and the multipliers used to
83 *> obtain the factor U or L as computed by SSYTRF.
89 *> The leading dimension of the array AF. LDAF >= max(1,N).
94 *> IPIV is INTEGER array, dimension (N)
95 *> Details of the interchanges and the block structure of D
96 *> as determined by SSYTRF.
102 *> Determines op2(C) in the formula op(A) * op2(C) as follows:
103 *> CMODE = 1 op2(C) = C
104 *> CMODE = 0 op2(C) = I
105 *> CMODE = -1 op2(C) = inv(C)
110 *> C is REAL array, dimension (N)
111 *> The vector C in the formula op(A) * op2(C).
117 *> = 0: Successful exit.
118 *> i > 0: The ith argument is invalid.
123 *> WORK is REAL array, dimension (3*N).
129 *> IWORK is INTEGER array, dimension (N).
136 *> \author Univ. of Tennessee
137 *> \author Univ. of California Berkeley
138 *> \author Univ. of Colorado Denver
141 *> \date September 2012
143 *> \ingroup realSYcomputational
145 * =====================================================================
146 REAL FUNCTION SLA_SYRCOND( UPLO, N, A, LDA, AF, LDAF, IPIV, CMODE,
147 $ C, INFO, WORK, IWORK )
149 * -- LAPACK computational routine (version 3.4.2) --
150 * -- LAPACK is a software package provided by Univ. of Tennessee, --
151 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
154 * .. Scalar Arguments ..
156 INTEGER N, LDA, LDAF, INFO, CMODE
159 INTEGER IWORK( * ), IPIV( * )
160 REAL A( LDA, * ), AF( LDAF, * ), WORK( * ), C( * )
163 * =====================================================================
165 * .. Local Scalars ..
168 REAL AINVNM, SMLNUM, TMP
174 * .. External Functions ..
177 EXTERNAL LSAME, SLAMCH
179 * .. External Subroutines ..
180 EXTERNAL SLACN2, XERBLA, SSYTRS
182 * .. Intrinsic Functions ..
185 * .. Executable Statements ..
192 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
194 ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
198 CALL XERBLA( 'SLA_SYRCOND', -INFO )
206 IF ( LSAME( UPLO, 'U' ) ) UP = .TRUE.
208 * Compute the equilibration matrix R such that
209 * inv(R)*A*C has unit 1-norm.
214 IF ( CMODE .EQ. 1 ) THEN
216 TMP = TMP + ABS( A( J, I ) * C( J ) )
219 TMP = TMP + ABS( A( I, J ) * C( J ) )
221 ELSE IF ( CMODE .EQ. 0 ) THEN
223 TMP = TMP + ABS( A( J, I ) )
226 TMP = TMP + ABS( A( I, J ) )
230 TMP = TMP + ABS( A( J, I ) / C( J ) )
233 TMP = TMP + ABS( A( I, J ) / C( J ) )
241 IF ( CMODE .EQ. 1 ) THEN
243 TMP = TMP + ABS( A( I, J ) * C( J ) )
246 TMP = TMP + ABS( A( J, I ) * C( J ) )
248 ELSE IF ( CMODE .EQ. 0 ) THEN
250 TMP = TMP + ABS( A( I, J ) )
253 TMP = TMP + ABS( A( J, I ) )
257 TMP = TMP + ABS( A( I, J) / C( J ) )
260 TMP = TMP + ABS( A( J, I) / C( J ) )
267 * Estimate the norm of inv(op(A)).
269 SMLNUM = SLAMCH( 'Safe minimum' )
275 CALL SLACN2( N, WORK( N+1 ), WORK, IWORK, AINVNM, KASE, ISAVE )
282 WORK( I ) = WORK( I ) * WORK( 2*N+I )
286 CALL SSYTRS( 'U', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
288 CALL SSYTRS( 'L', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
291 * Multiply by inv(C).
293 IF ( CMODE .EQ. 1 ) THEN
295 WORK( I ) = WORK( I ) / C( I )
297 ELSE IF ( CMODE .EQ. -1 ) THEN
299 WORK( I ) = WORK( I ) * C( I )
304 * Multiply by inv(C**T).
306 IF ( CMODE .EQ. 1 ) THEN
308 WORK( I ) = WORK( I ) / C( I )
310 ELSE IF ( CMODE .EQ. -1 ) THEN
312 WORK( I ) = WORK( I ) * C( I )
317 CALL SSYTRS( 'U', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
319 CALL SSYTRS( 'L', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
325 WORK( I ) = WORK( I ) * WORK( 2*N+I )
332 * Compute the estimate of the reciprocal condition number.
334 IF( AINVNM .NE. 0.0 )
335 $ SLA_SYRCOND = ( 1.0 / AINVNM )