3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SPOEQUB + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/spoequb.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/spoequb.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/spoequb.f">
21 * SUBROUTINE SPOEQUB( N, A, LDA, S, SCOND, AMAX, INFO )
23 * .. Scalar Arguments ..
24 * INTEGER INFO, LDA, N
27 * .. Array Arguments ..
28 * REAL A( LDA, * ), S( * )
37 *> SPOEQU computes row and column scalings intended to equilibrate a
38 *> symmetric positive definite matrix A and reduce its condition number
39 *> (with respect to the two-norm). S contains the scale factors,
40 *> S(i) = 1/sqrt(A(i,i)), chosen so that the scaled matrix B with
41 *> elements B(i,j) = S(i)*A(i,j)*S(j) has ones on the diagonal. This
42 *> choice of S puts the condition number of B within a factor N of the
43 *> smallest possible condition number over all possible diagonal
53 *> The order of the matrix A. N >= 0.
58 *> A is REAL array, dimension (LDA,N)
59 *> The N-by-N symmetric positive definite matrix whose scaling
60 *> factors are to be computed. Only the diagonal elements of A
67 *> The leading dimension of the array A. LDA >= max(1,N).
72 *> S is REAL array, dimension (N)
73 *> If INFO = 0, S contains the scale factors for A.
79 *> If INFO = 0, S contains the ratio of the smallest S(i) to
80 *> the largest S(i). If SCOND >= 0.1 and AMAX is neither too
81 *> large nor too small, it is not worth scaling by S.
87 *> Absolute value of largest matrix element. If AMAX is very
88 *> close to overflow or very close to underflow, the matrix
95 *> = 0: successful exit
96 *> < 0: if INFO = -i, the i-th argument had an illegal value
97 *> > 0: if INFO = i, the i-th diagonal element is nonpositive.
103 *> \author Univ. of Tennessee
104 *> \author Univ. of California Berkeley
105 *> \author Univ. of Colorado Denver
108 *> \date November 2011
110 *> \ingroup realPOcomputational
112 * =====================================================================
113 SUBROUTINE SPOEQUB( N, A, LDA, S, SCOND, AMAX, INFO )
115 * -- LAPACK computational routine (version 3.4.0) --
116 * -- LAPACK is a software package provided by Univ. of Tennessee, --
117 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
120 * .. Scalar Arguments ..
124 * .. Array Arguments ..
125 REAL A( LDA, * ), S( * )
128 * =====================================================================
132 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
134 * .. Local Scalars ..
138 * .. External Functions ..
142 * .. External Subroutines ..
145 * .. Intrinsic Functions ..
146 INTRINSIC MAX, MIN, SQRT, LOG, INT
148 * .. Executable Statements ..
150 * Test the input parameters.
152 * Positive definite only performs 1 pass of equilibration.
157 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
161 CALL XERBLA( 'SPOEQUB', -INFO )
165 * Quick return if possible.
174 TMP = -0.5 / LOG ( BASE )
176 * Find the minimum and maximum diagonal elements.
183 SMIN = MIN( SMIN, S( I ) )
184 AMAX = MAX( AMAX, S( I ) )
187 IF( SMIN.LE.ZERO ) THEN
189 * Find the first non-positive diagonal element and return.
192 IF( S( I ).LE.ZERO ) THEN
199 * Set the scale factors to the reciprocals
200 * of the diagonal elements.
203 S( I ) = BASE ** INT( TMP * LOG( S( I ) ) )
206 * Compute SCOND = min(S(I)) / max(S(I)).
208 SCOND = SQRT( SMIN ) / SQRT( AMAX )