NAME dppco - compute a Cholesky factorization and condition number of a symmetric positive definite matrix A in packed storage. If the condition number is not needed then xPPFA is slightly faster. It is typical to follow a call to xPPCO with a call to xPPSL to solve Ax = b or to xPPDI to compute the determinant and inverse of A. SYNOPSIS SUBROUTINE DPPCO (DA, N, DRCOND, DWORK, INFO) SUBROUTINE SPPCO (SA, N, SRCOND, SWORK, INFO) SUBROUTINE ZPPCO (ZA, N, DRCOND, ZWORK, INFO) SUBROUTINE CPPCO (CA, N, SRCOND, CWORK, INFO) #include <sunperf.h> void dppco(double *dap, int n, double *drcond, int *info) ; void sppco(float *sap, int n, float *srcond, int *info) ; void zppco(doublecomplex *zap, int n, double *drcond, int *info) ; void cppco(complex *cap, int n, float *srcond, int *info) ; ARGUMENTS xA On entry, the upper triangle of the matrix A. On exit, a Cholesky factorization of the matrix A. N Order of the matrix A. N * 0. xRCOND On exit, an estimate of the reciprocal condition number of A. 0.0 <= RCOND <= 1.0. As the value of RCOND gets smaller, operations with A such as solving Ax = b may become less stable. If RCOND satisfies RCOND + 1.0 = 1.0 then A may be singular to working precision. xWORK Scratch array with a dimension of N. INFO On exit: INFO = 0 Subroutine completed normally. INFO * 0 Returns a value k if the leading minor of order k is not positive definite. SAMPLE PROGRAM PROGRAM TEST IMPLICIT NONE C INTEGER LENGTA, N PARAMETER (N = 4) PARAMETER (LENGTA = (N * N + N) / 2) C DOUBLE PRECISION A(LENGTA), B(N), RCOND, WORK(N) INTEGER INFO C EXTERNAL DPPCO, DPPSL C C Initialize the array A to store in packed symmetric storage C mode the matrix A shown below. Initialize the array B to store C the matrix B shown below. C C 4 3 2 1 60 C A = 3 4 3 2 b = 20 C 2 3 4 3 20 C 1 2 3 4 60 C DATA A / 4.0D0, 3.0D0, 4.0D0, 2.0D0, 3.0D0, 4.0D0, $ 1.0D0, 2.0D0, 3.0D0, 4.0D0 / DATA B / 6.0D1, 2.0D1, 2.0D1, 6.0D1 / C PRINT 1000 PRINT 1010, A(1), A(2), A(4), A(7) PRINT 1010, A(2), A(3), A(5), A(8) PRINT 1010, A(4), A(5), A(6), A(9) PRINT 1010, A(7), A(8), A(9), A(10) PRINT 1020 PRINT 1030, B CALL DPPCO (A, N, RCOND, WORK, INFO) IF ((RCOND + 1.0D0) .EQ. RCOND) THEN PRINT 1040 END IF CALL DPPSL (A, N, B) PRINT 1050, RCOND PRINT 1060 PRINT 1030, B C 1000 FORMAT (1X, 'A in full form:') 1010 FORMAT (5(3X, F7.3)) 1020 FORMAT (/1X, 'b:') 1030 FORMAT (3X, F7.3) 1040 FORMAT (1X, 'A may be singular to working precision.') 1050 FORMAT (/1X, 'Reciprocal condition of A:', F5.2) 1060 FORMAT (/1X, 'A**(-1) * b:') 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 b: 60.000 20.000 20.000 60.000 Reciprocal condition of A: 0.04 A**(-1) * b: 32.000 -20.000 -20.000 32.000
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |