Returns a NAryFunction<N> which performs a multidimensional interpolation
- Template Parameters
-
- Parameters
-
grid | Array containing the knots for each grid dimension. Note that the order must follow the same as the axes! the first coordinates corresponds to the axis 0, the second coordinates to the axis 1, and so on. |
values | Values at each grid point. Its shape must match the grid coordinates |
type | Interpolation type. Note that for N >= 2, only linear is supported right now |
extrapolate | If true, the values for points outside the grid will be extrapolated. If false, they will be 0. |
For a grid of 3 dimensions, and 3 points on each dimension, grid
must point to three vectors of size 3. The shape of values must be (3, 3, 3)
#ifndef INTERPOLATION_H
#define INTERPOLATION_H
#include <array>
#include <memory>
#include <vector>
namespace MathUtils {
};
bool extrapolate = false);
template <std::size_t N>
template <std::size_t N>
}
}
#define INTERPOLATION_IMPL
#undef INTERPOLATION_IMPL
#endif
Exception(ExitCode e=ExitCode::NOT_OK)
This module provides an interface for accessing two dimensional datasets (pairs of (X,...
ELEMENTS_API std::unique_ptr< NAryFunction< N > > interpn(const Coordinates< N > &grid, const NdArray::NdArray< double > &values, InterpolationType type, bool extrapolate=false)
ELEMENTS_API std::unique_ptr< Function > interpolate(const std::vector< double > &x, const std::vector< double > &y, InterpolationType type, bool extrapolate=false)
ELEMENTS_API double simple_interpolation(double x, const std::vector< double > &xp, const std::vector< double > &yp, bool extrapolate=false)
InterpolationType
Enumeration of the different supported interpolation types.
std::array< std::vector< double >, N > Coordinates
Used to pass the grid coordinates to interpn. Internally will make a copy of the required values.