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