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
SUBROUTINE DSPFA (DA, N, IPIVOT, INFO)
SUBROUTINE SSPFA (SA, N, IPIVOT, INFO)
SUBROUTINE ZSPFA (ZA, N, IPIVOT, INFO)
SUBROUTINE CSPFA (CA, N, IPIVOT, INFO)
#include <sunperf.h>
void dspfa(double *dap, int n, int *kpvt, int *info);
void sspfa(float *sap, int n, int *kpvt, int *info);
void zspfa(doublecomplex *zap, int n, int *kpvt, int *info);
void cspfa(complex *cap, int n, int *kpvt, 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 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
|
Закладки на сайте Проследить за страницей |
Created 1996-2025 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |