3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZGBEQUB + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgbequb.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgbequb.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgbequb.f">
21 * SUBROUTINE ZGBEQUB( M, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND,
24 * .. Scalar Arguments ..
25 * INTEGER INFO, KL, KU, LDAB, M, N
26 * DOUBLE PRECISION AMAX, COLCND, ROWCND
28 * .. Array Arguments ..
29 * DOUBLE PRECISION C( * ), R( * )
30 * COMPLEX*16 AB( LDAB, * )
39 *> ZGBEQUB computes row and column scalings intended to equilibrate an
40 *> M-by-N matrix A and reduce its condition number. R returns the row
41 *> scale factors and C the column scale factors, chosen to try to make
42 *> the largest element in each row and column of the matrix B with
43 *> elements B(i,j)=R(i)*A(i,j)*C(j) have an absolute value of at most
46 *> R(i) and C(j) are restricted to be a power of the radix between
47 *> SMLNUM = smallest safe number and BIGNUM = largest safe number. Use
48 *> of these scaling factors is not guaranteed to reduce the condition
49 *> number of A but works well in practice.
51 *> This routine differs from ZGEEQU by restricting the scaling factors
52 *> to a power of the radix. Barring over- and underflow, scaling by
53 *> these factors introduces no additional rounding errors. However, the
54 *> scaled entries' magnitudes are no longer approximately 1 but lie
55 *> between sqrt(radix) and 1/sqrt(radix).
64 *> The number of rows of the matrix A. M >= 0.
70 *> The number of columns of the matrix A. N >= 0.
76 *> The number of subdiagonals within the band of A. KL >= 0.
82 *> The number of superdiagonals within the band of A. KU >= 0.
87 *> AB is COMPLEX*16 array, dimension (LDAB,N)
88 *> On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
89 *> The j-th column of A is stored in the j-th column of the
90 *> array AB as follows:
91 *> AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
97 *> The leading dimension of the array A. LDAB >= max(1,M).
102 *> R is DOUBLE PRECISION array, dimension (M)
103 *> If INFO = 0 or INFO > M, R contains the row scale factors
109 *> C is DOUBLE PRECISION array, dimension (N)
110 *> If INFO = 0, C contains the column scale factors for A.
113 *> \param[out] ROWCND
115 *> ROWCND is DOUBLE PRECISION
116 *> If INFO = 0 or INFO > M, ROWCND contains the ratio of the
117 *> smallest R(i) to the largest R(i). If ROWCND >= 0.1 and
118 *> AMAX is neither too large nor too small, it is not worth
122 *> \param[out] COLCND
124 *> COLCND is DOUBLE PRECISION
125 *> If INFO = 0, COLCND contains the ratio of the smallest
126 *> C(i) to the largest C(i). If COLCND >= 0.1, it is not
127 *> worth scaling by C.
132 *> AMAX is DOUBLE PRECISION
133 *> Absolute value of largest matrix element. If AMAX is very
134 *> close to overflow or very close to underflow, the matrix
141 *> = 0: successful exit
142 *> < 0: if INFO = -i, the i-th argument had an illegal value
143 *> > 0: if INFO = i, and i is
144 *> <= M: the i-th row of A is exactly zero
145 *> > M: the (i-M)-th column of A is exactly zero
151 *> \author Univ. of Tennessee
152 *> \author Univ. of California Berkeley
153 *> \author Univ. of Colorado Denver
158 *> \ingroup complex16GBcomputational
160 * =====================================================================
161 SUBROUTINE ZGBEQUB( M, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND,
164 * -- LAPACK computational routine (version 3.6.1) --
165 * -- LAPACK is a software package provided by Univ. of Tennessee, --
166 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
169 * .. Scalar Arguments ..
170 INTEGER INFO, KL, KU, LDAB, M, N
171 DOUBLE PRECISION AMAX, COLCND, ROWCND
173 * .. Array Arguments ..
174 DOUBLE PRECISION C( * ), R( * )
175 COMPLEX*16 AB( LDAB, * )
178 * =====================================================================
181 DOUBLE PRECISION ONE, ZERO
182 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
184 * .. Local Scalars ..
186 DOUBLE PRECISION BIGNUM, RCMAX, RCMIN, SMLNUM, RADIX,
190 * .. External Functions ..
191 DOUBLE PRECISION DLAMCH
194 * .. External Subroutines ..
197 * .. Intrinsic Functions ..
198 INTRINSIC ABS, MAX, MIN, LOG, REAL, DIMAG
200 * .. Statement Functions ..
201 DOUBLE PRECISION CABS1
203 * .. Statement Function definitions ..
204 CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
206 * .. Executable Statements ..
208 * Test the input parameters.
213 ELSE IF( N.LT.0 ) THEN
215 ELSE IF( KL.LT.0 ) THEN
217 ELSE IF( KU.LT.0 ) THEN
219 ELSE IF( LDAB.LT.KL+KU+1 ) THEN
223 CALL XERBLA( 'ZGBEQUB', -INFO )
227 * Quick return if possible.
229 IF( M.EQ.0 .OR. N.EQ.0 ) THEN
236 * Get machine constants. Assume SMLNUM is a power of the radix.
238 SMLNUM = DLAMCH( 'S' )
239 BIGNUM = ONE / SMLNUM
240 RADIX = DLAMCH( 'B' )
243 * Compute row scale factors.
249 * Find the maximum element in each row.
253 DO 20 I = MAX( J-KU, 1 ), MIN( J+KL, M )
254 R( I ) = MAX( R( I ), CABS1( AB( KD+I-J, J ) ) )
258 IF( R( I ).GT.ZERO ) THEN
259 R( I ) = RADIX**INT( LOG( R( I ) ) / LOGRDX )
263 * Find the maximum and minimum scale factors.
268 RCMAX = MAX( RCMAX, R( I ) )
269 RCMIN = MIN( RCMIN, R( I ) )
273 IF( RCMIN.EQ.ZERO ) THEN
275 * Find the first zero scale factor and return an error code.
278 IF( R( I ).EQ.ZERO ) THEN
285 * Invert the scale factors.
288 R( I ) = ONE / MIN( MAX( R( I ), SMLNUM ), BIGNUM )
291 * Compute ROWCND = min(R(I)) / max(R(I)).
293 ROWCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM )
296 * Compute column scale factors.
302 * Find the maximum element in each column,
303 * assuming the row scaling computed above.
306 DO 80 I = MAX( J-KU, 1 ), MIN( J+KL, M )
307 C( J ) = MAX( C( J ), CABS1( AB( KD+I-J, J ) )*R( I ) )
309 IF( C( J ).GT.ZERO ) THEN
310 C( J ) = RADIX**INT( LOG( C( J ) ) / LOGRDX )
314 * Find the maximum and minimum scale factors.
319 RCMIN = MIN( RCMIN, C( J ) )
320 RCMAX = MAX( RCMAX, C( J ) )
323 IF( RCMIN.EQ.ZERO ) THEN
325 * Find the first zero scale factor and return an error code.
328 IF( C( J ).EQ.ZERO ) THEN
335 * Invert the scale factors.
338 C( J ) = ONE / MIN( MAX( C( J ), SMLNUM ), BIGNUM )
341 * Compute COLCND = min(C(J)) / max(C(J)).
343 COLCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM )