NAG Library Routine Document

f07gff (dppequ)


f07gff (dppequ) computes a diagonal scaling matrix S  intended to equilibrate a real n  by n  symmetric positive definite matrix A , stored in packed format, and reduce its condition number.


Fortran Interface
Subroutine f07gff ( uplo, n, ap, s, scond, amax, info)
Integer, Intent (In):: n
Integer, Intent (Out):: info
Real (Kind=nag_wp), Intent (In):: ap(*)
Real (Kind=nag_wp), Intent (Out):: s(n), scond, amax
Character (1), Intent (In):: uplo
C Header Interface
#include <nagmk26.h>
void  f07gff_ (const char *uplo, const Integer *n, const double ap[], double s[], double *scond, double *amax, Integer *info, const Charlen length_uplo)
The routine may be called by its LAPACK name dppequ.


f07gff (dppequ) 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)).


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


1:     uplo – Character(1)Input
On entry: indicates whether the upper or lower triangular part of A is stored in the array ap, as follows:
The upper triangle of A is stored.
The lower triangle of A is stored.
Constraint: uplo='U' or 'L'.
2:     n – IntegerInput
On entry: n, the order of the matrix A.
Constraint: n0.
3:     ap* – Real (Kind=nag_wp) arrayInput
Note: the dimension of the array ap must be at least max1,n×n+1/2.
On entry: the n by n symmetric matrix A, packed by columns.
More precisely,
  • if uplo='U', the upper triangle of A must be stored with element Aij in api+jj-1/2 for ij;
  • if uplo='L', the lower triangle of A must be stored with element Aij in api+2n-jj-1/2 for ij.
Only the elements of ap corresponding to the diagonal elements A are referenced.
4:     sn – Real (Kind=nag_wp) arrayOutput
On exit: if info=0, s contains the diagonal elements of the scaling matrix S.
5:     scond – Real (Kind=nag_wp)Output
On exit: 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.
6:     amax – Real (Kind=nag_wp)Output
On exit: maxaij. If amax is very close to overflow or underflow, the matrix A should be scaled.
7:     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.
The valueth diagonal element of A is not positive (and hence A cannot be positive definite).


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

Parallelism and Performance

f07gff (dppequ) is not threaded in any implementation.

Further Comments

The complex analogue of this routine is f07gtf (zppequ).


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.

Program Text

Program Text (f07gffe.f90)

Program Data

Program Data (f07gffe.d)

Program Results

Program Results (f07gffe.r)