NAG Library Manual, Mark 28.4
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program e02defe

!     E02DEF Example Program Text

!     Mark 28.4 Release. NAG Copyright 2022.

!     .. Use Statements ..
      Use nag_library, Only: e02def, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, m, px, py
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: c(:), ff(:), lamda(:), mu(:),        &
                                          wrk(:), x(:), y(:)
      Integer, Allocatable             :: iwrk(:)
!     .. Executable Statements ..
      Write (nout,*) 'E02DEF Example Program Results'

!     Skip heading in data file
      Read (nin,*)

!     Read PX and PY, the number of knots in the X and Y directions.

      Read (nin,*) px, py
      Allocate (lamda(px),mu(py),c((px-4)*(py-4)),wrk(py-4),iwrk(py-4))

!     Read the knots LAMDA(1) .. LAMDA(PX) and MU(1) .. MU(PY).

      Read (nin,*) lamda(1:px)
      Read (nin,*) mu(1:py)

!     Read C, the bicubic spline coefficients.

      Read (nin,*) c(1:(px-4)*(py-4))

!     Read M, the number of spline evaluation points.

      Read (nin,*) m
      Allocate (x(m),y(m),ff(m))

!     Read the X and Y co-ordinates of the evaluation points.

      Do i = 1, m
        Read (nin,*) x(i), y(i)
      End Do

!     Evaluate the spline at the M points.

      ifail = 0
      Call e02def(m,px,py,x,y,lamda,mu,c,ff,wrk,iwrk,ifail)

      Write (nout,*)
      Write (nout,*) '      I       X(I)       Y(I)      FF(I)'
      Write (nout,99999)(i,x(i),y(i),ff(i),i=1,m)

99999 Format (1X,I7,3F11.3)
    End Program e02defe