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

◆ cpbequ()

subroutine cpbequ ( character uplo,
integer n,
integer kd,
complex, dimension( ldab, * ) ab,
integer ldab,
real, dimension( * ) s,
real scond,
real amax,
integer info )

CPBEQU

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

Purpose:
!>
!> CPBEQU computes row and column scalings intended to equilibrate a
!> Hermitian 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 COMPLEX array, dimension (LDAB,N)
!>          The upper or lower triangle of the Hermitian 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 REAL array, dimension (N)
!>          If INFO = 0, S contains the scale factors for A.
!> 
[out]SCOND
!>          SCOND is REAL
!>          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 REAL
!>          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 127 of file cpbequ.f.

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*
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: