NAME chidi - compute the determinant, inertia, and inverse of a Hermitian matrix A, which has been UDU-factored by xHICO or xHIFA. SYNOPSIS SUBROUTINE ZHIDI (ZA, LDA, N, IPIVOT, DDET, INERT, ZWORK, JOB) SUBROUTINE CHIDI (CA, LDA, N, IPIVOT, SDET, INERT, CWORK, JOB) #include <sunperf.h> void zhidi(doublecomplex *za, int lda, int n, int *ipivot, double *det, int *inert, int job) ; void chidi(complex *ca, int lda, int n, int *ipivot, float *det, int *inert, int job) ; ARGUMENTS xA On entry, the UDU factorization of the matrix A, as computed by xHICO or xHIFA. On exit, if the c digit of JOB <> 0, then the upper triangle of A contains the upper triangle of the inverse of the original matrix A if the inverse was requested, otherwise unchanged. The strict lower triangle of A is not referenced. LDA Leading dimension of the array A as specified in a dimension or type statement. LDA >= max(1,N). N Order of the original matrix A. N >= 0. IPIVOT Pivot vector as computed by xHICO or xHIFA. 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 the subroutine 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, LDA, N PARAMETER (IDODET = 10) PARAMETER (IDOINR = 100) PARAMETER (IDOINV = 1) PARAMETER (N = 3) PARAMETER (LDA = 3) C REAL DET(2), RCOND COMPLEX A(LDA,N), WORK(N) INTEGER ICOL, INERT(3), IPIVOT(N), IROW, JOB C EXTERNAL CHICO, CHIDI 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), (8E8,8E8), (8E8,8E8), $ (1.0,-2.0), (6.0,0.0), (8E8,8E8), $ (1.0,-2.0), (6.0,-2.0), (11.0,0.0) / C PRINT 1000 DO 100, IROW = 1, N PRINT 1010, (CONJG(A(ICOL,IROW)), ICOL = 1, IROW), $ (A(IROW,ICOL), ICOL = IROW + 1, N) 100 CONTINUE PRINT 1020 DO 110, IROW = 1, N PRINT 1010, (A(IROW,ICOL), ICOL = 1, N) 110 CONTINUE CALL CHICO (A, LDA, N, IPIVOT, RCOND, WORK) PRINT 1030, RCOND IF ((RCOND + 1.0) .EQ. 1.0) THEN PRINT 1040 END IF JOB = IDOINR + IDODET + IDOINV CALL CHIDI (A, LDA, N, IPIVOT, DET, INERT, WORK, JOB) PRINT 1050, DET(1) * (10.0D0 ** DET(2)) PRINT 1060, INERT PRINT 1070 DO 120, IROW = 1, N PRINT 1010, (CONJG(A(ICOL,IROW)), ICOL = 1, IROW), $ (A(IROW,ICOL), ICOL = IROW + 1, N) 120 CONTINUE C 1000 FORMAT (1X, 'A in full form:') 1010 FORMAT (4(: 3X, '(', F5.1, ',', F5.1, ')')) 1020 FORMAT (/1X, 'A in Hermitian form: (* in unused elements)') 1030 FORMAT (/1X, 'Reciprocal condition number of A:', F6.3) 1040 FORMAT (1X, 'A may be singular to working precision.') 1050 FORMAT (/1X, 'Determinant of A: ', F6.3) 1060 FORMAT (1X, 'Inertia of A: <', I1, ',', I1, ',', I1, '>') 1070 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) A in Hermitian form: (* in unused elements) ( 1.0, 0.0) ( 1.0, -2.0) ( 1.0, -2.0) (*****,*****) ( 6.0, 0.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 Добавить, Поддержать, Вебмастеру |