NAME zchdc - compute the Cholesky decomposition of a symmetric positive definite matrix A. SYNOPSIS SUBROUTINE DCHDC (DA, LDA, N, DWORK, IPIVOT, JOB, INFO) SUBROUTINE SCHDC (SA, LDA, N, SWORK, IPIVOT, JOB, INFO) SUBROUTINE ZCHDC (ZA, LDA, N, ZWORK, IPIVOT, JOB, INFO) SUBROUTINE CCHDC (CA, LDA, N, CWORK, IPIVOT, JOB, INFO) #include <sunperf.h> void dchdc(double *da, int lda, int p, int *jpivot, int job, int *info) ; void schdc(float *sa, int lda, int p, int *jpivot, int job, int *info) ; void zchdc(doublecomplex *za, int lda, int p, int *jpvt, int job, int *info) ; void cchdc(complex *ca, int lda, int p, int *jpivot, int job, int *info) ; ARGUMENTS xA On entry, the upper triangle of A. On exit, the upper triangle of the Cholesky factor, as permuted by pivoting if pivoting was selected. 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 matrix A. N >= 0. xWORK Scratch array with a dimension of N. IPIVOT If JOB selected no pivoting then IPIVOT is not referenced. On entry, if JOB selected pivoting, IPIVOT contains integers representing array indices that control the selection of pivot ele- ments from the diagonal of A according to the sys- tem below: IPIVOT(k) > 0 A(k,k) is an initial ele- ment. IPIVOT(k) = 0 A(k,k) is a free element. IPIVOT(k) < 0 A(k,k) is a final element. Before the decomposition is computed, symmetric row and column interchanges are used to move ini- tial elements to the beginning of A and final ele- ments to the end of A. During the computation, symmetric row and column interchanges are used to move the largest remaining free diagonal element into the pivot position. On exit, IPIVOT(k) con- tains the index of the diagonal element of A that was moved into the kth position. JOB Determines how decomposition is done: 0 without pivoting not 0 with pivoting INFO On exit: Returns the index of the last positive diagonal element of the Cholesky factor. The sub- routine was successful if INFO = N. SAMPLE PROGRAM PROGRAM TEST IMPLICIT NONE C INTEGER LDA, N, NOPIV PARAMETER (N = 4) PARAMETER (LDA = N) PARAMETER (NOPIV = 0) C DOUBLE PRECISION A(LDA,N), WORK(N) INTEGER I, INFO, IPIVOT(N), J, JOB C EXTERNAL DCHDC 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, I = 1, N PRINT 1010, (A(J,I), J = 1, I), (A(I,J), J = I + 1, N) 100 CONTINUE PRINT 1020 PRINT 1010, ((A(I,J), J = 1, N), I = 1, N) JOB = NOPIV CALL DCHDC (A, LDA, N, WORK, IPIVOT, JOB, INFO) IF (INFO .EQ. N) THEN PRINT 1030 PRINT 1010, A(1,1), A(1,2), A(1,3), A(1,4) PRINT 1040, A(2,2), A(2,3), A(2,4) PRINT 1050, A(3,3), A(3,4) PRINT 1060, A(4,4) 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, 'Upper Cholesky factor:') 1040 FORMAT (10X, 3(3X, F7.3)) 1050 FORMAT (20X, 2(3X, F7.3)) 1060 FORMAT (30X, 1(3X, F7.3)) 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 Upper Cholesky factor: 2.000 1.500 1.000 0.500 1.323 1.134 0.945 1.309 1.091 1.291
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |