/* nag_2d_spline_fit_scat (e02ddc) Example Program. * * Copyright 1991 Numerical Algorithms Group. * * Mark 2, 1991. * * Mark 6 revised, 2000. * Mark 8 revised, 2004. */ #include #include #include #include int main(void) { Integer exit_status=0, i, j, m, npx, npy, nx, nxest, ny, nyest, rank; NagError fail; Nag_2dSpline spline; Nag_Start start; double delta, *f=0, *fg=0, fp, *px=0, *py=0, s, warmstartinf, *weights=0; double *x=0, xhi, xlo, *y=0, yhi, ylo; INIT_FAIL(fail); nxest = 14; nyest = 14; Vprintf("nag_2d_spline_fit_scat (e02ddc) Example Program Results\n"); Vscanf("%*[^\n]"); /* Skip heading in data file */ /* Input the number of data-points m. */ Vscanf("%ld",&m); if (m>=16) { if ( !( f = NAG_ALLOC(m, double)) || !( weights = NAG_ALLOC(m, double)) || !( x = NAG_ALLOC(m, double)) || !( y = NAG_ALLOC(m, double)) ) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } } else { Vprintf("Invalid m.\n"); exit_status = 1; return exit_status; } /* Input the data-points and the weights. */ for (i=0; i=1 && npy>=1) { if ( !( fg = NAG_ALLOC(npx*npy, double)) || !( px = NAG_ALLOC(npx, double)) || !( py = NAG_ALLOC(npy, double)) ) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } } else { Vprintf("Invalid npx or npy.\n"); exit_status = 1; return exit_status; } delta = (xhi-xlo)/(npx-1); for (i=0; i=0; i--) { Vprintf("%8.2f ",py[i]); for (j=0; j