Alexandria  2.25.0
SDC-CH common library for the Euclid project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
Euclid::MathUtils::InterpN< AxisType > Class Template Reference

#include <GridInterpolation.h>

Public Member Functions

 InterpN (const std::tuple< std::vector< AxisType >...> &grid, const NdArray::NdArray< double > &values, bool extrapolate)
 
 ~InterpN ()=default
 
double operator() (AxisType...args) const
 

Detailed Description

template<typename... AxisType>
class Euclid::MathUtils::InterpN< AxisType >

Interpolate on a grid with arbitrary knot types (discrete or continuous)

Template Parameters
AxisTypeList of axes types. Their order corresponds to the order of the axes on the NdArray with the grid values. For instance, values.at(0,1,2) corresponds to the position on the grid defined by the knot 0 of the first axis, the knot 1 of the second axis, and the knot 2 of the third axis.

Example of usage:

// First and second axes are continuous, third one is discrete
InterpN<double, double, MyEnum> interp(...);
double interpolated = interp(0.5, 1.48, MyEnum::A)
Warning
For discrete dimensions, even if extrapolate is true, undefined bins will be considered to have a value of 0.
For integer dimensions, values are expected to start at 0 and be strictly incremental. This is a compromise to improve the sampling performance (direct access to an array instead of a search)

Definition at line 53 of file GridInterpolation.h.

Constructor & Destructor Documentation

template<typename... AxisType>
Euclid::MathUtils::InterpN< AxisType >::InterpN ( const std::tuple< std::vector< AxisType >...> &  grid,
const NdArray::NdArray< double > &  values,
bool  extrapolate 
)

Constructor

Parameters
gridKnots defining the grid
valuesGrid values
extrapolateIf true, values will be extrapolated on continuous dimensions
Warning
The memory layout of values is expected to follow the same as GridContainer: the faster changing axis (the last) corresponds to the first grid axis
template<typename... AxisType>
Euclid::MathUtils::InterpN< AxisType >::~InterpN ( )
default

Destructor

Member Function Documentation

template<typename... AxisType>
double Euclid::MathUtils::InterpN< AxisType >::operator() ( AxisType...  args) const

Interpolate the value for the given parameters


The documentation for this class was generated from the following file: