These methods operate on tables (arrays) of data.
Interface:
double bilininterp2d( const double x, const double y, // co-ordinates for interpolation const Array& xtab, // array of x values const Array & ytab, // array of y values const Matrix& ftab, // array of f(x,y) values, x.n by y.n const int ilastpos = -1, const int jlastpos = -1 // last positions, if known )
Interface to calculate gradient:
Vector2d grad_bilininterp2d( const Vector2d& v, // co-ordinates for interpolation const Array& xtab, // array of x values const Array & ytab, // array of y values const Matrix& ftab, // array of f(x,y) values, x.n by y.n const int ilastpos = -1, const int jlastpos = -1 // last positions, if known )
Example:
#include... Array xtab,ytab; matrix ftab; double x,y; ... double f = bilininterp2d(x,y,xtab,ytab,ftab); Vector2d v(x,y); Vector2d gradf = grad_bilininterp2d(v,xtab,ytab,ftab);
Interface:
double bipolyinterp2d( const double x, const double y, // co-ordinates for interpolation const Array& xtab, // array of x values const Array & ytab, // array of y values const Matrix& ftab, // array of f(x,y) values, x.n by y.n const int xorder, const int yorder, // order of interpolating polynomials const int xfirst, // 1/0 to fit x/y direction first const int ilastpos = -1, const int jlastpos = -1 // last positions, if known )
Interface to calculate gradient:
Vector2d grad_bipolyinterp2d( const Vector2d& v, // co-ordinates for interpolation const ArrayNote:& xtab, // array of x values const Array & ytab, // array of y values const Matrix& ftab, // array of f(x,y) values, x.n by y.n const int xorder, const int yorder, // order of interpolating polynomials const int ilastpos = -1, const int jlastpos = -1 // last positions, if known )
xfirst
is not used!
Example:
#include... Array xtab,ftab; double x; int xorder = 2, yorder = 2; // bi-quadratic int xfirst = 1; ... double f = bipolyinterp2d(x,y,xtab,ytab,ftab,xorder,yorder,xfirst); Vector2d v(x,y); Vector2d gradf = grad_bipolyinterp2d(v,xtab,ytab,ftab,xorder,yorder);
Takes an initial guess (e.g. the previous value) of the position of the ordinate in the table to speed the search phase if possible (see `tabpos').
Interface:
double natinterp2d( const double x, const double y, // co-ordinates for interpolation const Array& xtab, // array of x values const Array & ytab, // array of y values const Matrix& ftab, // array of f(x,y) values, x.n by y.n const int ilastpos = -1, const int jlastpos = -1 // last positions, if known )
Example:
#include... Array xtab,ytab; matrix ftab; double x,y; ... double f = natinterp2d(x,y,xtab,ytab,ftab);