 LAPACK  3.10.0 LAPACK: Linear Algebra PACKage

◆ zgeequb()

 subroutine zgeequb ( integer M, integer N, complex*16, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) R, double precision, dimension( * ) C, double precision ROWCND, double precision COLCND, double precision AMAX, integer INFO )

ZGEEQUB

Purpose:
ZGEEQUB 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

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 ZGEEQU 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
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] A A is COMPLEX*16 array, dimension (LDA,N) The M-by-N matrix whose equilibration factors are to be computed. [in] LDA LDA is INTEGER The leading dimension of the array A. LDA >= 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

Definition at line 145 of file zgeequb.f.

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