* E02GAF Example Program Text * Mark 14 Revised. NAG Copyright 1989. * .. Parameters .. INTEGER MMAX, LDA, NPLUS2 PARAMETER (MMAX=5,LDA=MMAX+2,NPLUS2=5) INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) * .. Local Scalars .. DOUBLE PRECISION RESID, T, TOLER INTEGER I, IFAIL, IRANK, ITER, M * .. Local Arrays .. DOUBLE PRECISION A(LDA,NPLUS2), B(MMAX), X(NPLUS2) INTEGER IWORK(MMAX) * .. External Subroutines .. EXTERNAL E02GAF * .. Intrinsic Functions .. INTRINSIC EXP * .. Executable Statements .. WRITE (NOUT,*) 'E02GAF Example Program Results' * Skip heading in data file READ (NIN,*) READ (NIN,*) M IF (M.GT.0 .AND. M.LE.MMAX) THEN DO 20 I = 1, M READ (NIN,*) T, B(I) A(I,1) = EXP(T) A(I,2) = EXP(-T) A(I,3) = 1.0D0 20 CONTINUE TOLER = 0.0D0 IFAIL = 1 * CALL E02GAF(M,A,LDA,B,NPLUS2,TOLER,X,RESID,IRANK,ITER,IWORK, + IFAIL) * WRITE (NOUT,*) IF (IFAIL.EQ.0 .OR. IFAIL.EQ.1) THEN WRITE (NOUT,99999) 'Resid = ', RESID, ' Rank = ', IRANK, + ' Iterations = ', ITER, ' IFAIL =', IFAIL WRITE (NOUT,*) WRITE (NOUT,*) 'Solution' WRITE (NOUT,99998) (X(I),I=1,NPLUS2-2) ELSE WRITE (NOUT,99997) ' ** E02GAF returned with IFAIL = ', + IFAIL END IF END IF * 99999 FORMAT (1X,A,E10.2,A,I5,A,I5,A,I5) 99998 FORMAT (1X,6F10.4) 99997 FORMAT (1X,A,I5) END