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