Shepard's method
More...
#include <shepard.h>
|
| | Shepard (int maxPoints, int dim, double p) |
| | Constructor. More...
|
| |
| int | dim () const |
| | Method for getting the number of dimensions. More...
|
| |
| int | numPoints () const |
| | Method for getting the current number of points. More...
|
| |
| vec | X (int i) const |
| | Method for getting current point number i (0 is the first) More...
|
| |
| mat | X () const |
| | Method for getting the current points. More...
|
| |
| double | fX (int i) const |
| | Method for getting the value of current point number i (0 is the first) More...
|
| |
| vec | fX () const |
| | Method for getting the values of the current points. More...
|
| |
| void | addPoint (const vec &point, double funVal) |
| | Method for adding a point with a known value. More...
|
| |
| void | addPoints (const mat &points, const vec &funVals) |
| | Method for adding multiple points with known values. More...
|
| |
| double | eval (const vec &point) const |
| | Method for evaluating the surrogate model at a point. More...
|
| |
| double | eval (const vec &point, const vec &dists) const |
| | Method for evaluating the surrogate at multiple points. More...
|
| |
| vec | evals (const mat &points) const |
| | Method for evaluating the surrogate at multiple points. More...
|
| |
| vec | evals (const mat &points, const mat &dists) const |
| | Method for evaluating the surrogate at multiple points. More...
|
| |
| vec | deriv (const vec &point) const |
| | Method for evaluating the kNN derivative at one point (not implemented) More...
|
| |
|
void | reset () |
| | Method for resetting the surrogate model.
|
| |
|
void | fit () |
| | Fits the interpolant (does nothing)
|
| |
Shepard's method
Shepard's method, also known as Inverse Distance Weighting (IMW), assigns function values to unknown points as a weighted average of the values available at the known points. The weights are given by \( w_i(x) = \|x-x_i\|^{-p/2}\) which makes it clear that points close to \(x\) are weighted higher.
- Author
- David Eriksson, dme65.nosp@m.@cor.nosp@m.nell..nosp@m.edu
| sot::Shepard::Shepard |
( |
int |
maxPoints, |
|
|
int |
dim, |
|
|
double |
p |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
| maxPoints | Capacity |
| dim | Number of dimensions |
| p | Value of the exponent, 2 is a common choice |
| void sot::Shepard::addPoint |
( |
const vec & |
point, |
|
|
double |
funVal |
|
) |
| |
|
inlinevirtual |
Method for adding a point with a known value.
- Parameters
-
| point | Point to be added |
| funVal | Function value at point |
- Exceptions
-
| std::logic_error | if one point is supplied or if capacity is exceeded |
Implements sot::Surrogate.
| void sot::Shepard::addPoints |
( |
const mat & |
points, |
|
|
const vec & |
funVals |
|
) |
| |
|
inlinevirtual |
Method for adding multiple points with known values.
- Parameters
-
| points | Points to be added |
| funVals | Function values at the points |
- Exceptions
-
| std::logic_error | if one point is supplied or if capacity is exceeded |
Implements sot::Surrogate.
| vec sot::Shepard::deriv |
( |
const vec & |
point | ) |
const |
|
inlinevirtual |
Method for evaluating the kNN derivative at one point (not implemented)
- Exceptions
-
| std::logic_error | Not available for Shepard |
Implements sot::Surrogate.
| int sot::Shepard::dim |
( |
| ) |
const |
|
inlinevirtual |
Method for getting the number of dimensions.
- Returns
- Number of dimensions
Implements sot::Surrogate.
| double sot::Shepard::eval |
( |
const vec & |
point | ) |
const |
|
inlinevirtual |
Method for evaluating the surrogate model at a point.
- Parameters
-
| point | Point for which to evaluate the surrogate |
- Returns
- Value of the surrogate model at the point
Implements sot::Surrogate.
| double sot::Shepard::eval |
( |
const vec & |
point, |
|
|
const vec & |
dists |
|
) |
| const |
|
inlinevirtual |
Method for evaluating the surrogate at multiple points.
- Parameters
-
| point | Points for which to evaluate the surrogate model |
| dists | Distances between the interpolation nodes and point |
- Returns
- Values of the surrogate model at the points
Implements sot::Surrogate.
| vec sot::Shepard::evals |
( |
const mat & |
points | ) |
const |
|
inlinevirtual |
Method for evaluating the surrogate at multiple points.
- Parameters
-
| points | Points for which to evaluate the surrogate model |
- Returns
- Values of the surrogate model at the points
Implements sot::Surrogate.
| vec sot::Shepard::evals |
( |
const mat & |
points, |
|
|
const mat & |
dists |
|
) |
| const |
|
inlinevirtual |
Method for evaluating the surrogate at multiple points.
- Parameters
-
| points | Points for which to evaluate the surrogate model |
| dists | Distances between the interpolation nodes and the points |
- Returns
- Values of the surrogate model at the points
Implements sot::Surrogate.
| double sot::Shepard::fX |
( |
int |
i | ) |
const |
|
inlinevirtual |
Method for getting the value of current point number i (0 is the first)
- Returns
- Value of point number i
Implements sot::Surrogate.
| vec sot::Shepard::fX |
( |
| ) |
const |
|
inlinevirtual |
Method for getting the values of the current points.
- Returns
- Values of current points
Implements sot::Surrogate.
| int sot::Shepard::numPoints |
( |
| ) |
const |
|
inlinevirtual |
Method for getting the current number of points.
- Returns
- Current number of points
Implements sot::Surrogate.
| vec sot::Shepard::X |
( |
int |
i | ) |
const |
|
inlinevirtual |
Method for getting current point number i (0 is the first)
- Returns
- Point number i
Implements sot::Surrogate.
| mat sot::Shepard::X |
( |
| ) |
const |
|
inlinevirtual |
Method for getting the current points.
- Returns
- Current points
Implements sot::Surrogate.
| double sot::Shepard::mDistTol = 1e-10 |
|
protected |
Distance tolerance for distinguishing points
| int sot::Shepard::mMaxPoints |
|
protected |
| int sot::Shepard::mNumPoints |
|
protected |
The documentation for this class was generated from the following file: