* F04AGF Example Program Text * Mark 14 Revised. NAG Copyright 1989. * .. Parameters .. INTEGER NMAX, IR, LDA, LDB, LDX PARAMETER (NMAX=8,IR=1,LDA=NMAX,LDB=NMAX,LDX=NMAX) INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) * .. Local Scalars .. DOUBLE PRECISION D1 INTEGER I, ID, IFAIL, J, N * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,IR), P(NMAX), X(LDX,IR) * .. External Subroutines .. EXTERNAL F03AEF, F04AGF * .. Executable Statements .. WRITE (NOUT,*) 'F04AGF Example Program Results' * Skip heading in data file READ (NIN,*) READ (NIN,*) N WRITE (NOUT,*) IF (N.GT.0 .AND. N.LE.NMAX) THEN READ (NIN,*) ((A(I,J),J=1,N),I=1,N), ((B(I,J),J=1,IR),I=1,N) IFAIL = 1 * * Cholesky decomposition CALL F03AEF(N,A,LDA,P,D1,ID,IFAIL) * IF (IFAIL.EQ.0) THEN * * Approximate solution of linear equations IFAIL = 1 CALL F04AGF(N,IR,A,LDA,P,B,LDB,X,LDX) * WRITE (NOUT,*) ' Solution' DO 20 I = 1, N WRITE (NOUT,99998) (X(I,J),J=1,IR) 20 CONTINUE ELSE WRITE (NOUT,99997) IFAIL END IF ELSE WRITE (NOUT,99999) 'N is out of range: N = ', N END IF * 99999 FORMAT (1X,A,I5) 99998 FORMAT (1X,8F9.4) 99997 FORMAT (1X,' ** F03AEF returned with IFAIL = ',I5) END