Program e01zmfe ! E01ZMF Example Program Text ! Mark 24 Release. NAG Copyright 2012. ! .. Use Statements .. Use nag_library, Only: e01zmf, e01znf, nag_wp ! .. Implicit None Statement .. Implicit None ! .. Parameters .. Integer, Parameter :: nin = 5, nout = 6 ! .. Local Scalars .. Integer :: d, 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,*) 'E01ZMF Example Program Results' ! Skip heading in data file Read (nin,*) ! Input the number of nodes. Read (nin,*) d, m liq = 2*m + 1 lrq = (d+1)*(d+2)/2*m + 2*d + 1 Allocate (x(d,m),f(m),iq(liq),rq(lrq)) ! Input the data points X and F. Do i = 1, m Read (nin,*) x(1:d,i), f(i) End Do ! Generate the interpolant. nq = 0 nw = 0 ifail = 0 Call e01zmf(d,m,x,f,nw,nq,iq,rq,ifail) ! Input the number of evaluation points. Read (nin,*) n Allocate (xe(d,n),q(n),qx(d,n)) ! Input the evaluation points. Do i = 1, n Read (nin,*) xe(1:d,i) End Do ! Evaluate the interpolant using E01ZNF. ifail = 0 Call e01znf(d,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,d) Write (nout,99997) Write (nout,99999)(i,xe(1:d,i),q(i),i=1,n) 99999 Format (I4,1X,7F10.4) 99998 Format (/3X,' |',10X,A31,19X,'|',A7) 99997 Format (3X,'---|',60('-'),'+',7('-')) 99996 Format (3X,'I |',6(2X,'XE(',I1,',I)',1X),'|',2X,'Q(I)') End Program e01zmfe