zspfa(3P)
NAME
zspfa - compute the UDU factorization of a symmetric matrix A in packed storage. It is typical to follow a call to xSPFA with a call to xSPSL to solve Ax = b or to xSPDI to compute the determinant, inverse, and inertia of A.
SYNOPSIS
CALL DSPFA (DA, N, IPIVOT, INFO)
CALL SSPFA (SA, N, IPIVOT, INFO)
CALL ZSPFA (ZA, N, IPIVOT, INFO)
CALL CSPFA (CA, N, IPIVOT, INFO)
void dspfa(double ∗dap, long int n, long int ∗kpvt, long int ∗info)
void sspfa(float ∗sap, long int n, long int ∗kpvt, long int ∗info)
void zspfa(doublecomplex ∗zap, long int n, long int ∗kpvt,
long int ∗info)
void cspfa(complex ∗cap, long int n, long int ∗kpvt,
long int ∗info)
ARGUMENTS
xAOn entry, the upper triangle of the matrix A.
On exit, a UDU factorization of the matrix A.
NOrder of the matrix A. N >= 0.
IPIVOTOn exit, a vector of pivot indices.
INFOOn exit:
INFO = 0Subroutine completed normally.
INFO > 0Returns a value k if the kth pivot block is singular to indicate that xSPSL or xSPDI will divide by zero if called.
SAMPLE PROGRAM
PROGRAM TEST
IMPLICIT NONE
C
INTEGER IDODET, IDOINR, IDOINV, JOB, LENGTA, N
PARAMETER (IDODET = 10)
PARAMETER (IDOINR = 100)
PARAMETER (IDOINV = 1)
PARAMETER (JOB = 111)
PARAMETER (N = 3)
PARAMETER (LENGTA = (N ∗ N + N) / 2)
C
DOUBLE PRECISION A(LENGTA), DET(2), WORK(N)
INTEGER INERT(3), INFO, IPIVOT(N)
C
EXTERNAL DSPDI, DSPFA
C
C Initialize the array A to store in packed symmetric format
C the matrix A shown below.
C
C 3 2 1
C A = 2 2 1
C 1 1 1
C
DATA A / 3.0D0, 2.0D0, 2.0D0, 1.0D0, 1.0D0, 1.0D0 /
C
PRINT 1000
PRINT 1010, A(1), A(2), A(4)
PRINT 1010, A(2), A(3), A(5)
PRINT 1010, A(4), A(5), A(6)
CALL DSPFA (A, N, IPIVOT, INFO)
IF (INFO .EQ. 0) THEN
CALL DSPDI (A, N, IPIVOT, DET, INERT, WORK, JOB)
PRINT 1020, DET(1) ∗ (10.0D0 ∗∗ DET(2))
PRINT 1030, INERT
PRINT 1040
PRINT 1010, A(1), A(2), A(4)
PRINT 1010, A(2), A(3), A(5)
PRINT 1010, A(4), A(5), A(6)
ELSE
PRINT 1050
END IF
C
1000 FORMAT (1X, ’A:’)
1010 FORMAT (3(3X, F5.2))
1020 FORMAT (/1X, ’Determinant of A: ’, F7.3)
1030 FORMAT (1X, ’Inertia of A: <’, I1, ’,’, I1, ’,’, I1, ’>’)
1040 FORMAT (/1X, ’A∗∗(-1):’)
1050 FORMAT (1X, ’A is too ill-conditioned.’)
C
END
SAMPLE OUTPUT
A:
3.00 2.00 1.00
2.00 2.00 1.00
1.00 1.00 1.00
Determinant of A: 1.000
Inertia of A: <3,0,0>
A∗∗(-1):
1.00 -1.00 0.00
-1.00 2.00 -1.00
0.00 -1.00 2.00
Sun, Inc. — Last change: 20 Sep 1996