LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dpoequ.f
Go to the documentation of this file.
1*> \brief \b DPOEQU
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download DPOEQU + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dpoequ.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dpoequ.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dpoequ.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE DPOEQU( N, A, LDA, S, SCOND, AMAX, INFO )
20*
21* .. Scalar Arguments ..
22* INTEGER INFO, LDA, N
23* DOUBLE PRECISION AMAX, SCOND
24* ..
25* .. Array Arguments ..
26* DOUBLE PRECISION A( LDA, * ), S( * )
27* ..
28*
29*
30*> \par Purpose:
31* =============
32*>
33*> \verbatim
34*>
35*> DPOEQU computes row and column scalings intended to equilibrate a
36*> symmetric positive definite matrix A and reduce its condition number
37*> (with respect to the two-norm). S contains the scale factors,
38*> S(i) = 1/sqrt(A(i,i)), chosen so that the scaled matrix B with
39*> elements B(i,j) = S(i)*A(i,j)*S(j) has ones on the diagonal. This
40*> choice of S puts the condition number of B within a factor N of the
41*> smallest possible condition number over all possible diagonal
42*> scalings.
43*> \endverbatim
44*
45* Arguments:
46* ==========
47*
48*> \param[in] N
49*> \verbatim
50*> N is INTEGER
51*> The order of the matrix A. N >= 0.
52*> \endverbatim
53*>
54*> \param[in] A
55*> \verbatim
56*> A is DOUBLE PRECISION array, dimension (LDA,N)
57*> The N-by-N symmetric positive definite matrix whose scaling
58*> factors are to be computed. Only the diagonal elements of A
59*> are referenced.
60*> \endverbatim
61*>
62*> \param[in] LDA
63*> \verbatim
64*> LDA is INTEGER
65*> The leading dimension of the array A. LDA >= max(1,N).
66*> \endverbatim
67*>
68*> \param[out] S
69*> \verbatim
70*> S is DOUBLE PRECISION array, dimension (N)
71*> If INFO = 0, S contains the scale factors for A.
72*> \endverbatim
73*>
74*> \param[out] SCOND
75*> \verbatim
76*> SCOND is DOUBLE PRECISION
77*> If INFO = 0, S contains the ratio of the smallest S(i) to
78*> the largest S(i). If SCOND >= 0.1 and AMAX is neither too
79*> large nor too small, it is not worth scaling by S.
80*> \endverbatim
81*>
82*> \param[out] AMAX
83*> \verbatim
84*> AMAX is DOUBLE PRECISION
85*> Absolute value of largest matrix element. If AMAX is very
86*> close to overflow or very close to underflow, the matrix
87*> should be scaled.
88*> \endverbatim
89*>
90*> \param[out] INFO
91*> \verbatim
92*> INFO is INTEGER
93*> = 0: successful exit
94*> < 0: if INFO = -i, the i-th argument had an illegal value
95*> > 0: if INFO = i, the i-th diagonal element is nonpositive.
96*> \endverbatim
97*
98* Authors:
99* ========
100*
101*> \author Univ. of Tennessee
102*> \author Univ. of California Berkeley
103*> \author Univ. of Colorado Denver
104*> \author NAG Ltd.
105*
106*> \ingroup poequ
107*
108* =====================================================================
109 SUBROUTINE dpoequ( N, A, LDA, S, SCOND, AMAX, INFO )
110*
111* -- LAPACK computational routine --
112* -- LAPACK is a software package provided by Univ. of Tennessee, --
113* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
114*
115* .. Scalar Arguments ..
116 INTEGER INFO, LDA, N
117 DOUBLE PRECISION AMAX, SCOND
118* ..
119* .. Array Arguments ..
120 DOUBLE PRECISION A( LDA, * ), S( * )
121* ..
122*
123* =====================================================================
124*
125* .. Parameters ..
126 DOUBLE PRECISION ZERO, ONE
127 parameter( zero = 0.0d+0, one = 1.0d+0 )
128* ..
129* .. Local Scalars ..
130 INTEGER I
131 DOUBLE PRECISION SMIN
132* ..
133* .. External Subroutines ..
134 EXTERNAL xerbla
135* ..
136* .. Intrinsic Functions ..
137 INTRINSIC max, min, sqrt
138* ..
139* .. Executable Statements ..
140*
141* Test the input parameters.
142*
143 info = 0
144 IF( n.LT.0 ) THEN
145 info = -1
146 ELSE IF( lda.LT.max( 1, n ) ) THEN
147 info = -3
148 END IF
149 IF( info.NE.0 ) THEN
150 CALL xerbla( 'DPOEQU', -info )
151 RETURN
152 END IF
153*
154* Quick return if possible
155*
156 IF( n.EQ.0 ) THEN
157 scond = one
158 amax = zero
159 RETURN
160 END IF
161*
162* Find the minimum and maximum diagonal elements.
163*
164 s( 1 ) = a( 1, 1 )
165 smin = s( 1 )
166 amax = s( 1 )
167 DO 10 i = 2, n
168 s( i ) = a( i, i )
169 smin = min( smin, s( i ) )
170 amax = max( amax, s( i ) )
171 10 CONTINUE
172*
173 IF( smin.LE.zero ) THEN
174*
175* Find the first non-positive diagonal element and return.
176*
177 DO 20 i = 1, n
178 IF( s( i ).LE.zero ) THEN
179 info = i
180 RETURN
181 END IF
182 20 CONTINUE
183 ELSE
184*
185* Set the scale factors to the reciprocals
186* of the diagonal elements.
187*
188 DO 30 i = 1, n
189 s( i ) = one / sqrt( s( i ) )
190 30 CONTINUE
191*
192* Compute SCOND = min(S(I)) / max(S(I))
193*
194 scond = sqrt( smin ) / sqrt( amax )
195 END IF
196 RETURN
197*
198* End of DPOEQU
199*
200 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine dpoequ(n, a, lda, s, scond, amax, info)
DPOEQU
Definition dpoequ.f:110