#include <lazylookup.hh>
Public Member Functions | |
grid_interpolator (std::function< double(const std::array< double, Ndims > &)> f, const std::array< std::size_t, Ndims > &dim_Ns, const std::array< double, Ndims > &dim_mins, const std::array< double, Ndims > &dim_maxes, double bin_eps=1e-4) | |
double | val (const std::array< double, Ndims > &X) |
double | operator[] (std::array< double, Ndims > where) |
A lazy grid interpolator.
This requires a function pointer taking a std::array<double,Ndims>. If the point requested is in the bounds, the function will be evaluated at the appropriate grid points. A linearly-interpolated value will be returned. Out of bounds calls will just call the function directly.
For now just linear interpolation is implemented.
By default this uses dense grid storage (memory is allocated for the entire grid) for Ndim < 3, sparse otherwise
Definition at line 210 of file lazylookup.hh.
|
inline |
Initialize the grid interpolator.
dim_Ns | the number of bins in each dimension (number of grid points will be this plus 1) |
dim_mins | the minimum grid point in each dimension |
dim_maxes | the maximum grid point in each timension |
bin_eps | the fractional part of a bin that will be considered to be exactly the grid point (this is useful because it can avoid evaluating the neighboring grid points) |
Definition at line 292 of file lazylookup.hh.