NAME zgedi - compute the determinant and inverse of a general matrix A, which has been LU-factored by xGECO or xGEFA. SYNOPSIS SUBROUTINE DGEDI (DA, LDA, N, IPIVOT, DDET, DWORK, JOB) SUBROUTINE SGEDI (SA, LDA, N, IPIVOT, SDET, SWORK, JOB) SUBROUTINE ZGEDI (ZA, LDA, N, IPIVOT, ZDET, ZWORK, JOB) SUBROUTINE CGEDI (CA, LDA, N, IPIVOT, CDET, CWORK, JOB) #include <sunperf.h> void zgedi(doublecomplex *za, int lda, int n, int *ipivot, doublecomplex *det, int job) ; void dgedi(double *da, int lda, int n, int *ipivot, double *det, int job) ; void sgedi(float *sa, int lda, int n, int *ipivot, float *det, int job) ; void zgedi(doublecomplex *za, int lda, int n, int *ipivot, doublecomplex *det, int job) ; void cgedi(complex *ca, int lda, int n, int *ipivot, complex *det, int job) ; ARGUMENTS xA On entry, the LU factorization of the matrix A, as computed by xGECO or xGEFA. On exit, the inverse of the original matrix A if the inverse was requested, otherwise it is unchanged. 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 xGECO or xGEFA. 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. xWORK Scratch array with a dimension of N. 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, LDA, N PARAMETER (INVDET = 11) PARAMETER (N = 4) PARAMETER (LDA = N) C DOUBLE PRECISION A(LDA,N), DET(2), RCOND, WORK(N) INTEGER ICOL, IPIVOT(N), IROW, JOB C EXTERNAL DGECO, DGEDI C C Initialize the array A to store the matrix A shown below. Its C exact inverse also is shown below. C C -3 1 1 1 1 1 1 C A = 1 -2 1 A**(-1) = - --- * 1 3 3 3 C 1 -2 1 2 1 3 5 5 C 1 -1 1 3 5 7 C DATA A / -3.0D0, 1.0D0, 2*0.0D0, 1.0D0, -2.0D0, 1.0D0, 2*0.0D0, $ 1.0D0, -2.0D0, 1.0D0, 2*0.0D0, 1.0D0, -1.0D0 / C PRINT 1000 PRINT 1010, ((A(IROW,ICOL), ICOL = 1, N), IROW = 1, N) CALL DGECO (A, LDA, N, IPIVOT, RCOND, WORK) JOB = INVDET CALL DGEDI (A, LDA, N, IPIVOT, DET, WORK, JOB) PRINT 1020 PRINT 1010, ((A(IROW,ICOL), ICOL = 1, N), IROW = 1, N) PRINT 1030, DET(1) * (1.0D1 ** DET(2)) C 1000 FORMAT (1X, 'A:') 1010 FORMAT (4(3X, F5.1)) 1020 FORMAT (/1X, 'A**(-1):') 1030 FORMAT (/1X, 'det(A) =', F6.1) C END SAMPLE OUTPUT A: -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 A**(-1): -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 det(A) = 2.0
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |