LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dpbequ()

subroutine dpbequ ( character uplo,
integer n,
integer kd,
double precision, dimension( ldab, * ) ab,
integer ldab,
double precision, dimension( * ) s,
double precision scond,
double precision amax,
integer info )

DPBEQU

Download DPBEQU + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> DPBEQU computes row and column scalings intended to equilibrate a
!> symmetric positive definite band matrix A and reduce its condition
!> number (with respect to the two-norm).  S contains the scale factors,
!> S(i) = 1/sqrt(A(i,i)), chosen so that the scaled matrix B with
!> elements B(i,j) = S(i)*A(i,j)*S(j) has ones on the diagonal.  This
!> choice of S puts the condition number of B within a factor N of the
!> smallest possible condition number over all possible diagonal
!> scalings.
!> 
Parameters
[in]UPLO
!>          UPLO is CHARACTER*1
!>          = 'U':  Upper triangular of A is stored;
!>          = 'L':  Lower triangular of A is stored.
!> 
[in]N
!>          N is INTEGER
!>          The order of the matrix A.  N >= 0.
!> 
[in]KD
!>          KD is INTEGER
!>          The number of superdiagonals of the matrix A if UPLO = 'U',
!>          or the number of subdiagonals if UPLO = 'L'.  KD >= 0.
!> 
[in]AB
!>          AB is DOUBLE PRECISION array, dimension (LDAB,N)
!>          The upper or lower triangle of the symmetric band matrix A,
!>          stored in the first KD+1 rows of the array.  The j-th column
!>          of A is stored in the j-th column of the array AB as follows:
!>          if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
!>          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+kd).
!> 
[in]LDAB
!>          LDAB is INTEGER
!>          The leading dimension of the array A.  LDAB >= KD+1.
!> 
[out]S
!>          S is DOUBLE PRECISION array, dimension (N)
!>          If INFO = 0, S contains the scale factors for A.
!> 
[out]SCOND
!>          SCOND is DOUBLE PRECISION
!>          If INFO = 0, S contains the ratio of the smallest S(i) to
!>          the largest S(i).  If SCOND >= 0.1 and AMAX is neither too
!>          large nor too small, it is not worth scaling by S.
!> 
[out]AMAX
!>          AMAX is DOUBLE PRECISION
!>          Absolute value of largest matrix element.  If AMAX is very
!>          close to overflow or very close to underflow, the matrix
!>          should be scaled.
!> 
[out]INFO
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value.
!>          > 0:  if INFO = i, the i-th diagonal element is nonpositive.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 126 of file dpbequ.f.

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 DOUBLE PRECISION AMAX, SCOND
137* ..
138* .. Array Arguments ..
139 DOUBLE PRECISION AB( LDAB, * ), S( * )
140* ..
141*
142* =====================================================================
143*
144* .. Parameters ..
145 DOUBLE PRECISION ZERO, ONE
146 parameter( zero = 0.0d+0, one = 1.0d+0 )
147* ..
148* .. Local Scalars ..
149 LOGICAL UPPER
150 INTEGER I, J
151 DOUBLE PRECISION 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( 'DPBEQU', -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 DPBEQU
237*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: