Medusa  1.1
Coordinate Free Mehless Method implementation
mm::WLSApproximant< basis_t > Class Template Reference

#include <WLSApproximant_fwd.hpp>

Detailed Description

template<typename basis_t>
class mm::WLSApproximant< basis_t >

Class representing the function that is a WLS approximant using some basis function over some points.

These must satisfy the Basis function concept.

Note
This class does not compute the approximant, that is done by WLS::getApproximant.
See also
WLS
Template Parameters
basis_tBasis function type.

Usage example:

double h = 0.1, u1 = 3.23432, u2 = -2.3234, u3 = 0.12443498, u4 = 1.908432, u5 = -0.98742532;
Vec2d c = {0.05, 0.05};
std::vector<Vec2d> pts = {{0, 0}, {0, h}, {0, -h}, {h, 0}, {-h, 0}};
Eigen::VectorXd values(pts.size()); values << u1, u2, u3, u4, u5;
WLS<Monomials<Vec2d>, GaussianWeight<Vec2d>, ScaleToClosest> wls(1, 1.0);
auto appr = wls.getApproximant(c, pts, values);
double value = appr(0);
double der = appr(0, Der1<2>(1));

Definition at line 27 of file WLSApproximant_fwd.hpp.

Public Member Functions

 WLSApproximant (const basis_t &basis, const vector_t &point, const std::vector< vector_t > &support, scalar_t scale, const Eigen::Matrix< scalar_t, Eigen::Dynamic, 1 > &coefficients, scalar_t residual=NaN)
 Construct a WLS approximant with known coefficients. More...
 
scalar_t operator() (const vector_t &point) const
 Evaluate the approximant at given point. More...
 
template<typename operator_t >
scalar_t operator() (const vector_t &point, const operator_t&op) const
 Evaluate an operator applied to approximant at given point. More...
 
const basis_t & basis () const
 Get the basis functions. More...
 
const vector_tpoint () const
 Get the center point. More...
 
scalar_t scale () const
 Get the scale. More...
 
const Eigen::Matrix< scalar_t, Eigen::Dynamic, 1 > & coefficients () const
 Get the coefficient vector. More...
 
scalar_t residual () const
 Get the residual. More...
 

Public Types

typedef basis_t::scalar_t scalar_t
 Scalar type. More...
 
typedef basis_t::vector_t vector_t
 Vector type. More...
 

Private Attributes

basis_t basis_
 Basis. More...
 
vector_t point_
 Center point. More...
 
std::vector< vector_tsupport_
 Local scaled stencil points. More...
 
scalar_t scale_
 Scale. More...
 
Eigen::Matrix< scalar_t, Eigen::Dynamic, 1 > coefficients_
 Coefficients (for scaled fn.) More...
 
scalar_t residual_
 Store residual of the approximation. More...
 

Constructor & Destructor Documentation

◆ WLSApproximant()

template<typename basis_t >
mm::WLSApproximant< basis_t >::WLSApproximant ( const basis_t &  basis,
const vector_t point,
const std::vector< vector_t > &  support,
scalar_t  scale,
const Eigen::Matrix< scalar_t, Eigen::Dynamic, 1 > &  coefficients,
scalar_t  residual = NaN 
)

Construct a WLS approximant with known coefficients.

The approximant is of the form

\[ u(p) = \sum_{i=1}^m \alpha_i b_i\left(\frac{p - p_c}{s}\right), \]

where \(b_i\) may depend on the stencil nodes (e.g. RBF-s).

Parameters
basisBasis functions \(b_i\) to be used, must satisfy the Basis function concept.
pointCenter point \(p_c\) of the WLS approximation.
supportNonscaled stencil of the WLS approximation.
scaleScale \(s\) used in WLS computation, see Scale function concept.
coefficientsCoefficients \(\alpha_i\) of the approximation.
residualThe resudial of the weighted least squares approximation. If 0, this function is an interpolant.

Definition at line 15 of file WLSApproximant.hpp.

Member Function Documentation

◆ basis()

template<typename basis_t >
const basis_t& mm::WLSApproximant< basis_t >::basis ( ) const
inline

Get the basis functions.

Definition at line 66 of file WLSApproximant_fwd.hpp.

◆ coefficients()

template<typename basis_t >
const Eigen::Matrix<scalar_t, Eigen::Dynamic, 1>& mm::WLSApproximant< basis_t >::coefficients ( ) const
inline

Get the coefficient vector.

Definition at line 72 of file WLSApproximant_fwd.hpp.

◆ operator()() [1/2]

template<typename basis_t >
WLSApproximant< basis_t >::scalar_t mm::WLSApproximant< basis_t >::operator() ( const vector_t point) const

Evaluate the approximant at given point.

Definition at line 30 of file WLSApproximant.hpp.

◆ operator()() [2/2]

template<typename basis_t >
template<typename operator_t >
WLSApproximant< basis_t >::scalar_t mm::WLSApproximant< basis_t >::operator() ( const vector_t point,
const operator_t&  op 
) const

Evaluate an operator applied to approximant at given point.

Definition at line 43 of file WLSApproximant.hpp.

◆ point()

template<typename basis_t >
const vector_t& mm::WLSApproximant< basis_t >::point ( ) const
inline

Get the center point.

Definition at line 68 of file WLSApproximant_fwd.hpp.

◆ residual()

template<typename basis_t >
scalar_t mm::WLSApproximant< basis_t >::residual ( ) const
inline

Get the residual.

Definition at line 74 of file WLSApproximant_fwd.hpp.

◆ scale()

template<typename basis_t >
scalar_t mm::WLSApproximant< basis_t >::scale ( ) const
inline

Get the scale.

Definition at line 70 of file WLSApproximant_fwd.hpp.

Member Data Documentation

◆ basis_

template<typename basis_t >
basis_t mm::WLSApproximant< basis_t >::basis_
private

Basis.

Definition at line 33 of file WLSApproximant_fwd.hpp.

◆ coefficients_

template<typename basis_t >
Eigen::Matrix<scalar_t, Eigen::Dynamic, 1> mm::WLSApproximant< basis_t >::coefficients_
private

Coefficients (for scaled fn.)

Definition at line 37 of file WLSApproximant_fwd.hpp.

◆ point_

template<typename basis_t >
vector_t mm::WLSApproximant< basis_t >::point_
private

Center point.

Definition at line 34 of file WLSApproximant_fwd.hpp.

◆ residual_

template<typename basis_t >
scalar_t mm::WLSApproximant< basis_t >::residual_
private

Store residual of the approximation.

Definition at line 38 of file WLSApproximant_fwd.hpp.

◆ scale_

template<typename basis_t >
scalar_t mm::WLSApproximant< basis_t >::scale_
private

Scale.

Definition at line 36 of file WLSApproximant_fwd.hpp.

◆ support_

template<typename basis_t >
std::vector<vector_t> mm::WLSApproximant< basis_t >::support_
private

Local scaled stencil points.

Definition at line 35 of file WLSApproximant_fwd.hpp.


The documentation for this class was generated from the following files:
mm::Vec2d
Vec< double, 2 > Vec2d
Convenience typedef for 2d vector of doubles.
Definition: Vec_fwd.hpp:34