Previous Next Contents Generated Index Doc Set Home



Equilibration Scale Factors for a Symmetric Positive Definite Matrix in Packed Storage

The subroutines described in this section compute equilibration scale factors for a real symmetric (or Hermitian) positive definite matrix A in packed storage. Equilibration is intended to reduce the condition number of A with respect to the 2-norm. SCALE contains scale factors chosen so that the scaled matrix B with elements B(i,j) = SCALE(i) × A(i,j) × SCALE(j) has ones on the diagonal. This choice of SCALE puts the condition number of B within a factor N of the smallest possible condition number over all possible diagonal scalings. Note that these subroutines only compute the scale factors for A. Additional code must be written to actually equilibrate A.

Calling Sequence

CALL DPPEQU 
(UPLO, N, DA, DSCALE, DSCOND, DAMAX, INFO)
CALL SPPEQU 
(UPLO, N, SA, SSCALE, SSCOND, SAMAX, INFO)
CALL ZPPEQU 
(UPLO, N, ZA, DSCALE, DSCOND, DAMAX, INFO)
CALL CPPEQU 
(UPLO, N, CA, SSCALE, SSCOND, SAMAX, INFO)






void dppequ 
(char uplo, int n, double *da, double *dscale, double 
*scond, double *damax, int *info)
void sppequ 
(char uplo, int n, float *sa, float *sscale, float 
*scond, float *samax, int *info)
void zppequ 
(char uplo, int n, doublecomplex *za, double *dscale, 
double *scond, double *damax, int *info)
void cppequ 
(char uplo, int n, complex *ca, float *sscale, float 
*scond, float *samax, int *info)

Arguments

UPLO

Indicates whether xA contains the upper or lower triangle of the matrix. The legal values for UPLO are listed below. Any values not listed below are illegal.

'U' or 'u'

xA contains the upper triangle.

'L' or 'l'

xA contains the lower triangle.

N

Order of the matrix A. N 0.

xA

Upper or lower triangle of the matrix A.
The dimension of xA is (N × N + N) / 2.

xSCALE

On exit, the N scale factors for A.

xSCOND

On exit, the ratio of the smallest SCALE(i) to the largest SCALE(i). If SCOND 0.1 and AMAX is not close to overflow or underflow, it is not worth scaling by SCALE.

xAMAX

On exit, the absolute value of the largest element of A. If AMAX is very close to overflow or underflow, A should be scaled regardless of the value of SCOND.

INFO

On exit:

INFO = 0

Subroutine completed normally.

INFO < 0

The ith argument, where i = |INFO|, had an illegal value.

INFO > 0

The ith diagonal entry, where i = INFO, is non-positive.

Sample Program




      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           LDA, LDSCAL, N
      PARAMETER        (N = 4)
      PARAMETER        (LDA = (N * (N + 1)) / 2)
      PARAMETER        (LDSCAL = N)
C
      DOUBLE PRECISION  A(LDA), AMAX, SCALE(N), SCOND
      INTEGER           ICOL, INFO, IROW
C
      EXTERNAL          DPPEQU
      INTRINSIC         ABS
C
C     Initialize the array A to store in symmetric form the upper
C     triangle of the 4x4 symmetric positive definite matrix A
C     shown below.
C
C         4096    -2    0    0
C     A =   -2   256   -2    0
C            0    -2   16   -2
C            0     0   -2    1
C
      DATA A /  4.096D3, -2.0D0, 2.56D2, 0.0D0, -2.0D0, 1.6D1,
     $          0.0D0, 0.0D0, -2.0D0, 1.0D0 /
C
C     Print the initial values of the arrays.
C
      PRINT 1000
      PRINT 1010, A(1), A(2), A(4), A(7)
      PRINT 1010, A(2), A(3), A(5), A(8)
      PRINT 1010, A(4), A(5), A(6), A(9)
      PRINT 1010, A(7), A(8), A(9), A(10)
C
C     Compute the scale factors to use to equilibrate A.
C
      CALL DPPEQU ('UPPER TRIANGLE OF A STORED', N, A, SCALE,
     $             SCOND, AMAX, INFO)
      IF (INFO .NE. 0) THEN
        PRINT 1030, INFO
        STOP 1
      END IF
C
C     Apply the scale factors to A then print the result.
C
      DO 210, ICOL = 1, N
        DO 200, IROW = 1, ICOL
          A(IROW + (ICOL - 1) * ICOL / 2) =
     $       A(IROW + (ICOL - 1) * ICOL / 2) * SCALE(IROW) *
     $       SCALE(ICOL)
  200   CONTINUE
  210 CONTINUE
      PRINT 1040
      PRINT 1050, SCALE
      PRINT 1060
      PRINT 1010, A(1), A(2), A(4), A(7)
      PRINT 1010, A(2), A(3), A(5), A(8)
      PRINT 1010, A(4), A(5), A(6), A(9)
      PRINT 1010, A(7), A(8), A(9), A(10)
C
 1000 FORMAT (1X, 'A:')
 1010 FORMAT (4(3X, F10.5))
 1020 FORMAT (/1X, 'A in symmetric form:  (* in unused elements)')
 1030 FORMAT (1X, 'Error computing scale factors for A, INFO =',
     $        1X, I5)
 1040 FORMAT (/1X, 'Scale factors:')
 1050 FORMAT (3X, F8.6)
 1060 FORMAT (/1X, 'Equilibrated A:')
C
      END
 

Sample Output

 
 A:
   4096.00000     -2.00000      0.00000      0.00000
     -2.00000    256.00000     -2.00000      0.00000
      0.00000     -2.00000     16.00000     -2.00000
      0.00000      0.00000     -2.00000      1.00000



 Scale factors:
   0.015625
   0.062500
   0.250000
   1.000000



 Equilibrated A:
      1.00000     -0.00195      0.00000      0.00000
     -0.00195      1.00000     -0.03125      0.00000
      0.00000     -0.03125      1.00000     -0.50000
      0.00000      0.00000     -0.50000      1.00000






Previous Next Contents Generated Index Doc Set Home