NAG Library Routine Document

f07aff (dgeequ)


    1  Purpose
    7  Accuracy


f07aff (dgeequ) computes diagonal scaling matrices DR  and DC  intended to equilibrate a real m  by n  matrix A  and reduce its condition number.


Fortran Interface
Subroutine f07aff ( m, n, a, lda, r, c, rowcnd, colcnd, amax, info)
Integer, Intent (In):: m, n, lda
Integer, Intent (Out):: info
Real (Kind=nag_wp), Intent (In):: a(lda,*)
Real (Kind=nag_wp), Intent (Out):: r(m), c(n), rowcnd, colcnd, amax
C Header Interface
#include nagmk26.h
void  f07aff_ (const Integer *m, const Integer *n, const double a[], const Integer *lda, double r[], double c[], double *rowcnd, double *colcnd, double *amax, Integer *info)
The routine may be called by its LAPACK name dgeequ.


f07aff (dgeequ) computes the diagonal scaling matrices. The diagonal scaling matrices are chosen to try to make the elements of largest absolute value in each row and column of the matrix B  given by
have absolute value 1. The diagonal elements of DR  and DC  are restricted to lie in the safe range δ,1/δ , where δ  is the value returned by routine x02amf. Use of these scaling factors is not guaranteed to reduce the condition number of A  but works well in practice.




1:     m – IntegerInput
On entry: m, the number of rows of the matrix A.
Constraint: m0.
2:     n – IntegerInput
On entry: n, the number of columns of the matrix A.
Constraint: n0.
3:     alda* – Real (Kind=nag_wp) arrayInput
Note: the second dimension of the array a must be at least max1,n.
On entry: the matrix A whose scaling factors are to be computed.
4:     lda – IntegerInput
On entry: the first dimension of the array a as declared in the (sub)program from which f07aff (dgeequ) is called.
Constraint: ldamax1,m.
5:     rm – Real (Kind=nag_wp) arrayOutput
On exit: if info=0 or info>m, r contains the row scale factors, the diagonal elements of DR. The elements of r will be positive.
6:     cn – Real (Kind=nag_wp) arrayOutput
On exit: if info=0, c contains the column scale factors, the diagonal elements of DC. The elements of c will be positive.
7:     rowcnd – Real (Kind=nag_wp)Output
On exit: if info=0 or info>m, rowcnd contains the ratio of the smallest value of ri to the largest value of ri. If rowcnd0.1 and amax is neither too large nor too small, it is not worth scaling by DR.
8:     colcnd – Real (Kind=nag_wp)Output
On exit: if info=0, colcnd contains the ratio of the smallest value of ci to the largest value of ci.
If colcnd0.1, it is not worth scaling by DC.
9:     amax – Real (Kind=nag_wp)Output
On exit: maxaij. If amax is very close to overflow or underflow, the matrix A should be scaled.
10:   info – IntegerOutput
On exit: info=0 unless the routine detects an error (see Section 6).

Error Indicators and Warnings

If info=-i, argument i had an illegal value. An explanatory message is output, and execution of the program is terminated.
Row value of A is exactly zero.
Column value of A is exactly zero.


The computed scale factors will be close to the exact scale factors.

Parallelism and Performance

f07aff (dgeequ) is not threaded in any implementation.

Further Comments

The complex analogue of this routine is f07atf (zgeequ).


This example equilibrates the general matrix A  given by
A = -1.80×1010 -2.88×1010 -2.05 -8.90×109 -5.25 -2.95 -9.50×10-9 -3.80 -1.58 -2.69 -2.90×10-10 -1.04 -1.11 -0.66 -5.90×10-11 -0.80 .  
Details of the scaling factors, and the scaled matrix are output.

Program Text

Program Text (f07affe.f90)

Program Data

Program Data (f07affe.d)

Program Results

Program Results (f07affe.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017