#include <Sheppard_fwd.hpp>
Scattered interpolant using a slightly modified Sheppard's interpolation (inverse distance weighting).
The essential difference is the introduction of a "regularization" parameter (reg
) that is used when computing the inverse distance weights: \( w_i = 1 / (d(x, x_i)^{power} + reg) \) By supplying a positive regularization parameter one can avoid singularities at the locations of the data points as well as control the "smoothness" of the interpolation (e.g., make the weights of the neighbors less varied). The "smoothness" of interpolation can also be controlled by the power parameter (power
). The interpolation is not continuous due to the cut off at the closest neighbors.
Usage example:
Definition at line 36 of file Sheppard_fwd.hpp.
Public Member Functions | |
SheppardInterpolant ()=default | |
Construct a new empty Sheppard Interpolant object. More... | |
SheppardInterpolant (const Range< vec_t > &pos) | |
Construct a new Sheppard Interpolant. More... | |
SheppardInterpolant (const Range< vec_t > &pos, const Range< value_t > &values) | |
Construct a new Sheppard Interpolant object. More... | |
template<typename values_container_t > | |
void | setValues (const values_container_t &new_values) |
Set new values. More... | |
void | setPositions (const Range< vec_t > &pos) |
Set new positions. More... | |
value_t | operator() (const vec_t &point, int num_closest, int power=2, double reg=0.0, double conf_dist=1e-12) const |
Evaluate the interpolant at the given point. More... | |
Private Types | |
typedef vec_t::scalar_t | scalar_t |
Scalar data type. More... | |
Private Attributes | |
KDTree< vec_t > | tree |
Tree of all points. More... | |
Range< value_t > | values |
Function values at given points. More... | |
|
default |
Construct a new empty Sheppard Interpolant object.
Use setValues and setPositions() to fill the object.
|
inlineexplicit |
Construct a new Sheppard Interpolant.
Use setValues to add values.
pos | Positions. |
Definition at line 53 of file Sheppard_fwd.hpp.
|
inline |
Construct a new Sheppard Interpolant object.
pos | Initial positions. |
values | Function values to be interpolated.. |
Definition at line 63 of file Sheppard_fwd.hpp.
value_t mm::SheppardInterpolant< vec_t, value_t >::operator() | ( | const vec_t & | point, |
int | num_closest, | ||
int | power = 2 , |
||
double | reg = 0.0 , |
||
double | conf_dist = 1e-12 |
||
) | const |
Evaluate the interpolant at the given point.
The complexity of the evaluation function is \( \mathcal{O}(m\log{n}) \) for \( m \) closest nodes and \( n \) positions in the k-d tree.
The approximation order equals \( O(h) \).
point | Location where evaluation is needed. |
num_closest | Number of closest neighbors. |
power | The power of the inverse distance used for the interpolation weights. |
reg | Regularization parameter. |
conf_dist | The confusion distance below which the interpolator should use the value of the closest data point instead of attempting to interpolate. |
Definition at line 17 of file Sheppard.hpp.
|
inline |
Set new positions.
Definition at line 85 of file Sheppard_fwd.hpp.
|
inline |
Set new values.
Any container that supports forward iteration with .begin()
and .end()
can be used. The contained element type must be compatible with value_t
.
Definition at line 80 of file Sheppard_fwd.hpp.
|
private |
Tree of all points.
Definition at line 38 of file Sheppard_fwd.hpp.
|
private |
Function values at given points.
Definition at line 39 of file Sheppard_fwd.hpp.