3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DGBEQU + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgbequ.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgbequ.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgbequ.f">
21 * SUBROUTINE DGBEQU( 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 AB( LDAB, * ), C( * ), R( * )
38 *> DGBEQU computes row and column scalings intended to equilibrate an
39 *> M-by-N band matrix A and reduce its condition number. R returns the
40 *> row scale factors and C the column scale factors, chosen to try to
41 *> make the largest element in each row and column of the matrix B with
42 *> elements B(i,j)=R(i)*A(i,j)*C(j) have absolute value 1.
44 *> R(i) and C(j) are restricted to be between SMLNUM = smallest safe
45 *> number and BIGNUM = largest safe number. Use of these scaling
46 *> factors is not guaranteed to reduce the condition number of A but
47 *> works well in practice.
56 *> The number of rows of the matrix A. M >= 0.
62 *> The number of columns of the matrix A. N >= 0.
68 *> The number of subdiagonals within the band of A. KL >= 0.
74 *> The number of superdiagonals within the band of A. KU >= 0.
79 *> AB is DOUBLE PRECISION array, dimension (LDAB,N)
80 *> The band matrix A, stored in rows 1 to KL+KU+1. The j-th
81 *> column of A is stored in the j-th column of the array AB as
83 *> AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl).
89 *> The leading dimension of the array AB. LDAB >= KL+KU+1.
94 *> R is DOUBLE PRECISION array, dimension (M)
95 *> If INFO = 0, or INFO > M, R contains the row scale factors
101 *> C is DOUBLE PRECISION array, dimension (N)
102 *> If INFO = 0, C contains the column scale factors for A.
105 *> \param[out] ROWCND
107 *> ROWCND is DOUBLE PRECISION
108 *> If INFO = 0 or INFO > M, ROWCND contains the ratio of the
109 *> smallest R(i) to the largest R(i). If ROWCND >= 0.1 and
110 *> AMAX is neither too large nor too small, it is not worth
114 *> \param[out] COLCND
116 *> COLCND is DOUBLE PRECISION
117 *> If INFO = 0, COLCND contains the ratio of the smallest
118 *> C(i) to the largest C(i). If COLCND >= 0.1, it is not
119 *> worth scaling by C.
124 *> AMAX is DOUBLE PRECISION
125 *> Absolute value of largest matrix element. If AMAX is very
126 *> close to overflow or very close to underflow, the matrix
133 *> = 0: successful exit
134 *> < 0: if INFO = -i, the i-th argument had an illegal value
135 *> > 0: if INFO = i, and i is
136 *> <= M: the i-th row of A is exactly zero
137 *> > M: the (i-M)-th column of A is exactly zero
143 *> \author Univ. of Tennessee
144 *> \author Univ. of California Berkeley
145 *> \author Univ. of Colorado Denver
148 *> \date November 2011
150 *> \ingroup doubleGBcomputational
152 * =====================================================================
153 SUBROUTINE DGBEQU( M, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND,
156 * -- LAPACK computational routine (version 3.4.0) --
157 * -- LAPACK is a software package provided by Univ. of Tennessee, --
158 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
161 * .. Scalar Arguments ..
162 INTEGER INFO, KL, KU, LDAB, M, N
163 DOUBLE PRECISION AMAX, COLCND, ROWCND
165 * .. Array Arguments ..
166 DOUBLE PRECISION AB( LDAB, * ), C( * ), R( * )
169 * =====================================================================
172 DOUBLE PRECISION ONE, ZERO
173 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
175 * .. Local Scalars ..
177 DOUBLE PRECISION BIGNUM, RCMAX, RCMIN, SMLNUM
179 * .. External Functions ..
180 DOUBLE PRECISION DLAMCH
183 * .. External Subroutines ..
186 * .. Intrinsic Functions ..
187 INTRINSIC ABS, MAX, MIN
189 * .. Executable Statements ..
191 * Test the input parameters
196 ELSE IF( N.LT.0 ) THEN
198 ELSE IF( KL.LT.0 ) THEN
200 ELSE IF( KU.LT.0 ) THEN
202 ELSE IF( LDAB.LT.KL+KU+1 ) THEN
206 CALL XERBLA( 'DGBEQU', -INFO )
210 * Quick return if possible
212 IF( M.EQ.0 .OR. N.EQ.0 ) THEN
219 * Get machine constants.
221 SMLNUM = DLAMCH( 'S' )
222 BIGNUM = ONE / SMLNUM
224 * Compute row scale factors.
230 * Find the maximum element in each row.
234 DO 20 I = MAX( J-KU, 1 ), MIN( J+KL, M )
235 R( I ) = MAX( R( I ), ABS( AB( KD+I-J, J ) ) )
239 * Find the maximum and minimum scale factors.
244 RCMAX = MAX( RCMAX, R( I ) )
245 RCMIN = MIN( RCMIN, R( I ) )
249 IF( RCMIN.EQ.ZERO ) THEN
251 * Find the first zero scale factor and return an error code.
254 IF( R( I ).EQ.ZERO ) THEN
261 * Invert the scale factors.
264 R( I ) = ONE / MIN( MAX( R( I ), SMLNUM ), BIGNUM )
267 * Compute ROWCND = min(R(I)) / max(R(I))
269 ROWCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM )
272 * Compute column scale factors
278 * Find the maximum element in each column,
279 * assuming the row scaling computed above.
283 DO 80 I = MAX( J-KU, 1 ), MIN( J+KL, M )
284 C( J ) = MAX( C( J ), ABS( AB( KD+I-J, J ) )*R( I ) )
288 * Find the maximum and minimum scale factors.
293 RCMIN = MIN( RCMIN, C( J ) )
294 RCMAX = MAX( RCMAX, C( J ) )
297 IF( RCMIN.EQ.ZERO ) THEN
299 * Find the first zero scale factor and return an error code.
302 IF( C( J ).EQ.ZERO ) THEN
309 * Invert the scale factors.
312 C( J ) = ONE / MIN( MAX( C( J ), SMLNUM ), BIGNUM )
315 * Compute COLCND = min(C(J)) / max(C(J))
317 COLCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM )