PROGRAM e01tmfe ! E01TMF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : e01tmf, e01tnf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. INTEGER :: i, ifail, liq, lrq, m, n, nq, nw ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: f(:), q(:), qx(:,:), rq(:), x(:,:), & xe(:,:) INTEGER, ALLOCATABLE :: iq(:) ! .. Executable Statements .. WRITE (nout,*) 'E01TMF Example Program Results' ! Skip heading in data file READ (nin,*) ! Input the number of nodes. READ (nin,*) m liq = 2*m + 1 lrq = 21*m + 11 ALLOCATE (x(5,m),f(m),iq(liq),rq(lrq)) ! Input the data points X and F. DO i = 1, m READ (nin,*) x(1:5,i), f(i) END DO ! Generate the interpolant. nq = 0 nw = 0 ifail = 0 CALL e01tmf(m,x,f,nw,nq,iq,rq,ifail) ! Input the number of evaluation points. READ (nin,*) n ALLOCATE (xe(5,n),q(n),qx(5,n)) ! Input the evaluation points. DO i = 1, n READ (nin,*) xe(1:5,i) END DO ! Evaluate the interpolant using E01TNF. ifail = 0 CALL e01tnf(m,x,f,iq,rq,n,xe,q,qx,ifail) WRITE (nout,99998) 'Interpolated Evaluation Points', 'Values' WRITE (nout,99997) WRITE (nout,99996) (i,i=1,5) WRITE (nout,99997) WRITE (nout,99999) (i,xe(1:5,i),q(i),i=1,n) 99999 FORMAT (1X,I4,1X,6F10.4) 99998 FORMAT (/4X,' |',10X,A31,10X,'|',A7) 99997 FORMAT (4X,'---|',51('-'),'+',7('-')) 99996 FORMAT (4X,'I |',5(2X,'XE(I,',I1,')',1X),1X,'|',3X,'Q(I)') END PROGRAM e01tmfe