NAG C Library Function Document

nag_zgeequ (f07atc)


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


#include <nag.h>
#include <nagf07.h>
void  nag_zgeequ (Nag_OrderType order, Integer m, Integer n, const Complex a[], Integer pda, double r[], double c[], double *rowcnd, double *colcnd, double *amax, NagError *fail)


nag_zgeequ (f07atc) 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 function nag_real_safe_small_number (X02AMC). Use of these scaling factors is not guaranteed to reduce the condition number of A  but works well in practice.




1:     order Nag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section in How to Use the NAG Library and its Documentation for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2:     m IntegerInput
On entry: m, the number of rows of the matrix A.
Constraint: m0.
3:     n IntegerInput
On entry: n, the number of columns of the matrix A.
Constraint: n0.
4:     a[dim] const ComplexInput
Note: the dimension, dim, of the array a must be at least
  • max1,pda×n when order=Nag_ColMajor;
  • max1,m×pda when order=Nag_RowMajor.
The i,jth element of the matrix A is stored in
  • a[j-1×pda+i-1] when order=Nag_ColMajor;
  • a[i-1×pda+j-1] when order=Nag_RowMajor.
On entry: the matrix A whose scaling factors are to be computed.
5:     pda IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
  • if order=Nag_ColMajor, pdamax1,m;
  • if order=Nag_RowMajor, pdamax1,n.
6:     r[m] doubleOutput
On exit: if fail.code= NE_NOERROR or fail.code= NE_MAT_COL_ZERO, r contains the row scale factors, the diagonal elements of DR. The elements of r will be positive.
7:     c[n] doubleOutput
On exit: if fail.code= NE_NOERROR, c contains the column scale factors, the diagonal elements of DC. The elements of c will be positive.
8:     rowcnd double *Output
On exit: if fail.code= NE_NOERROR or fail.code= NE_MAT_COL_ZERO, rowcnd contains the ratio of the smallest value of r[i-1] to the largest value of r[i-1]. If rowcnd0.1 and amax is neither too large nor too small, it is not worth scaling by DR.
9:     colcnd double *Output
On exit: if fail.code= NE_NOERROR, colcnd contains the ratio of the smallest value of c[i-1] to the largest value of c[i-1].
If colcnd0.1, it is not worth scaling by DC.
10:   amax double *Output
On exit: maxaij. If amax is very close to overflow or underflow, the matrix A should be scaled.
11:   fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

Error Indicators and Warnings

Dynamic memory allocation failed.
See Section in How to Use the NAG Library and its Documentation for further information.
On entry, argument value had an illegal value.
On entry, m=value.
Constraint: m0.
On entry, n=value.
Constraint: n0.
On entry, pda=value.
Constraint: pda>0.
On entry, pda=value and m=value.
Constraint: pdamax1,m.
On entry, pda=value and n=value.
Constraint: pdamax1,n.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
Column value of A is exactly zero.
Row value of A is exactly zero.
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.


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

Parallelism and Performance

nag_zgeequ (f07atc) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the x06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

Further Comments

The real analogue of this function is nag_dgeequ (f07afc).


This example equilibrates the general matrix A  given by
A = -1.34+2.55i (0.28+3.17i×1010 ((-6.39-2.20i -1.70-1.41i (3.31-0.15i×1010 ((-0.15+1.34i (2.41+0.39i×10-10 -0.56+1.47i (-0.83-0.69i×10-10 .  
Details of the scaling factors, and the scaled matrix are output.

Program Text

Program Text (f07atce.c)

Program Data

Program Data (f07atce.d)

Program Results

Program Results (f07atce.r)