Program e01zmfe
! E01ZMF Example Program Text
! Mark 29.0 Release. NAG Copyright 2023.
! .. Use Statements ..
Use nag_library, Only: e01zmf, e01znf, nag_wp, x04caf
! .. 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 = 1
Call e01znf(d,m,x,f,iq,rq,n,xe,q,qx,ifail)
If (ifail==0 .Or. ifail==3) Then
If (ifail==3) Then
Write (nout,*) 'Some values below have been extrapolated'
Write (nout,*)
End If
Write (nout,*)
Flush (nout)
ifail = 0
Call x04caf('General',' ',d,n,xe,d, &
'Interpolated Evaluation Points (columns)',ifail)
Write (nout,*)
Flush (nout)
Call x04caf('General',' ',1,n,q,1,'Interpolated values',ifail)
Else
Write (nout,99999) 'Evaluation routine returned with IFAIL = ', ifail
End If
99999 Format (1X,A,I4)
End Program e01zmfe