LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ dgbequb()

subroutine dgbequb ( integer  M,
integer  N,
integer  KL,
integer  KU,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
double precision, dimension( * )  R,
double precision, dimension( * )  C,
double precision  ROWCND,
double precision  COLCND,
double precision  AMAX,
integer  INFO 
)

DGBEQUB

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

Purpose:
 DGBEQUB computes row and column scalings intended to equilibrate an
 M-by-N 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 an absolute value of at most
 the radix.

 R(i) and C(j) are restricted to be a power of the radix 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.

 This routine differs from DGEEQU by restricting the scaling factors
 to a power of the radix.  Barring over- and underflow, scaling by
 these factors introduces no additional rounding errors.  However, the
 scaled entries' magnitudes are no longer approximately 1 but lie
 between sqrt(radix) and 1/sqrt(radix).
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 DOUBLE PRECISION array, dimension (LDAB,N)
          On entry, the matrix A in band storage, 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(N,j+kl)
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array A.  LDAB >= max(1,M).
[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 158 of file dgbequb.f.

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