NAME dsidi - compute the determinant, inertia, and inverse of a symmetric matrix A, which has been UDU-factored by xSICO or xSIFA. SYNOPSIS SUBROUTINE DSIDI (DA, LDA, N, IPIVOT, DDET, INERT, DWORK, JOB) SUBROUTINE SSIDI (SA, LDA, N, IPIVOT, SDET, INERT, SWORK, JOB) SUBROUTINE ZSIDI (ZA, LDA, N, IPIVOT, ZDET, ZWORK, JOB) SUBROUTINE CSIDI (CA, LDA, N, IPIVOT, CDET, CWORK, JOB) #include <sunperf.h> void dsidi(double *da, int lda, int n, int *kpvt, double *det, int *inert, int job) ; void ssidi(float *sa, int lda, int n, int *kpvt, float *det, int *inert, int job) ; void zsidi(doublecomplex *za, int lda, int n, int *kpvt, doublecomplex *det, int job) ; void csidi(complex *ca, int lda, int n, int *kpvt, complex *det, int job) ; ARGUMENTS xA On entry, the UDU factorization of the matrix A, as computed by xSICO or xSIFA. 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 x SICO or xSIFA. 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 for real subroutines or bc for complex subroutines; determines operation the subroutine will perform: a <> 0 Compute the inertia. b <> 0 Compute the determinant. c <> 0 Compute the inverse. Note that the inverse should not be computed if xSICO has set RCOND = 0 or if xSIFA has set INFO >= 0. SAMPLE PROGRAM PROGRAM TEST IMPLICIT NONE C INTEGER IDODET, IDOINR, IDOINV, LDA, N PARAMETER (IDODET = 10) PARAMETER (IDOINR = 100) PARAMETER (IDOINV = 1) PARAMETER (N = 4) PARAMETER (LDA = N) C DOUBLE PRECISION A(LDA,N), DET(2), WORK(N) INTEGER ICOL, INERT(3), INFO, IPIVOT(N), IROW, JOB C EXTERNAL DSIFA, DSIDI C C Initialize the array A to store the matrix A shown below. C C -.5 -.5 -.5 -.5 C A = -.5 -1.5 -1.5 -1.5 C -.5 -1.5 -2.5 -2.5 C -.5 -1.5 -2.5 -3.5 C DATA A / -5.0D-1, 3*8D8, -5.0D-1, -1.5D0, 2*8D8, -5.0D-1, $ -1.5D0, -2.5D0, 8D8, -5.0D-1, -1.5D0, -2.5D0, -3.5D0 / C PRINT 1000 DO 100, IROW = 1, N PRINT 1010, (A(ICOL,IROW), ICOL = 1, IROW), $ (A(IROW,ICOL), ICOL = IROW + 1, N) 100 CONTINUE PRINT 1020 PRINT 1010, ((A(IROW,ICOL), ICOL = 1, N), IROW = 1, N) CALL DSIFA (A, LDA, N, IPIVOT, INFO) IF (INFO .EQ. 0) THEN JOB = IDOINR + IDODET + IDOINV CALL DSIDI (A, LDA, N, IPIVOT, DET, INERT, WORK, JOB) PRINT 1030, DET(1) * (10.0D0 ** DET(2)) PRINT 1040, INERT PRINT 1050 DO 110, IROW = 1, N PRINT 1010, (A(ICOL,IROW), ICOL = 1, IROW), $ (A(IROW,ICOL), ICOL = IROW + 1, N) 110 CONTINUE ELSE PRINT 1060 END IF C 1000 FORMAT (1X, 'A in full form:') 1010 FORMAT (4(3X, F5.1)) 1020 FORMAT (/1X, 'A in symmetric form: (* in unused elements)') 1030 FORMAT (/1X, 'Determinant of A: ', F6.3) 1040 FORMAT (1X, 'Inertia of A: <', I1, ',', I1, ',', I1, '>') 1050 FORMAT (/1X, 'A**(-1):') 1060 FORMAT (/1X, 'A is too poorly conditioned.') C END SAMPLE OUTPUT A in full form: -0.5 -0.5 -0.5 -0.5 -0.5 -1.5 -1.5 -1.5 -0.5 -1.5 -2.5 -2.5 -0.5 -1.5 -2.5 -3.5 A in symmetric form: (* in unused elements) -0.5 -0.5 -0.5 -0.5 ***** -1.5 -1.5 -1.5 ***** ***** -2.5 -2.5 ***** ***** ***** -3.5 Determinant of A: 0.500 Inertia of A: <0,4,0> A**(-1): -3.0 1.0 0.0 0.0 1.0 -2.0 1.0 0.0 0.0 1.0 -2.0 1.0 0.0 0.0 1.0 -1.0
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |