PROGRAM e02dffe ! E02DFF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : e02dff, nag_wp, x04cbf ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: indent = 0, ncols = 80, nin = 5, & nout = 6 CHARACTER (1), PARAMETER :: chlabel = 'C', diag = 'N', & matrix = 'G' CHARACTER (4), PARAMETER :: form = 'F8.3' ! .. Local Scalars .. INTEGER :: ifail, liwrk, lwrk, mx, my, px, py CHARACTER (48) :: title ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: c(:), ff(:), lamda(:), mu(:), & wrk(:), x(:), y(:) INTEGER, ALLOCATABLE :: iwrk(:) CHARACTER (10), ALLOCATABLE :: clabs(:), rlabs(:) ! .. Intrinsic Functions .. INTRINSIC min ! .. Executable Statements .. WRITE (nout,*) 'E02DFF Example Program Results' FLUSH (nout) ! 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))) ! 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 MX and MY, the number of grid points in the X and Y ! directions respectively. READ (nin,*) mx, my lwrk = min(4*mx+px,4*my+py) liwrk = mx + px - 4 ALLOCATE (clabs(mx),rlabs(my),x(mx),y(my),ff(mx*my),wrk(lwrk), & iwrk(liwrk)) ! Read the X and Y co-ordinates defining the evaluation grid. READ (nin,*) x(1:mx) READ (nin,*) y(1:my) ! Evaluate the spline at the MX by MY points. ifail = 0 CALL e02dff(mx,my,px,py,x,y,lamda,mu,c,ff,wrk,lwrk,iwrk,liwrk,ifail) ! Generate column and row labels to print the results with. WRITE (clabs(1:mx),99999) x(1:mx) WRITE (rlabs(1:my),99999) y(1:my) WRITE (nout,*) FLUSH (nout) ! Print the result array. title = 'Spline evaluated on X-Y grid (X across, Y down):' CALL x04cbf(matrix,diag,my,mx,ff,my,form,title,chlabel,rlabs,chlabel, & clabs,ncols,indent,ifail) 99999 FORMAT ((F5.1)) END PROGRAM e02dffe