1: *> \brief \b DPPEQU
2: *
3: * =========== DOCUMENTATION ===========
4: *
5: * Online html documentation available at
6: * http://www.netlib.org/lapack/explore-html/
7: *
8: *> \htmlonly
9: *> Download DPPEQU + dependencies
10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dppequ.f">
11: *> [TGZ]</a>
12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dppequ.f">
13: *> [ZIP]</a>
14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dppequ.f">
15: *> [TXT]</a>
16: *> \endhtmlonly
17: *
18: * Definition:
19: * ===========
20: *
21: * SUBROUTINE DPPEQU( UPLO, N, AP, S, SCOND, AMAX, INFO )
22: *
23: * .. Scalar Arguments ..
24: * CHARACTER UPLO
25: * INTEGER INFO, N
26: * DOUBLE PRECISION AMAX, SCOND
27: * ..
28: * .. Array Arguments ..
29: * DOUBLE PRECISION AP( * ), S( * )
30: * ..
31: *
32: *
33: *> \par Purpose:
34: * =============
35: *>
36: *> \verbatim
37: *>
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
45: *> scalings.
46: *> \endverbatim
47: *
48: * Arguments:
49: * ==========
50: *
51: *> \param[in] UPLO
52: *> \verbatim
53: *> UPLO is CHARACTER*1
54: *> = 'U': Upper triangle of A is stored;
55: *> = 'L': Lower triangle of A is stored.
56: *> \endverbatim
57: *>
58: *> \param[in] N
59: *> \verbatim
60: *> N is INTEGER
61: *> The order of the matrix A. N >= 0.
62: *> \endverbatim
63: *>
64: *> \param[in] AP
65: *> \verbatim
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.
72: *> \endverbatim
73: *>
74: *> \param[out] S
75: *> \verbatim
76: *> S is DOUBLE PRECISION array, dimension (N)
77: *> If INFO = 0, S contains the scale factors for A.
78: *> \endverbatim
79: *>
80: *> \param[out] SCOND
81: *> \verbatim
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.
86: *> \endverbatim
87: *>
88: *> \param[out] AMAX
89: *> \verbatim
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
93: *> should be scaled.
94: *> \endverbatim
95: *>
96: *> \param[out] INFO
97: *> \verbatim
98: *> INFO is INTEGER
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.
102: *> \endverbatim
103: *
104: * Authors:
105: * ========
106: *
107: *> \author Univ. of Tennessee
108: *> \author Univ. of California Berkeley
109: *> \author Univ. of Colorado Denver
110: *> \author NAG Ltd.
111: *
112: *> \ingroup doubleOTHERcomputational
113: *
114: * =====================================================================
115: SUBROUTINE DPPEQU( UPLO, N, AP, S, SCOND, AMAX, INFO )
116: *
117: * -- LAPACK computational routine --
118: * -- LAPACK is a software package provided by Univ. of Tennessee, --
119: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
120: *
121: * .. Scalar Arguments ..
122: CHARACTER UPLO
123: INTEGER INFO, N
124: DOUBLE PRECISION AMAX, SCOND
125: * ..
126: * .. Array Arguments ..
127: DOUBLE PRECISION AP( * ), S( * )
128: * ..
129: *
130: * =====================================================================
131: *
132: * .. Parameters ..
133: DOUBLE PRECISION ONE, ZERO
134: PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
135: * ..
136: * .. Local Scalars ..
137: LOGICAL UPPER
138: INTEGER I, JJ
139: DOUBLE PRECISION SMIN
140: * ..
141: * .. External Functions ..
142: LOGICAL LSAME
143: EXTERNAL LSAME
144: * ..
145: * .. External Subroutines ..
146: EXTERNAL XERBLA
147: * ..
148: * .. Intrinsic Functions ..
149: INTRINSIC MAX, MIN, SQRT
150: * ..
151: * .. Executable Statements ..
152: *
153: * Test the input parameters.
154: *
155: INFO = 0
156: UPPER = LSAME( UPLO, 'U' )
157: IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
158: INFO = -1
159: ELSE IF( N.LT.0 ) THEN
160: INFO = -2
161: END IF
162: IF( INFO.NE.0 ) THEN
163: CALL XERBLA( 'DPPEQU', -INFO )
164: RETURN
165: END IF
166: *
167: * Quick return if possible
168: *
169: IF( N.EQ.0 ) THEN
170: SCOND = ONE
171: AMAX = ZERO
172: RETURN
173: END IF
174: *
175: * Initialize SMIN and AMAX.
176: *
177: S( 1 ) = AP( 1 )
178: SMIN = S( 1 )
179: AMAX = S( 1 )
180: *
181: IF( UPPER ) THEN
182: *
183: * UPLO = 'U': Upper triangle of A is stored.
184: * Find the minimum and maximum diagonal elements.
185: *
186: JJ = 1
187: DO 10 I = 2, N
188: JJ = JJ + I
189: S( I ) = AP( JJ )
190: SMIN = MIN( SMIN, S( I ) )
191: AMAX = MAX( AMAX, S( I ) )
192: 10 CONTINUE
193: *
194: ELSE
195: *
196: * UPLO = 'L': Lower triangle of A is stored.
197: * Find the minimum and maximum diagonal elements.
198: *
199: JJ = 1
200: DO 20 I = 2, N
201: JJ = JJ + N - I + 2
202: S( I ) = AP( JJ )
203: SMIN = MIN( SMIN, S( I ) )
204: AMAX = MAX( AMAX, S( I ) )
205: 20 CONTINUE
206: END IF
207: *
208: IF( SMIN.LE.ZERO ) THEN
209: *
210: * Find the first non-positive diagonal element and return.
211: *
212: DO 30 I = 1, N
213: IF( S( I ).LE.ZERO ) THEN
214: INFO = I
215: RETURN
216: END IF
217: 30 CONTINUE
218: ELSE
219: *
220: * Set the scale factors to the reciprocals
221: * of the diagonal elements.
222: *
223: DO 40 I = 1, N
224: S( I ) = ONE / SQRT( S( I ) )
225: 40 CONTINUE
226: *
227: * Compute SCOND = min(S(I)) / max(S(I))
228: *
229: SCOND = SQRT( SMIN ) / SQRT( AMAX )
230: END IF
231: RETURN
232: *
233: * End of DPPEQU
234: *
235: END
CVSweb interface <joel.bertrand@systella.fr>