3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZGEEQU + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgeequ.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgeequ.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgeequ.f">
21 * SUBROUTINE ZGEEQU( M, N, A, LDA, R, C, ROWCND, COLCND, AMAX,
24 * .. Scalar Arguments ..
25 * INTEGER INFO, LDA, M, N
26 * DOUBLE PRECISION AMAX, COLCND, ROWCND
28 * .. Array Arguments ..
29 * DOUBLE PRECISION C( * ), R( * )
30 * COMPLEX*16 A( LDA, * )
39 *> ZGEEQU 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 absolute value 1.
45 *> R(i) and C(j) are restricted to be between SMLNUM = smallest safe
46 *> number and BIGNUM = largest safe number. Use of these scaling
47 *> factors is not guaranteed to reduce the condition number of A but
48 *> works well in practice.
57 *> The number of rows of the matrix A. M >= 0.
63 *> The number of columns of the matrix A. N >= 0.
68 *> A is COMPLEX*16 array, dimension (LDA,N)
69 *> The M-by-N matrix whose equilibration factors are
76 *> The leading dimension of the array A. LDA >= max(1,M).
81 *> R is DOUBLE PRECISION array, dimension (M)
82 *> If INFO = 0 or INFO > M, R contains the row scale factors
88 *> C is DOUBLE PRECISION array, dimension (N)
89 *> If INFO = 0, C contains the column scale factors for A.
94 *> ROWCND is DOUBLE PRECISION
95 *> If INFO = 0 or INFO > M, ROWCND contains the ratio of the
96 *> smallest R(i) to the largest R(i). If ROWCND >= 0.1 and
97 *> AMAX is neither too large nor too small, it is not worth
101 *> \param[out] COLCND
103 *> COLCND is DOUBLE PRECISION
104 *> If INFO = 0, COLCND contains the ratio of the smallest
105 *> C(i) to the largest C(i). If COLCND >= 0.1, it is not
106 *> worth scaling by C.
111 *> AMAX is DOUBLE PRECISION
112 *> Absolute value of largest matrix element. If AMAX is very
113 *> close to overflow or very close to underflow, the matrix
120 *> = 0: successful exit
121 *> < 0: if INFO = -i, the i-th argument had an illegal value
122 *> > 0: if INFO = i, and i is
123 *> <= M: the i-th row of A is exactly zero
124 *> > M: the (i-M)-th column of A is exactly zero
130 *> \author Univ. of Tennessee
131 *> \author Univ. of California Berkeley
132 *> \author Univ. of Colorado Denver
135 *> \date November 2011
137 *> \ingroup complex16GEcomputational
139 * =====================================================================
140 SUBROUTINE ZGEEQU( M, N, A, LDA, R, C, ROWCND, COLCND, AMAX,
143 * -- LAPACK computational routine (version 3.4.0) --
144 * -- LAPACK is a software package provided by Univ. of Tennessee, --
145 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
148 * .. Scalar Arguments ..
149 INTEGER INFO, LDA, M, N
150 DOUBLE PRECISION AMAX, COLCND, ROWCND
152 * .. Array Arguments ..
153 DOUBLE PRECISION C( * ), R( * )
154 COMPLEX*16 A( LDA, * )
157 * =====================================================================
160 DOUBLE PRECISION ONE, ZERO
161 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
163 * .. Local Scalars ..
165 DOUBLE PRECISION BIGNUM, RCMAX, RCMIN, SMLNUM
168 * .. External Functions ..
169 DOUBLE PRECISION DLAMCH
172 * .. External Subroutines ..
175 * .. Intrinsic Functions ..
176 INTRINSIC ABS, DBLE, DIMAG, MAX, MIN
178 * .. Statement Functions ..
179 DOUBLE PRECISION CABS1
181 * .. Statement Function definitions ..
182 CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
184 * .. Executable Statements ..
186 * Test the input parameters.
191 ELSE IF( N.LT.0 ) THEN
193 ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
197 CALL XERBLA( 'ZGEEQU', -INFO )
201 * Quick return if possible
203 IF( M.EQ.0 .OR. N.EQ.0 ) THEN
210 * Get machine constants.
212 SMLNUM = DLAMCH( 'S' )
213 BIGNUM = ONE / SMLNUM
215 * Compute row scale factors.
221 * Find the maximum element in each row.
225 R( I ) = MAX( R( I ), CABS1( A( I, J ) ) )
229 * Find the maximum and minimum scale factors.
234 RCMAX = MAX( RCMAX, R( I ) )
235 RCMIN = MIN( RCMIN, R( I ) )
239 IF( RCMIN.EQ.ZERO ) THEN
241 * Find the first zero scale factor and return an error code.
244 IF( R( I ).EQ.ZERO ) THEN
251 * Invert the scale factors.
254 R( I ) = ONE / MIN( MAX( R( I ), SMLNUM ), BIGNUM )
257 * Compute ROWCND = min(R(I)) / max(R(I))
259 ROWCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM )
262 * Compute column scale factors
268 * Find the maximum element in each column,
269 * assuming the row scaling computed above.
273 C( J ) = MAX( C( J ), CABS1( A( I, J ) )*R( I ) )
277 * Find the maximum and minimum scale factors.
282 RCMIN = MIN( RCMIN, C( J ) )
283 RCMAX = MAX( RCMAX, C( J ) )
286 IF( RCMIN.EQ.ZERO ) THEN
288 * Find the first zero scale factor and return an error code.
291 IF( C( J ).EQ.ZERO ) THEN
298 * Invert the scale factors.
301 C( J ) = ONE / MIN( MAX( C( J ), SMLNUM ), BIGNUM )
304 * Compute COLCND = min(C(J)) / max(C(J))
306 COLCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM )