3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CPOEQU + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cpoequ.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cpoequ.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cpoequ.f">
21 * SUBROUTINE CPOEQU( N, A, LDA, S, SCOND, AMAX, INFO )
23 * .. Scalar Arguments ..
24 * INTEGER INFO, LDA, N
27 * .. Array Arguments ..
38 *> CPOEQU computes row and column scalings intended to equilibrate a
39 *> Hermitian positive definite matrix A and reduce its condition number
40 *> (with respect to the two-norm). S contains the scale factors,
41 *> S(i) = 1/sqrt(A(i,i)), chosen so that the scaled matrix B with
42 *> elements B(i,j) = S(i)*A(i,j)*S(j) has ones on the diagonal. This
43 *> choice of S puts the condition number of B within a factor N of the
44 *> smallest possible condition number over all possible diagonal
54 *> The order of the matrix A. N >= 0.
59 *> A is COMPLEX array, dimension (LDA,N)
60 *> The N-by-N Hermitian positive definite matrix whose scaling
61 *> factors are to be computed. Only the diagonal elements of A
68 *> The leading dimension of the array A. LDA >= max(1,N).
73 *> S is REAL array, dimension (N)
74 *> If INFO = 0, S contains the scale factors for A.
80 *> If INFO = 0, S contains the ratio of the smallest S(i) to
81 *> the largest S(i). If SCOND >= 0.1 and AMAX is neither too
82 *> large nor too small, it is not worth scaling by S.
88 *> Absolute value of largest matrix element. If AMAX is very
89 *> close to overflow or very close to underflow, the matrix
96 *> = 0: successful exit
97 *> < 0: if INFO = -i, the i-th argument had an illegal value
98 *> > 0: if INFO = i, the i-th diagonal element is nonpositive.
104 *> \author Univ. of Tennessee
105 *> \author Univ. of California Berkeley
106 *> \author Univ. of Colorado Denver
109 *> \date November 2011
111 *> \ingroup complexPOcomputational
113 * =====================================================================
114 SUBROUTINE CPOEQU( N, A, LDA, S, SCOND, AMAX, INFO )
116 * -- LAPACK computational routine (version 3.4.0) --
117 * -- LAPACK is a software package provided by Univ. of Tennessee, --
118 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
121 * .. Scalar Arguments ..
125 * .. Array Arguments ..
130 * =====================================================================
134 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
136 * .. Local Scalars ..
140 * .. External Subroutines ..
143 * .. Intrinsic Functions ..
144 INTRINSIC MAX, MIN, REAL, SQRT
146 * .. Executable Statements ..
148 * Test the input parameters.
153 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
157 CALL XERBLA( 'CPOEQU', -INFO )
161 * Quick return if possible
169 * Find the minimum and maximum diagonal elements.
171 S( 1 ) = REAL( A( 1, 1 ) )
175 S( I ) = REAL( A( I, I ) )
176 SMIN = MIN( SMIN, S( I ) )
177 AMAX = MAX( AMAX, S( I ) )
180 IF( SMIN.LE.ZERO ) THEN
182 * Find the first non-positive diagonal element and return.
185 IF( S( I ).LE.ZERO ) THEN
192 * Set the scale factors to the reciprocals
193 * of the diagonal elements.
196 S( I ) = ONE / SQRT( S( I ) )
199 * Compute SCOND = min(S(I)) / max(S(I))
201 SCOND = SQRT( SMIN ) / SQRT( AMAX )