3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DPPEQU + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dppequ.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dppequ.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dppequ.f">
21 * SUBROUTINE DPPEQU( UPLO, N, AP, S, SCOND, AMAX, INFO )
23 * .. Scalar Arguments ..
26 * DOUBLE PRECISION AMAX, SCOND
28 * .. Array Arguments ..
29 * DOUBLE PRECISION AP( * ), S( * )
38 *> DPPEQU computes row and column scalings intended to equilibrate a
39 *> symmetric positive definite matrix A in packed storage and reduce
40 *> its condition number (with respect to the two-norm). S contains the
41 *> scale factors, S(i)=1/sqrt(A(i,i)), chosen so that the scaled matrix
42 *> B with elements B(i,j)=S(i)*A(i,j)*S(j) has ones on the diagonal.
43 *> This choice of S puts the condition number of B within a factor N of
44 *> the smallest possible condition number over all possible diagonal
53 *> UPLO is CHARACTER*1
54 *> = 'U': Upper triangle of A is stored;
55 *> = 'L': Lower triangle of A is stored.
61 *> The order of the matrix A. N >= 0.
66 *> AP is DOUBLE PRECISION array, dimension (N*(N+1)/2)
67 *> The upper or lower triangle of the symmetric matrix A, packed
68 *> columnwise in a linear array. The j-th column of A is stored
69 *> in the array AP as follows:
70 *> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
71 *> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
76 *> S is DOUBLE PRECISION array, dimension (N)
77 *> If INFO = 0, S contains the scale factors for A.
82 *> SCOND is DOUBLE PRECISION
83 *> If INFO = 0, S contains the ratio of the smallest S(i) to
84 *> the largest S(i). If SCOND >= 0.1 and AMAX is neither too
85 *> large nor too small, it is not worth scaling by S.
90 *> AMAX is DOUBLE PRECISION
91 *> Absolute value of largest matrix element. If AMAX is very
92 *> close to overflow or very close to underflow, the matrix
99 *> = 0: successful exit
100 *> < 0: if INFO = -i, the i-th argument had an illegal value
101 *> > 0: if INFO = i, the i-th diagonal element is nonpositive.
107 *> \author Univ. of Tennessee
108 *> \author Univ. of California Berkeley
109 *> \author Univ. of Colorado Denver
112 *> \date November 2011
114 *> \ingroup doubleOTHERcomputational
116 * =====================================================================
117 SUBROUTINE DPPEQU( UPLO, N, AP, S, SCOND, AMAX, INFO )
119 * -- LAPACK computational routine (version 3.4.0) --
120 * -- LAPACK is a software package provided by Univ. of Tennessee, --
121 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
124 * .. Scalar Arguments ..
127 DOUBLE PRECISION AMAX, SCOND
129 * .. Array Arguments ..
130 DOUBLE PRECISION AP( * ), S( * )
133 * =====================================================================
136 DOUBLE PRECISION ONE, ZERO
137 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
139 * .. Local Scalars ..
142 DOUBLE PRECISION SMIN
144 * .. External Functions ..
148 * .. External Subroutines ..
151 * .. Intrinsic Functions ..
152 INTRINSIC MAX, MIN, SQRT
154 * .. Executable Statements ..
156 * Test the input parameters.
159 UPPER = LSAME( UPLO, 'U' )
160 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
162 ELSE IF( N.LT.0 ) THEN
166 CALL XERBLA( 'DPPEQU', -INFO )
170 * Quick return if possible
178 * Initialize SMIN and AMAX.
186 * UPLO = 'U': Upper triangle of A is stored.
187 * Find the minimum and maximum diagonal elements.
193 SMIN = MIN( SMIN, S( I ) )
194 AMAX = MAX( AMAX, S( I ) )
199 * UPLO = 'L': Lower triangle of A is stored.
200 * Find the minimum and maximum diagonal elements.
206 SMIN = MIN( SMIN, S( I ) )
207 AMAX = MAX( AMAX, S( I ) )
211 IF( SMIN.LE.ZERO ) THEN
213 * Find the first non-positive diagonal element and return.
216 IF( S( I ).LE.ZERO ) THEN
223 * Set the scale factors to the reciprocals
224 * of the diagonal elements.
227 S( I ) = ONE / SQRT( S( I ) )
230 * Compute SCOND = min(S(I)) / max(S(I))
232 SCOND = SQRT( SMIN ) / SQRT( AMAX )