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

◆ zgbequ()

subroutine zgbequ ( integer m,
integer n,
integer kl,
integer ku,
complex*16, dimension( ldab, * ) ab,
integer ldab,
double precision, dimension( * ) r,
double precision, dimension( * ) c,
double precision rowcnd,
double precision colcnd,
double precision amax,
integer info )

ZGBEQU

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

Purpose:
!>
!> ZGBEQU computes row and column scalings intended to equilibrate an
!> M-by-N band matrix A and reduce its condition number.  R returns the
!> row scale factors and C the column scale factors, chosen to try to
!> make the largest element in each row and column of the matrix B with
!> elements B(i,j)=R(i)*A(i,j)*C(j) have absolute value 1.
!>
!> R(i) and C(j) are restricted to be between SMLNUM = smallest safe
!> number and BIGNUM = largest safe number.  Use of these scaling
!> factors is not guaranteed to reduce the condition number of A but
!> works well in practice.
!> 
Parameters
[in]M
!>          M is INTEGER
!>          The number of rows of the matrix A.  M >= 0.
!> 
[in]N
!>          N is INTEGER
!>          The number of columns of the matrix A.  N >= 0.
!> 
[in]KL
!>          KL is INTEGER
!>          The number of subdiagonals within the band of A.  KL >= 0.
!> 
[in]KU
!>          KU is INTEGER
!>          The number of superdiagonals within the band of A.  KU >= 0.
!> 
[in]AB
!>          AB is COMPLEX*16 array, dimension (LDAB,N)
!>          The band matrix A, stored in rows 1 to KL+KU+1.  The j-th
!>          column of A is stored in the j-th column of the array AB as
!>          follows:
!>          AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl).
!> 
[in]LDAB
!>          LDAB is INTEGER
!>          The leading dimension of the array AB.  LDAB >= KL+KU+1.
!> 
[out]R
!>          R is DOUBLE PRECISION array, dimension (M)
!>          If INFO = 0, or INFO > M, R contains the row scale factors
!>          for A.
!> 
[out]C
!>          C is DOUBLE PRECISION array, dimension (N)
!>          If INFO = 0, C contains the column scale factors for A.
!> 
[out]ROWCND
!>          ROWCND is DOUBLE PRECISION
!>          If INFO = 0 or INFO > M, ROWCND contains the ratio of the
!>          smallest R(i) to the largest R(i).  If ROWCND >= 0.1 and
!>          AMAX is neither too large nor too small, it is not worth
!>          scaling by R.
!> 
[out]COLCND
!>          COLCND is DOUBLE PRECISION
!>          If INFO = 0, COLCND contains the ratio of the smallest
!>          C(i) to the largest C(i).  If COLCND >= 0.1, it is not
!>          worth scaling by C.
!> 
[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, and i is
!>                <= M:  the i-th row of A is exactly zero
!>                >  M:  the (i-M)-th column of A is exactly zero
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 150 of file zgbequ.f.

153*
154* -- LAPACK computational routine --
155* -- LAPACK is a software package provided by Univ. of Tennessee, --
156* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
157*
158* .. Scalar Arguments ..
159 INTEGER INFO, KL, KU, LDAB, M, N
160 DOUBLE PRECISION AMAX, COLCND, ROWCND
161* ..
162* .. Array Arguments ..
163 DOUBLE PRECISION C( * ), R( * )
164 COMPLEX*16 AB( LDAB, * )
165* ..
166*
167* =====================================================================
168*
169* .. Parameters ..
170 DOUBLE PRECISION ONE, ZERO
171 parameter( one = 1.0d+0, zero = 0.0d+0 )
172* ..
173* .. Local Scalars ..
174 INTEGER I, J, KD
175 DOUBLE PRECISION BIGNUM, RCMAX, RCMIN, SMLNUM
176 COMPLEX*16 ZDUM
177* ..
178* .. External Functions ..
179 DOUBLE PRECISION DLAMCH
180 EXTERNAL dlamch
181* ..
182* .. External Subroutines ..
183 EXTERNAL xerbla
184* ..
185* .. Intrinsic Functions ..
186 INTRINSIC abs, dble, dimag, max, min
187* ..
188* .. Statement Functions ..
189 DOUBLE PRECISION CABS1
190* ..
191* .. Statement Function definitions ..
192 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
193* ..
194* .. Executable Statements ..
195*
196* Test the input parameters
197*
198 info = 0
199 IF( m.LT.0 ) THEN
200 info = -1
201 ELSE IF( n.LT.0 ) THEN
202 info = -2
203 ELSE IF( kl.LT.0 ) THEN
204 info = -3
205 ELSE IF( ku.LT.0 ) THEN
206 info = -4
207 ELSE IF( ldab.LT.kl+ku+1 ) THEN
208 info = -6
209 END IF
210 IF( info.NE.0 ) THEN
211 CALL xerbla( 'ZGBEQU', -info )
212 RETURN
213 END IF
214*
215* Quick return if possible
216*
217 IF( m.EQ.0 .OR. n.EQ.0 ) THEN
218 rowcnd = one
219 colcnd = one
220 amax = zero
221 RETURN
222 END IF
223*
224* Get machine constants.
225*
226 smlnum = dlamch( 'S' )
227 bignum = one / smlnum
228*
229* Compute row scale factors.
230*
231 DO 10 i = 1, m
232 r( i ) = zero
233 10 CONTINUE
234*
235* Find the maximum element in each row.
236*
237 kd = ku + 1
238 DO 30 j = 1, n
239 DO 20 i = max( j-ku, 1 ), min( j+kl, m )
240 r( i ) = max( r( i ), cabs1( ab( kd+i-j, j ) ) )
241 20 CONTINUE
242 30 CONTINUE
243*
244* Find the maximum and minimum scale factors.
245*
246 rcmin = bignum
247 rcmax = zero
248 DO 40 i = 1, m
249 rcmax = max( rcmax, r( i ) )
250 rcmin = min( rcmin, r( i ) )
251 40 CONTINUE
252 amax = rcmax
253*
254 IF( rcmin.EQ.zero ) THEN
255*
256* Find the first zero scale factor and return an error code.
257*
258 DO 50 i = 1, m
259 IF( r( i ).EQ.zero ) THEN
260 info = i
261 RETURN
262 END IF
263 50 CONTINUE
264 ELSE
265*
266* Invert the scale factors.
267*
268 DO 60 i = 1, m
269 r( i ) = one / min( max( r( i ), smlnum ), bignum )
270 60 CONTINUE
271*
272* Compute ROWCND = min(R(I)) / max(R(I))
273*
274 rowcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
275 END IF
276*
277* Compute column scale factors
278*
279 DO 70 j = 1, n
280 c( j ) = zero
281 70 CONTINUE
282*
283* Find the maximum element in each column,
284* assuming the row scaling computed above.
285*
286 kd = ku + 1
287 DO 90 j = 1, n
288 DO 80 i = max( j-ku, 1 ), min( j+kl, m )
289 c( j ) = max( c( j ), cabs1( ab( kd+i-j, j ) )*r( i ) )
290 80 CONTINUE
291 90 CONTINUE
292*
293* Find the maximum and minimum scale factors.
294*
295 rcmin = bignum
296 rcmax = zero
297 DO 100 j = 1, n
298 rcmin = min( rcmin, c( j ) )
299 rcmax = max( rcmax, c( j ) )
300 100 CONTINUE
301*
302 IF( rcmin.EQ.zero ) THEN
303*
304* Find the first zero scale factor and return an error code.
305*
306 DO 110 j = 1, n
307 IF( c( j ).EQ.zero ) THEN
308 info = m + j
309 RETURN
310 END IF
311 110 CONTINUE
312 ELSE
313*
314* Invert the scale factors.
315*
316 DO 120 j = 1, n
317 c( j ) = one / min( max( c( j ), smlnum ), bignum )
318 120 CONTINUE
319*
320* Compute COLCND = min(C(J)) / max(C(J))
321*
322 colcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
323 END IF
324*
325 RETURN
326*
327* End of ZGBEQU
328*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
Here is the call graph for this function:
Here is the caller graph for this function: