SG++-Doxygen-Documentation
sgpp::combigrid::BSplineScalarProductEvaluator Class Reference

This evaluator calculates the scalar products int b_i(x) b_j(x) dx for B splines b_i and b_j. More...

#include <BSplineScalarProductEvaluator.hpp>

Inheritance diagram for sgpp::combigrid::BSplineScalarProductEvaluator:
sgpp::combigrid::AbstractLinearEvaluator< FloatArrayVector > sgpp::combigrid::AbstractEvaluator< FloatArrayVector >

Public Member Functions

 BSplineScalarProductEvaluator ()
 
 BSplineScalarProductEvaluator (size_t degree)
 
 BSplineScalarProductEvaluator (size_t degree, sgpp::combigrid::SingleFunction weight_function, double a=0, double b=1, bool normalizeWeights=true, size_t numAdditionalPoints=0)
 
 BSplineScalarProductEvaluator (BSplineScalarProductEvaluator const &other)
 
std::shared_ptr< AbstractLinearEvaluator< FloatArrayVector > > cloneLinear () override
 Clones this object and returns it as a shared pointer to AbstractLinearEvaluator<V>. More...
 
std::vector< double > getBasisCoefficients () override
 
std::vector< FloatArrayVectorgetBasisValues () override
 This method is specific to AbstractLinearEvaluator and has to be implemented by all subclasses. More...
 
void getBounds (double &a, double &b) override
 
void getWeightFunction (sgpp::combigrid::SingleFunction &weight_function) override
 
bool hasCustomWeightFunction () override
 
bool needsOrderedPoints () override
 
bool needsParameter () override
 
void setBasisCoefficientsAtGridPoints (std::vector< double > &functionValues) override
 set the basis coefficients for the linear combination. More...
 
void setBounds (double a, double b) override
 
void setGridPoints (std::vector< double > const &newXValues) override
 Sets the grid points for evaluation. More...
 
void setParameter (FloatArrayVector const &param) override
 Via this method, the parameter can be set. More...
 
void setWeightFunction (sgpp::combigrid::SingleFunction weight_function) override
 
virtual ~BSplineScalarProductEvaluator ()
 
- Public Member Functions inherited from sgpp::combigrid::AbstractLinearEvaluator< FloatArrayVector >
virtual std::shared_ptr< AbstractEvaluator< FloatArrayVector > > clone ()
 Clones the AbstractEvaluator object. More...
 
virtual FloatArrayVector eval ()
 AbstractLinearEvaluator provides a standard implementation of this method based on getBasisCoefficients(). More...
 
virtual ~AbstractLinearEvaluator ()
 
- Public Member Functions inherited from sgpp::combigrid::AbstractEvaluator< FloatArrayVector >
virtual EvaluatorConfiguration getConfig ()
 (Currently not used). More...
 
virtual void setConfig (EvaluatorConfiguration newEvalConfig)
 
void setLevel (size_t level)
 This is used to set the level in case an evaluator needs it. More...
 
virtual ~AbstractEvaluator ()
 

Additional Inherited Members

- Protected Attributes inherited from sgpp::combigrid::AbstractEvaluator< FloatArrayVector >
EvaluatorConfiguration evalConfig
 
size_t level
 

Detailed Description

This evaluator calculates the scalar products int b_i(x) b_j(x) dx for B splines b_i and b_j.

This is done via quadrature based on the given grid points. The quadrature weights are obtained by (numerically) integrating the Lagrange polynomials on the given grid points. In the constructor, a weight function may be passed whose values at the grid points are multiplied with the given function values.

Constructor & Destructor Documentation

◆ BSplineScalarProductEvaluator() [1/4]

◆ BSplineScalarProductEvaluator() [2/4]

◆ BSplineScalarProductEvaluator() [3/4]

sgpp::combigrid::BSplineScalarProductEvaluator::BSplineScalarProductEvaluator ( size_t  degree,
sgpp::combigrid::SingleFunction  weight_function,
double  a = 0,
double  b = 1,
bool  normalizeWeights = true,
size_t  numAdditionalPoints = 0 
)
Parameters
degreedegree of the B spline basis
weight_functionoptional weight function w that can be included in the quadrature weights. The Quadrature evaluator then approximates the integral of f*w instead of the integral of f. This provides more precision by calling w more often than f, which might be useful if w can be evaluated much faster than f.
numAdditionalPointsSpecifies how many Gauss-Legrendre points should be used in addition to the default when integrating the Lagrange polynomials for computing the quadrature weights. This number should be higher if the weight function is hard to integrate.
alower bound of bounding box
bupper bound of bounding box
normalizeWeightsIf this is set to true, the weights are normalized so that they sum up to 1. This might be useful if the weight function is (or should be) a probability distribution on the domain.

References sgpp::combigrid::EvaluatorConfiguration::degree, sgpp::combigrid::AbstractEvaluator< FloatArrayVector >::evalConfig, sgpp::combigrid::Multi_BSplineScalarProduct, and sgpp::combigrid::EvaluatorConfiguration::type.

◆ BSplineScalarProductEvaluator() [4/4]

◆ ~BSplineScalarProductEvaluator()

sgpp::combigrid::BSplineScalarProductEvaluator::~BSplineScalarProductEvaluator ( )
virtual

Member Function Documentation

◆ cloneLinear()

std::shared_ptr< AbstractLinearEvaluator< FloatArrayVector > > sgpp::combigrid::BSplineScalarProductEvaluator::cloneLinear ( )
overridevirtual

Clones this object and returns it as a shared pointer to AbstractLinearEvaluator<V>.

Implements sgpp::combigrid::AbstractLinearEvaluator< FloatArrayVector >.

References BSplineScalarProductEvaluator().

Referenced by getBounds().

◆ getBasisCoefficients()

std::vector<double> sgpp::combigrid::BSplineScalarProductEvaluator::getBasisCoefficients ( )
inlineoverridevirtual

◆ getBasisValues()

std::vector<FloatArrayVector> sgpp::combigrid::BSplineScalarProductEvaluator::getBasisValues ( )
inlineoverridevirtual

This method is specific to AbstractLinearEvaluator and has to be implemented by all subclasses.

It should return the coefficients used for the linear combination of function values. Example: If you want to do a linear interpolation and have the grid points 0.0 and 0.5 and an evaluation point (the parameter) of 0.2, you would return the weights (0.6, 0.4), because the interpolated value is 0.6 * f(0) + 0.4 * f(0.5).

In the case of multi-evaluation, this returns several coefficients for each grid point. Continuing the example above, if you would have evaluation points 0.2 and 0.4, the basis coefficients returned should be ((0.6, 0.2), (0.4, 0.8)).

Implements sgpp::combigrid::AbstractLinearEvaluator< FloatArrayVector >.

Referenced by sgpp::combigrid::BSplineInterpolationCoefficientEvaluator::setGridPoints().

◆ getBounds()

void sgpp::combigrid::BSplineScalarProductEvaluator::getBounds ( double &  a,
double &  b 
)
inlineoverridevirtual

◆ getWeightFunction()

void sgpp::combigrid::BSplineScalarProductEvaluator::getWeightFunction ( sgpp::combigrid::SingleFunction weight_function)
inlineoverridevirtual

◆ hasCustomWeightFunction()

bool sgpp::combigrid::BSplineScalarProductEvaluator::hasCustomWeightFunction ( )
inlineoverridevirtual

◆ needsOrderedPoints()

bool sgpp::combigrid::BSplineScalarProductEvaluator::needsOrderedPoints ( )
overridevirtual
Returns
true iff the grid points have to be provided in ascending order (for example for linear interpolation).

Implements sgpp::combigrid::AbstractLinearEvaluator< FloatArrayVector >.

Referenced by getBasisCoefficients().

◆ needsParameter()

bool sgpp::combigrid::BSplineScalarProductEvaluator::needsParameter ( )
overridevirtual
Returns
true iff this evaluation method needs a parameter (e.g. true for interpolation, false for quadrature).

Implements sgpp::combigrid::AbstractLinearEvaluator< FloatArrayVector >.

Referenced by getBasisCoefficients().

◆ setBasisCoefficientsAtGridPoints()

void sgpp::combigrid::BSplineScalarProductEvaluator::setBasisCoefficientsAtGridPoints ( std::vector< double > &  newBasisCoefficients)
overridevirtual

set the basis coefficients for the linear combination.

In case of linear or polynomial interpolation these basis coefficients are function evaluations

Parameters
newBasisCoefficientsthe new coefficients

Implements sgpp::combigrid::AbstractLinearEvaluator< FloatArrayVector >.

Referenced by getBasisCoefficients().

◆ setBounds()

void sgpp::combigrid::BSplineScalarProductEvaluator::setBounds ( double  a,
double  b 
)
inlineoverridevirtual

◆ setGridPoints()

void sgpp::combigrid::BSplineScalarProductEvaluator::setGridPoints ( std::vector< double > const &  xValues)
overridevirtual

Sets the grid points for evaluation.

The evaluation method should allow for arbitrary grid points to achieve maximal modularity.

Implements sgpp::combigrid::AbstractLinearEvaluator< FloatArrayVector >.

References python.statsfileInfo::i, and python.utils.statsfile2gnuplot::j.

Referenced by getBasisCoefficients(), and sgpp::combigrid::BSplineInterpolationCoefficientEvaluator::setGridPoints().

◆ setParameter()

void sgpp::combigrid::BSplineScalarProductEvaluator::setParameter ( FloatArrayVector const &  param)
overridevirtual

Via this method, the parameter can be set.

Implements sgpp::combigrid::AbstractLinearEvaluator< FloatArrayVector >.

Referenced by getBasisCoefficients().

◆ setWeightFunction()

void sgpp::combigrid::BSplineScalarProductEvaluator::setWeightFunction ( sgpp::combigrid::SingleFunction  weight_function)
inlineoverridevirtual

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