NAME
zpodi - compute the determinant and inverse of a symmetric
positive definite matrix A, which has been Cholesky-factored
by xPOCO, xPOFA, or xQRDC.
SYNOPSIS
SUBROUTINE DPODI (DA, LDA, N, DDET, JOB)
SUBROUTINE SPODI (SA, LDA, N, SDET, JOB)
SUBROUTINE ZPODI (ZA, LDA, N, DDET, JOB)
SUBROUTINE CPODI (CA, LDA, N, SDET, JOB)
#include <sunperf.h>
void dpodi(double *da, int lda, int n, double *det, int
job);
void spodi(float *sa, int lda, int n, float *det, int job);
void cpodi(complex *ca, int lda, int n, float *det, int
job);
void zpodi(doublecomplex *za, int lda, int n, double *det,
int job);
ARGUMENTS
xA On entry, the Cholesky factorization of the matrix
A, as computed by xPOCO, xPOFA, or xQRDC. 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.
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.
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, LDA, N
PARAMETER (INVDET = 11)
PARAMETER (N = 4)
PARAMETER (LDA = N)
C
DOUBLE PRECISION A(LDA,N), DET(2)
INTEGER ICOL, INFO, IROW, JOB
C
EXTERNAL DPODI, DPOFA
C
C Initialize the array A to store in symmetric storage mode
C the matrix A 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*8D8, 3.0D0, 4.0D0, 2*8D8, 2.0D0, 3.0D0,
$ 4.0D0, 8D8, 1.0D0, 2.0D0, 3.0D0, 4.0D0 /
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 DPOFA (A, LDA, N, INFO)
IF (INFO .EQ. 0) THEN
JOB = INVDET
CALL DPODI (A, LDA, N, DET, JOB)
PRINT 1050
DO 110, IROW = 1, N
PRINT 1010, (A(ICOL,IROW), ICOL = 1, IROW),
$ (A(IROW,ICOL), ICOL = IROW + 1, N)
110 CONTINUE
PRINT 1060, DET(1) * (10.0D0 ** DET(2))
ELSE
PRINT 1070
END IF
C
1000 FORMAT (1X, 'A in full form:')
1010 FORMAT (4(3X, F7.3))
1020 FORMAT (/1X, 'A in symmetric form: (* in unused entries)')
1030 FORMAT (/1X, 'b:')
1040 FORMAT (3X, F7.3)
1050 FORMAT (/1X, 'A**(-1):')
1060 FORMAT (/1X, 'The determinant of A is ', F5.1)
1070 FORMAT (/1X, 'A is not positive definite.')
C
END
SAMPLE OUTPUT
A in full form:
4.000 3.000 2.000 1.000
3.000 4.000 3.000 2.000
2.000 3.000 4.000 3.000
1.000 2.000 3.000 4.000
A in symmetric form: (* in unused entries)
4.000 3.000 2.000 1.000
******* 4.000 3.000 2.000
******* ******* 4.000 3.000
******* ******* ******* 4.000
A**(-1):
0.600 -0.500 0.000 0.100
-0.500 1.000 -0.500 0.000
0.000 -0.500 1.000 -0.500
0.100 0.000 -0.500 0.600
The determinant of A is 20.0
|
Закладки на сайте Проследить за страницей |
Created 1996-2025 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |