LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ zgeequ()

subroutine zgeequ ( 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 )

ZGEEQU

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

Purpose:
!>
!> ZGEEQU 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 absolute value 1.
!>
!> R(i) and C(j) are restricted to be 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.
!> 
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
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 136 of file zgeequ.f.

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