hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_lapack_dpoequ (f07ff)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

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

Syntax

[s, scond, amax, info] = f07ff(a, 'n', n)
[s, scond, amax, info] = nag_lapack_dpoequ(a, 'n', n)

Description

nag_lapack_dpoequ (f07ff) 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)).

References

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

Parameters

Compulsory Input Parameters

1:     alda: – double array
The first dimension of the array a must be at least max1,n.
The second dimension of the array a must be at least max1,n.
The matrix A whose scaling factors are to be computed. Only the diagonal elements of the array a are referenced.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the first dimension of the array a and the second dimension of the array a.
n, the order of the matrix A.
Constraint: n0.

Output Parameters

1:     sn – double array
If info=0, s contains the diagonal elements of the scaling matrix S.
2:     scond – double scalar
If info=0, 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.
3:     amax – double scalar
maxaij. If amax is very close to overflow or underflow, the matrix A should be scaled.
4:     info int64int32nag_int scalar
info=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

   info<0
If info=-i, argument i had an illegal value. An explanatory message is output, and execution of the program is terminated.
   info>0
The _th diagonal element of A is not positive (and hence A cannot be positive definite).

Accuracy

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

Further Comments

The complex analogue of this function is nag_lapack_zpoequ (f07ft).

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.
function f07ff_example


fprintf('f07ff example results\n\n');

% Upper triangular part of symmetric matrix A
a = [ 4.16      -3.12e+05   0.56      -0.10    ;
      0          5.03e+10  -8.30e+04   1.18e+05;
      0          0          0.76       0.34    ;
      0          0          0          1.18    ];

% Scale A
[s, scond, amax, info] = f07ff(a);

fprintf('scond = %8.1e, amax = %8.1e\n\n', scond, amax);
disp('Diagonal scaling factors');
fprintf('%10.1e',s);
fprintf('\n\n');

% Scaled matrix
as = diag(s)*a*diag(s);

[ifail] = x04ca( ...
                 'Upper', 'Non-unit', as, 'Scaled matrix');


f07ff example results

scond =  3.9e-06, amax =  5.0e+10

Diagonal scaling factors
   4.9e-01   4.5e-06   1.1e+00   9.2e-01

 Scaled matrix
             1          2          3          4
 1      1.0000    -0.6821     0.3149    -0.0451
 2                 1.0000    -0.4245     0.4843
 3                            1.0000     0.3590
 4                                       1.0000

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015