NAME chpdi - compute the determinant, inertia, and inverse of a Hermitian matrix A in packed storage, which has been UDU- factored by xHPCO or xHPFA. SYNOPSIS SUBROUTINE ZHPDI (ZA, N, IPIVOT, DDET, INERT, ZWORK, JOB) SUBROUTINE CHPDI (CA, N, IPIVOT, SDET, INERT, CWORK, JOB) #include <sunperf.h> void zhpdi(doublecomplex *za, int n, int *ipivot, double *det, int *inert, int job) ; void chpdi(complex *ca, int n, int *ipivot, float *det, int *inert, int job) ; ARGUMENTS xA On entry, the UDU factorization of the matrix, as computed by xHPCO or xHPFA. On exit, if the c digit of JOB <> 0, then A contains the upper tri- angle of the inverse of the original matrix A; otherwise unchanged. N Order of the original matrix A. N >= 0. IPIVOT Pivot vector as computed by xHPCO or xHPFA. xDET On exit, if the b digit of JOB <> 0, then DET con- tains the determinant of the matrix A. The deter- minant 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. If the b digit of JOB = 0, DET is not referenced. INERT On exit, if the a digit of JOB <> 0, then INERT contains an integer triplet where: INERT(1) = number of positive eigenvalues INERT(2) = number of negative eigenvalues INERT(3) = number of zero eigenvalues If the a digit of JOB = 0 then INERT is not refer- enced. xWORK Scratch array with a dimension of N. JOB Integer in the form abc; determines operation sub- routine will perform: a <> 0 Compute the inertia. b <> 0 Compute the determinant. c <> 0 Compute the inverse. SAMPLE PROGRAM PROGRAM TEST IMPLICIT NONE C INTEGER IDODET, IDOINR, IDOINV, LENGTA, N PARAMETER (IDODET = 10) PARAMETER (IDOINR = 100) PARAMETER (IDOINV = 1) PARAMETER (N = 3) PARAMETER (LENGTA = (N * N + N) / 2) C REAL DET(2), RCOND COMPLEX A(LENGTA), WORK(N) INTEGER INERT(3), IPIVOT(N), JOB C EXTERNAL CHPCO, CHPDI C C Initialize the array A to store the matrix A shown below. C C 1 1+2i 1+2i C A = 1+2i 6 -2+6i C 1+2i -2+6i 11 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) / 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) CALL CHPCO (A, N, IPIVOT, RCOND, WORK) PRINT 1020, RCOND IF ((RCOND + 1.0) .EQ. 1.0) THEN PRINT 1030 END IF JOB = IDOINR + IDODET + IDOINV CALL CHPDI (A, N, IPIVOT, DET, INERT, WORK, JOB) PRINT 1040, DET(1) * (10.0D0 ** DET(2)) PRINT 1050, INERT PRINT 1060 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) C 1000 FORMAT (1X, 'A in full form:') 1010 FORMAT (4(: 3X, '(', F5.1, ',', F5.1, ')')) 1020 FORMAT (/1X, 'Reciprocal condition number of A:', F6.3) 1030 FORMAT (1X, 'A may be singular to working precision.') 1040 FORMAT (/1X, 'Determinant of A: ', F6.3) 1050 FORMAT (1X, 'Inertia of A: <', I1, ',', I1, ',', I1, '>') 1060 FORMAT (/1X, 'A**(-1):') 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) Reciprocal condition number of A: 0.001 Determinant of A: 0.008 Inertia of A: <3,0,0> A**(-1): ( 26.0, 0.0) ( -1.0, 12.0) ( -4.0, -2.0) ( -1.0,-12.0) ( 6.0, 0.0) ( -1.0, 2.0) ( -4.0, 2.0) ( -1.0, -2.0) ( 1.0, 0.0)
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |