NAG CL Interface
f07afc (dgeequ)

Settings help

CL Name Style:


1 Purpose

f07afc computes diagonal scaling matrices DR and DC intended to equilibrate a real m × n matrix A and reduce its condition number.

2 Specification

#include <nag.h>
void  f07afc (Nag_OrderType order, Integer m, Integer n, const double a[], Integer pda, double r[], double c[], double *rowcnd, double *colcnd, double *amax, NagError *fail)
The function may be called by the names: f07afc, nag_lapacklin_dgeequ or nag_dgeequ.

3 Description

f07afc 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
B=DRADC  
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 X02AMC. Use of these scaling factors is not guaranteed to reduce the condition number of A but works well in practice.

4 References

None.

5 Arguments

1: order Nag_OrderType Input
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 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2: m Integer Input
On entry: m, the number of rows of the matrix A.
Constraint: m0.
3: n Integer Input
On entry: n, the number of columns of the matrix A.
Constraint: n0.
4: a[dim] const double Input
Note: the dimension, dim, of the array a must be at least
  • max(1,pda×n) when order=Nag_ColMajor;
  • max(1,m×pda) when order=Nag_RowMajor.
The (i,j)th 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 Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraints:
  • if order=Nag_ColMajor, pdamax(1,m);
  • if order=Nag_RowMajor, pdamax(1,n).
6: r[m] double Output
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] double Output
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: max|aij|. 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 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, m=value.
Constraint: m0.
On entry, n=value.
Constraint: n0.
On entry, pda=value.
Constraint: pda>0.
NE_INT_2
On entry, pda=value and m=value.
Constraint: pdamax(1,m).
On entry, pda=value and n=value.
Constraint: pdamax(1,n).
NE_INTERNAL_ERROR
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 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_MAT_COL_ZERO
Column value of A is exactly zero.
NE_MAT_ROW_ZERO
Row value of A is exactly zero.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

7 Accuracy

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

8 Parallelism and Performance

f07afc is not threaded in any implementation.

9 Further Comments

The complex analogue of this function is f07atc.

10 Example

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.

10.1 Program Text

Program Text (f07afce.c)

10.2 Program Data

Program Data (f07afce.d)

10.3 Program Results

Program Results (f07afce.r)