NAME sposl - solve the linear system Ax = b for a symmetric posi- tive definite matrix A, which has been Cholesky-factored by xPOCO or xPOFA, and vectors b and x. SYNOPSIS SUBROUTINE DPOSL (DA, LDA, N, DB) SUBROUTINE SPOSL (SA, LDA, N, SB) SUBROUTINE ZPOSL (ZA, LDA, N, ZB) SUBROUTINE CPOSL (CA, LDA, N, CB) #include <sunperf.h> void dposl(double *da, int lda, int n, double *b) ; void sposl(float *sa, int lda, int n, float *b) ; void cposl(complex *ca, int lda, int n, complex *b) ; void zposl(doublecomplex *za, int lda, int n, doublecomplex *b) ; ARGUMENTS xA Cholesky factorization of the matrix A, as com- puted by xPOCO or xPOFA. 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. xB On entry, the right-hand side vector b. On exit, the solution vector x. SAMPLE PROGRAM PROGRAM TEST IMPLICIT NONE C INTEGER LDA, N PARAMETER (N = 4) PARAMETER (LDA = N) C DOUBLE PRECISION A(LDA,N), B(N), RCOND, WORK(N) INTEGER ICOL, INFO, IROW C EXTERNAL DPOCO, DPOSL C C Initialize the array A to store in symmetric storage mode C the matrix A shown below. Initialize the array B to store C the vector B shown below. C C 4 3 2 1 20 C A = 3 4 3 2 b = 20 C 2 3 4 3 20 C 1 2 3 4 20 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 / DATA B / 4*2.0D1 / 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) PRINT 1030 PRINT 1040, B CALL DPOCO (A, LDA, N, RCOND, WORK, INFO) IF ((RCOND + 1.0D0) .EQ. 1.0D0) THEN PRINT 1050 END IF CALL DPOSL (A, LDA, N, B) PRINT 1060 PRINT 1040, B 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 may be singular to working precision.') 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 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 b: 20.000 20.000 20.000 20.000 A**(-1) * b: 4.000 0.000 0.000 4.000
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |