Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
/builddir/build/BUILD/Alexandria-2.31.0/MathUtils/MathUtils/interpolation/interpolation.h

Returns a NAryFunction<N> which performs a multidimensional interpolation

Template Parameters
NDimensionality
Parameters
gridArray 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.
valuesValues at each grid point. Its shape must match the grid coordinates
typeInterpolation type. Note that for N >= 2, only linear is supported right now
extrapolateIf 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)

/*
* Copyright (C) 2012-2021 Euclid Science Ground Segment
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3.0 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef INTERPOLATION_H
#define INTERPOLATION_H
#include <array>
#include <memory>
#include <vector>
namespace Euclid {
namespace MathUtils {
struct InterpolationException : public Elements::Exception {
};
InterpolationType type, bool extrapolate = false);
bool extrapolate = false);
template <std::size_t N>
template <std::size_t N>
const NdArray::NdArray<double>& values, InterpolationType type,
bool extrapolate = false);
bool extrapolate = false);
ELEMENTS_API double simple_interpolation(double x, double x0, double x1, double y0, double y1,
bool extrapolate) noexcept;
} // namespace MathUtils
} // end of namespace Euclid
#define INTERPOLATION_IMPL
#undef INTERPOLATION_IMPL
#endif /* INTERPOLATION_H */
Exception(ExitCode e=ExitCode::NOT_OK)
This module provides an interface for accessing two dimensional datasets (pairs of (X,...
Definition XYDataset.h:59
#define ELEMENTS_API
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.