PROGRAM e01tkfe ! E01TKF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : e01tkf, e01tlf, 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,*) 'E01TKF Example Program Results' ! Skip heading in data file READ (nin,*) ! Input the number of nodes. READ (nin,*) m liq = 2*m + 1 lrq = 15*m + 9 ALLOCATE (x(4,m),f(m),iq(liq),rq(lrq)) ! Input the data points X and F. DO i = 1, m READ (nin,*) x(1:4,i), f(i) END DO ! Generate the interpolant. nq = 0 nw = 0 ifail = 0 CALL e01tkf(m,x,f,nw,nq,iq,rq,ifail) ! Input the number of evaluation points. READ (nin,*) n ALLOCATE (xe(4,n),q(n),qx(4,n)) ! Input the evaluation points. DO i = 1, n READ (nin,*) xe(1:4,i) END DO ! Evaluate the interpolant using E01TLF. ifail = 0 CALL e01tlf(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,4) WRITE (nout,99997) DO i = 1, n WRITE (nout,99999) i, xe(1:4,i), q(i) END DO 99999 FORMAT (1X,I4,1X,4F10.4,1X,F10.4) 99998 FORMAT (/4X,' |',5X,A31,5X,'|',A7) 99997 FORMAT (4X,'---|',41('-'),'+',8('-')) 99996 FORMAT (4X,'I |',4(2X,'XE(I,',I1,')',1X),1X,'|',2X,'Q(I)') END PROGRAM e01tkfe