nag_dpoequ (f07ffc) (PDF version)
f07 Chapter Contents
f07 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_dpoequ (f07ffc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_dpoequ (f07ffc) computes a diagonal scaling matrix S  intended to equilibrate a real n  by n  symmetric positive definite matrix A  and reduce its condition number.

2  Specification

#include <nag.h>
#include <nagf07.h>
void  nag_dpoequ (Nag_OrderType order, Integer n, const double a[], Integer pda, double s[], double *scond, double *amax, NagError *fail)

3  Description

nag_dpoequ (f07ffc) computes a diagonal scaling matrix S  chosen so that
sj=1 / ajj .
This means that the matrix B  given by
B=SAS ,
has diagonal elements equal to unity. This in turn means that the condition number of B , κ2B , is within a factor n  of the matrix of smallest possible condition number over all possible choices of diagonal scalings (see Corollary 7.6 of Higham (2002)).

4  References

Higham N J (2002) Accuracy and Stability of Numerical Algorithms (2nd Edition) SIAM, Philadelphia

5  Arguments

1:     orderNag_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 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2:     nIntegerInput
On entry: n, the order of the matrix A.
Constraint: n0.
3:     a[dim]const doubleInput
Note: the dimension, dim, of the array a must be at least max1,pda×n.
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. Only the diagonal elements of the array a are referenced.
4:     pdaIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraint: pdamax1,n.
5:     s[n]doubleOutput
On exit: if fail.code= NE_NOERROR, s contains the diagonal elements of the scaling matrix S.
6:     sconddouble *Output
On exit: if fail.code= NE_NOERROR, scond contains the ratio of the smallest value of s to the largest value of s. If scond0.1 and amax is neither too large nor too small, it is not worth scaling by S.
7:     amaxdouble *Output
On exit: maxaij. If amax is very close to overflow or underflow, the matrix A should be scaled.
8:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, n=value.
Constraint: n0.
On entry, pda=value.
Constraint: pda>0.
NE_INT_2
On entry, pda=value and n=value.
Constraint: pdamax1,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.
NE_MAT_NOT_POS_DEF
The valueth diagonal element of A is not positive (and hence A cannot be positive definite).

7  Accuracy

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

8  Further Comments

The complex analogue of this function is nag_zpoequ (f07ftc).

9  Example

This example equilibrates the symmetric positive definite matrix A  given by
A = -4.16 -3.12×105 -0.56 -0.10 -3.12×105 -5.03×1010 -0.83×105 -1.18×105 -0.56 -0.83×105 -0.76 -0.34 -0.10 -1.18×105 -0.34 -1.18 .
Details of the scaling factors and the scaled matrix are output.

9.1  Program Text

Program Text (f07ffce.c)

9.2  Program Data

Program Data (f07ffce.d)

9.3  Program Results

Program Results (f07ffce.r)


nag_dpoequ (f07ffc) (PDF version)
f07 Chapter Contents
f07 Chapter Introduction
NAG C Library Manual

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