NAME sppdi - compute the determinant and inverse of a symmetric positive definite matrix A in packed storage, which has been Cholesky-factored by xPPCO or xPPFA. SYNOPSIS SUBROUTINE DPPDI (DA, N, DDET, JOB) SUBROUTINE SPPDI (SA, N, SDET, JOB) SUBROUTINE ZPPDI (ZA, N, DDET, JOB) SUBROUTINE CPPDI (CA, N, SDET, JOB) #include <sunperf.h> void dppdi(double *dap, int n, double *det, int job); void sppdi(float *sap, int n, float *det, int job); void zppdi(doublecomplex *zap, int n, double *det, int job); void cppdi(complex *cap, int n, float *det, int job); ARGUMENTS xA On entry, the Cholesky factorization of the matrix A, as computed by xPPCO or xPPFA. On exit, the inverse of the original matrix A if the inverse was requested, otherwise A is unchanged. The strict lower triangle of A is not referenced. N Order of the original matrix A. N >= 0. xDET On exit, the determinant of the matrix A. The determinant is stored as b * (10 ** expon) where b is stored in DET(1) and expon is stored in DET(2). 1.0 <= |DET(1)| <= 10.0 or DET(1) = 0.0. JOB Determines which operation the subroutine will perform: 11 both determinant and inverse 01 inverse only 10 determinant only SAMPLE PROGRAM PROGRAM TEST IMPLICIT NONE C INTEGER INVDET, LENGTA, N PARAMETER (INVDET = 11) PARAMETER (N = 4) PARAMETER (LENGTA = (N * N + N) / 2) C DOUBLE PRECISION A(LENGTA), DET(2) INTEGER INFO, JOB C EXTERNAL DPPFA, DPPDI C C Initialize the array A to store in packed symmetric storage C mode the matrix A shown below. Initialize the array B to store C the vector B shown below. C C 4 3 2 1 C A = 3 4 3 2 C 2 3 4 3 C 1 2 3 4 C DATA A / 4.0D0, 3.0D0, 4.0D0, 2.0D0, 3.0D0, 4.0D0, $ 1.0D0, 2.0D0, 3.0D0, 4.0D0 / 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) CALL DPPFA (A, N, INFO) IF (INFO .EQ. 0) THEN JOB = INVDET CALL DPPDI (A, N, DET, JOB) PRINT 1020, DET(1) * (1.0D1 ** DET(2)) PRINT 1030 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) ELSE PRINT 1040 END IF C 1000 FORMAT (1X, 'A in full form:') 1010 FORMAT (4(3X, F5.1)) 1020 FORMAT (/1X, 'Determinant of A is ', F4.1) 1030 FORMAT (/1X, 'A**(-1):') 1040 FORMAT (/1X, 'A is too ill-conditioned.') C END SAMPLE OUTPUT A in full form: 4.0 3.0 2.0 1.0 3.0 4.0 3.0 2.0 2.0 3.0 4.0 3.0 1.0 2.0 3.0 4.0 Determinant of A is 20.0 A**(-1): 0.6 -0.5 0.0 0.1 -0.5 1.0 -0.5 0.0 0.0 -0.5 1.0 -0.5 0.1 0.0 -0.5 0.6
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |