1 *> \brief \b DLA_PORCOND estimates the Skeel condition number for a symmetric positive-definite matrix.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DLA_PORCOND + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dla_porcond.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dla_porcond.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dla_porcond.f">
21 * DOUBLE PRECISION FUNCTION DLA_PORCOND( UPLO, N, A, LDA, AF, LDAF,
22 * CMODE, C, INFO, WORK,
25 * .. Scalar Arguments ..
27 * INTEGER N, LDA, LDAF, INFO, CMODE
28 * DOUBLE PRECISION A( LDA, * ), AF( LDAF, * ), WORK( * ),
31 * .. Array Arguments ..
41 *> DLA_PORCOND Estimates the Skeel condition number of op(A) * op2(C)
42 *> where op2 is determined by CMODE as follows
43 *> CMODE = 1 op2(C) = C
44 *> CMODE = 0 op2(C) = I
45 *> CMODE = -1 op2(C) = inv(C)
46 *> The Skeel condition number cond(A) = norminf( |inv(A)||A| )
47 *> is computed by computing scaling factors R such that
48 *> diag(R)*A*op2(C) is row equilibrated and computing the standard
49 *> infinity-norm condition number.
57 *> UPLO is CHARACTER*1
58 *> = 'U': Upper triangle of A is stored;
59 *> = 'L': Lower triangle of A is stored.
65 *> The number of linear equations, i.e., the order of the
71 *> A is DOUBLE PRECISION array, dimension (LDA,N)
72 *> On entry, the N-by-N matrix A.
78 *> The leading dimension of the array A. LDA >= max(1,N).
83 *> AF is DOUBLE PRECISION array, dimension (LDAF,N)
84 *> The triangular factor U or L from the Cholesky factorization
85 *> A = U**T*U or A = L*L**T, as computed by DPOTRF.
91 *> The leading dimension of the array AF. LDAF >= max(1,N).
97 *> Determines op2(C) in the formula op(A) * op2(C) as follows:
98 *> CMODE = 1 op2(C) = C
99 *> CMODE = 0 op2(C) = I
100 *> CMODE = -1 op2(C) = inv(C)
105 *> C is DOUBLE PRECISION array, dimension (N)
106 *> The vector C in the formula op(A) * op2(C).
112 *> = 0: Successful exit.
113 *> i > 0: The ith argument is invalid.
118 *> WORK is DOUBLE PRECISION array, dimension (3*N).
124 *> IWORK is INTEGER array, dimension (N).
131 *> \author Univ. of Tennessee
132 *> \author Univ. of California Berkeley
133 *> \author Univ. of Colorado Denver
136 *> \date September 2012
138 *> \ingroup doublePOcomputational
140 * =====================================================================
141 DOUBLE PRECISION FUNCTION DLA_PORCOND( UPLO, N, A, LDA, AF, LDAF,
142 $ CMODE, C, INFO, WORK,
145 * -- LAPACK computational routine (version 3.4.2) --
146 * -- LAPACK is a software package provided by Univ. of Tennessee, --
147 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
150 * .. Scalar Arguments ..
152 INTEGER N, LDA, LDAF, INFO, CMODE
153 DOUBLE PRECISION A( LDA, * ), AF( LDAF, * ), WORK( * ),
156 * .. Array Arguments ..
160 * =====================================================================
162 * .. Local Scalars ..
164 DOUBLE PRECISION AINVNM, TMP
167 * .. Array Arguments ..
170 * .. External Functions ..
174 * .. External Subroutines ..
175 EXTERNAL DLACN2, DPOTRS, XERBLA
177 * .. Intrinsic Functions ..
180 * .. Executable Statements ..
189 CALL XERBLA( 'DLA_PORCOND', -INFO )
198 IF ( LSAME( UPLO, 'U' ) ) UP = .TRUE.
200 * Compute the equilibration matrix R such that
201 * inv(R)*A*C has unit 1-norm.
206 IF ( CMODE .EQ. 1 ) THEN
208 TMP = TMP + ABS( A( J, I ) * C( J ) )
211 TMP = TMP + ABS( A( I, J ) * C( J ) )
213 ELSE IF ( CMODE .EQ. 0 ) THEN
215 TMP = TMP + ABS( A( J, I ) )
218 TMP = TMP + ABS( A( I, J ) )
222 TMP = TMP + ABS( A( J ,I ) / C( J ) )
225 TMP = TMP + ABS( A( I, J ) / C( J ) )
233 IF ( CMODE .EQ. 1 ) THEN
235 TMP = TMP + ABS( A( I, J ) * C( J ) )
238 TMP = TMP + ABS( A( J, I ) * C( J ) )
240 ELSE IF ( CMODE .EQ. 0 ) THEN
242 TMP = TMP + ABS( A( I, J ) )
245 TMP = TMP + ABS( A( J, I ) )
249 TMP = TMP + ABS( A( I, J ) / C( J ) )
252 TMP = TMP + ABS( A( J, I ) / C( J ) )
259 * Estimate the norm of inv(op(A)).
265 CALL DLACN2( N, WORK( N+1 ), WORK, IWORK, AINVNM, KASE, ISAVE )
272 WORK( I ) = WORK( I ) * WORK( 2*N+I )
276 CALL DPOTRS( 'Upper', N, 1, AF, LDAF, WORK, N, INFO )
278 CALL DPOTRS( 'Lower', N, 1, AF, LDAF, WORK, N, INFO )
281 * Multiply by inv(C).
283 IF ( CMODE .EQ. 1 ) THEN
285 WORK( I ) = WORK( I ) / C( I )
287 ELSE IF ( CMODE .EQ. -1 ) THEN
289 WORK( I ) = WORK( I ) * C( I )
294 * Multiply by inv(C**T).
296 IF ( CMODE .EQ. 1 ) THEN
298 WORK( I ) = WORK( I ) / C( I )
300 ELSE IF ( CMODE .EQ. -1 ) THEN
302 WORK( I ) = WORK( I ) * C( I )
307 CALL DPOTRS( 'Upper', N, 1, AF, LDAF, WORK, N, INFO )
309 CALL DPOTRS( 'Lower', N, 1, AF, LDAF, WORK, N, INFO )
315 WORK( I ) = WORK( I ) * WORK( 2*N+I )
321 * Compute the estimate of the reciprocal condition number.
323 IF( AINVNM .NE. 0.0D+0 )
324 $ DLA_PORCOND = ( 1.0D+0 / AINVNM )