/* Fit a cubic spline to 11 points (x,y), x = 0, 0.1, ..., 1.0, y = sin(x). The not-a-knot condition is used, so the interpolation is less accurate near the two ends. Interpolate values of y at x = 0.05, 0.15, ..., 0.95 */ #include #include #include "mkl.h" #define NX 11 /* Size of partition, number of breakpoints */ #define NSITE 10 /* Number of interpolation sites */ #define SPLINE_ORDER DF_PP_CUBIC /* A cubic spline to construct */ int main() { int status; /* Status of a Data Fitting operation */ DFTaskPtr task; /* Data Fitting operations are task based */ /* Parameters describing the partition */ MKL_INT nx; /* The size of partition x */ double x[NX]; /* Partition x */ MKL_INT xhint; /* Additional information about the structure of breakpoints */ /* Parameters describing the function */ MKL_INT ny; /* Function dimension */ double y[NX]; /* Function values at the breakpoints */ MKL_INT yhint; /* Additional information about the function */ /* Parameters describing the spline */ MKL_INT s_order; /* Spline order */ MKL_INT s_type; /* Spline type */ MKL_INT ic_type; /* Type of internal conditions */ double* ic; /* Array of internal conditions */ MKL_INT bc_type; /* Type of boundary conditions */ double* bc; /* Array of boundary conditions */ double scoeff[(NX-1)* SPLINE_ORDER]; /* Array of spline coefficients */ MKL_INT scoeffhint; /* Additional information about the coefficients */ /* Parameters describing interpolation computations */ MKL_INT nsite; /* Number of interpolation sites */ double site[NSITE]; /* Array of interpolation sites */ MKL_INT sitehint; /* Additional information about the structure of interpolation sites */ MKL_INT ndorder, dorder; /* Parameters defining the type of interpolation */ double* datahint; /* Additional information on partition and interpolation sites */ double r[NSITE]; /* Array of interpolation results */ MKL_INT rhint; /* Additional information on the structure of the results */ MKL_INT* cell; /* Array of cell indices */ int i; /* Initialize the partition */ nx = NX; /* Set values of partition x */ for(i=0; i