Alexandria 2.31.4
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Euclid::MathUtils::InterpN< T, Rest... > Class Template Reference
Collaboration diagram for Euclid::MathUtils::InterpN< T, Rest... >:

Public Member Functions

 InterpN (const std::tuple< std::vector< T >, std::vector< Rest >... > &grid, const NdArray::NdArray< double > &values, bool extrapolate)
 
double operator() (T x, Rest... rest) const
 
 InterpN (const InterpN &other)
 Copy constructor.
 
 InterpN (const std::tuple< std::vector< AxisType >... > &grid, const NdArray::NdArray< double > &values, bool extrapolate)
 
 ~InterpN ()=default
 
double operator() (AxisType... args) const
 

Private Attributes

std::vector< T > m_knots
 
std::vector< std::unique_ptr< InterpN< Rest... > > > m_interpolators
 
bool m_extrapolate
 

Detailed Description

template<typename T, typename... Rest>
class Euclid::MathUtils::InterpN< T, Rest... >

Recursive specialization of an N-Dimensional interpolator

Template Parameters
NDimensionality (N > 1)
FThe first element of the index sequence
RestThe rest of the elements from the index sequence

Definition at line 172 of file GridInterpolation.icpp.

Constructor & Destructor Documentation

◆ InterpN() [1/3]

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

Constructor

Parameters
grid
values
type
extrapolate

Definition at line 181 of file GridInterpolation.icpp.

References std::vector< T >::back(), InterpN(), m_extrapolate, m_interpolators, m_knots, std::move(), Euclid::NdArray::NdArray< T >::rslice(), Euclid::NdArray::NdArray< T >::shape(), std::vector< T >::size(), and Euclid::Tuple::Tail().

Referenced by InterpN(), and InterpN().

Here is the call graph for this function:

◆ InterpN() [2/3]

template<typename T, typename... Rest>
Euclid::MathUtils::InterpN< T, Rest... >::InterpN ( const InterpN< T, Rest... > & other)
inline

Copy constructor.

Definition at line 220 of file GridInterpolation.icpp.

References InterpN(), m_extrapolate, m_interpolators, and m_knots.

Here is the call graph for this function:

◆ InterpN() [3/3]

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

◆ ~InterpN()

Euclid::MathUtils::InterpN< AxisType >::~InterpN ( )
default

Destructor

Member Function Documentation

◆ operator()() [1/2]

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

Interpolate the value for the given parameters

◆ operator()() [2/2]

template<typename T, typename... Rest>
double Euclid::MathUtils::InterpN< T, Rest... >::operator() ( T x,
Rest... rest ) const
inline

Call as a function

Parameters
xValue for the axis for the first dimension
restValues for the next set of axes
Returns
The interpolated value

Doubles<Rest>... is used to expand into (N-1) doubles x is used to find the interpolators for x1 and x2 s.t. x1 <= x <=x2 Those two interpolators are used to compute y1 for x1, and y2 for x2 (based on the rest of the parameters) A final linear interpolator is used to get the value of y at the position x

Definition at line 215 of file GridInterpolation.icpp.

References m_extrapolate, m_interpolators, and m_knots.

Member Data Documentation

◆ m_extrapolate

template<typename T, typename... Rest>
bool Euclid::MathUtils::InterpN< T, Rest... >::m_extrapolate
private

Definition at line 230 of file GridInterpolation.icpp.

Referenced by InterpN(), InterpN(), and operator()().

◆ m_interpolators

template<typename T, typename... Rest>
std::vector<std::unique_ptr<InterpN<Rest...> > > Euclid::MathUtils::InterpN< T, Rest... >::m_interpolators
private

Definition at line 229 of file GridInterpolation.icpp.

Referenced by InterpN(), InterpN(), and operator()().

◆ m_knots

template<typename T, typename... Rest>
std::vector<T> Euclid::MathUtils::InterpN< T, Rest... >::m_knots
private

Definition at line 228 of file GridInterpolation.icpp.

Referenced by InterpN(), InterpN(), and operator()().


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