SOT
Public Member Functions | Protected Attributes | List of all members
sot::Shepard Class Reference

Shepard's method More...

#include <shepard.h>

Inheritance diagram for sot::Shepard:
sot::Surrogate

Public Member Functions

 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)
 

Protected Attributes

double mp
 
double mDistTol = 1e-10
 
int mMaxPoints
 
int mNumPoints
 
int mDim
 
mat mX
 
mat mfX
 

Detailed Description

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

Constructor & Destructor Documentation

sot::Shepard::Shepard ( int  maxPoints,
int  dim,
double  p 
)
inline

Constructor.

Parameters
maxPointsCapacity
dimNumber of dimensions
pValue of the exponent, 2 is a common choice

Member Function Documentation

void sot::Shepard::addPoint ( const vec point,
double  funVal 
)
inlinevirtual

Method for adding a point with a known value.

Parameters
pointPoint to be added
funValFunction value at point
Exceptions
std::logic_errorif 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
pointsPoints to be added
funValsFunction values at the points
Exceptions
std::logic_errorif 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_errorNot 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
pointPoint 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
pointPoints for which to evaluate the surrogate model
distsDistances 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
pointsPoints 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
pointsPoints for which to evaluate the surrogate model
distsDistances 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.

Member Data Documentation

int sot::Shepard::mDim
protected

Number of dimensions

double sot::Shepard::mDistTol = 1e-10
protected

Distance tolerance for distinguishing points

mat sot::Shepard::mfX
protected

Current point values

int sot::Shepard::mMaxPoints
protected

Capacity

int sot::Shepard::mNumPoints
protected

Current number of points

double sot::Shepard::mp
protected

Value of the exponent p

mat sot::Shepard::mX
protected

Current points


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