Previous Next Contents Generated Index Doc Set Home



UDU Factorization of a Hermitian Matrix in Packed Storage

The subroutines described in this section compute the UDU factorization of a Hermitian matrix A in packed storage. It is typical to follow a call to xHPFA with a call to xHPSL to solve Ax = b or to xHPDI to compute the determinant, inverse, and inertia of A.

Calling Sequence

CALL ZHPFA 
(ZA, N, IPIVOT, INFO)
CALL CHPFA 
(CA, N, IPIVOT, INFO)






void zhpfa 
(doublecomplex *za, int n, int *ipivot, int *info)
void chpfa 
(complex *ca, int n, int *ipivot, int *info)

Arguments

xA

On entry, the upper triangle of the matrix A.
On exit, a UDU factorization of the matrix A.

N

Order of the matrix A. N 0.

IPIVOT

On exit, a vector of pivot indices.

INFO

On exit:

INFO = 0

Subroutine completed normally.

INFO > 0

Returns a value k if the kth pivot block is singular to indicate that xHPSL or xHPDI will divide by zero if called.

Sample Program

 
      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER    LENGTA, N
      PARAMETER (N = 3)
      PARAMETER (LENGTA = (N * N + N) / 2)
C
      COMPLEX    A(LENGTA), B(N)
      INTEGER    INFO, IPIVOT(N)
C
      EXTERNAL   CHPFA, CHPSL
      INTRINSIC  CONJG
C
C     Initialize the array A to store the matrix A shown below.
C     Initialize the array B to store the vector b shown below.
C
C          1    1+2i  1+2i         95-180i
C     A = 1+2i   6   -2+6i    b = 545-118i
C         1+2i -2+6i   11         865+ 62i
C
      DATA A / (1.0,0.0), (1.0,-2.0), (6.0,0.0),
     $         (1.0,-2.0), (6.0,-2.0), (11.0,0.0) /
      DATA B / (95.0,-180.0), (545.0,-118.0), (865.0,62.0) /
C
      PRINT 1000
      PRINT 1010, A(1), A(2), A(4)
      PRINT 1010, CONJG(A(2)), A(3), A(5)
      PRINT 1010, CONJG(A(4)), CONJG(A(5)), A(6)
      PRINT 1020
      PRINT 1030, B
      CALL CHPFA (A, N, IPIVOT, INFO)
      IF (INFO .EQ. 0) THEN
        CALL CHPSL (A, N, IPIVOT, B)
        PRINT 1040
        PRINT 1030, B
      ELSE
        PRINT 1050
      END IF
C
 1000 FORMAT (1X, 'A in full form:')
 1010 FORMAT (4(: 3X, '(', F4.1, ',', F4.1, ')'))
 1020 FORMAT (/1X, 'b:')
 1030 FORMAT (3X, '(', F6.1, ',', F6.1, ')')
 1040 FORMAT (/1X, 'A**(-1) * b:')
 1050 FORMAT (1X, 'A is singular to working precision.')
C
      END
 

Sample Output

 
 A in full form:
   ( 1.0, 0.0)   ( 1.0,-2.0)   ( 1.0,-2.0)
   ( 1.0, 2.0)   ( 6.0, 0.0)   ( 6.0,-2.0)
   ( 1.0, 2.0)   ( 6.0, 2.0)   (11.0, 0.0)



 b:
   (  95.0,-180.0)
   ( 545.0,-118.0)
   ( 865.0,  62.0)



 A**(-1) * b:
   (   5.0,   0.0)
   (  26.0,   0.0)
   (  64.0,   0.0)






Previous Next Contents Generated Index Doc Set Home