LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
spoequb.f
Go to the documentation of this file.
1*> \brief \b SPOEQUB
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download SPOEQUB + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/spoequb.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/spoequb.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/spoequb.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE SPOEQUB( N, A, LDA, S, SCOND, AMAX, INFO )
20*
21* .. Scalar Arguments ..
22* INTEGER INFO, LDA, N
23* REAL AMAX, SCOND
24* ..
25* .. Array Arguments ..
26* REAL A( LDA, * ), S( * )
27* ..
28*
29*
30*> \par Purpose:
31* =============
32*>
33*> \verbatim
34*>
35*> SPOEQUB 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*>
44*> This routine differs from SPOEQU by restricting the scaling factors
45*> to a power of the radix. Barring over- and underflow, scaling by
46*> these factors introduces no additional rounding errors. However, the
47*> scaled diagonal entries are no longer approximately 1 but lie
48*> between sqrt(radix) and 1/sqrt(radix).
49*> \endverbatim
50*
51* Arguments:
52* ==========
53*
54*> \param[in] N
55*> \verbatim
56*> N is INTEGER
57*> The order of the matrix A. N >= 0.
58*> \endverbatim
59*>
60*> \param[in] A
61*> \verbatim
62*> A is REAL array, dimension (LDA,N)
63*> The N-by-N symmetric positive definite matrix whose scaling
64*> factors are to be computed. Only the diagonal elements of A
65*> are referenced.
66*> \endverbatim
67*>
68*> \param[in] LDA
69*> \verbatim
70*> LDA is INTEGER
71*> The leading dimension of the array A. LDA >= max(1,N).
72*> \endverbatim
73*>
74*> \param[out] S
75*> \verbatim
76*> S is REAL 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 REAL
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 REAL
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 poequb
113*
114* =====================================================================
115 SUBROUTINE spoequb( N, A, LDA, 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 INTEGER INFO, LDA, N
123 REAL AMAX, SCOND
124* ..
125* .. Array Arguments ..
126 REAL A( LDA, * ), S( * )
127* ..
128*
129* =====================================================================
130*
131* .. Parameters ..
132 REAL ZERO, ONE
133 parameter( zero = 0.0e+0, one = 1.0e+0 )
134* ..
135* .. Local Scalars ..
136 INTEGER I
137 REAL SMIN, BASE, TMP
138* ..
139* .. External Functions ..
140 REAL SLAMCH
141 EXTERNAL slamch
142* ..
143* .. External Subroutines ..
144 EXTERNAL xerbla
145* ..
146* .. Intrinsic Functions ..
147 INTRINSIC max, min, sqrt, log, int
148* ..
149* .. Executable Statements ..
150*
151* Test the input parameters.
152*
153* Positive definite only performs 1 pass of equilibration.
154*
155 info = 0
156 IF( n.LT.0 ) THEN
157 info = -1
158 ELSE IF( lda.LT.max( 1, n ) ) THEN
159 info = -3
160 END IF
161 IF( info.NE.0 ) THEN
162 CALL xerbla( 'SPOEQUB', -info )
163 RETURN
164 END IF
165*
166* Quick return if possible.
167*
168 IF( n.EQ.0 ) THEN
169 scond = one
170 amax = zero
171 RETURN
172 END IF
173
174 base = slamch( 'B' )
175 tmp = -0.5 / log( base )
176*
177* Find the minimum and maximum diagonal elements.
178*
179 s( 1 ) = a( 1, 1 )
180 smin = s( 1 )
181 amax = s( 1 )
182 DO 10 i = 2, n
183 s( i ) = a( i, i )
184 smin = min( smin, s( i ) )
185 amax = max( amax, s( i ) )
186 10 CONTINUE
187*
188 IF( smin.LE.zero ) THEN
189*
190* Find the first non-positive diagonal element and return.
191*
192 DO 20 i = 1, n
193 IF( s( i ).LE.zero ) THEN
194 info = i
195 RETURN
196 END IF
197 20 CONTINUE
198 ELSE
199*
200* Set the scale factors to the reciprocals
201* of the diagonal elements.
202*
203 DO 30 i = 1, n
204 s( i ) = base ** int( tmp * log( s( i ) ) )
205 30 CONTINUE
206*
207* Compute SCOND = min(S(I)) / max(S(I)).
208*
209 scond = sqrt( smin ) / sqrt( amax )
210 END IF
211*
212 RETURN
213*
214* End of SPOEQUB
215*
216 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine spoequb(n, a, lda, s, scond, amax, info)
SPOEQUB
Definition spoequb.f:116