#include #include #include #include #include using namespace std; #include "vecmathlib.h" using namespace vecmathlib; typedef float64_vec realvec_t; typedef realvec_t::real_t real_t; typedef realvec_t::intvec_t intvec_t; typedef intvec_t::int_t int_t; realvec_t interp(const real_t* array, ptrdiff_t size, real_t xmin, real_t xmax, realvec_t x) { assert(size >= 2); // spacing real_t dx = (xmax - xmin) / (size - 1); real_t idx = 1.0 / dx; // determine location in array realvec_t scaled = (x - realvec_t(xmin)) * realvec_t(idx); realvec_t cell = floor(scaled); intvec_t n = convert_int(cell); // gather values from array realvec_t x0, x1; for (ptrdiff_t i=0; i array(size); for (ptrdiff_t i=0; i