SG++-Doxygen-Documentation
sgpp::combigrid::CombigridEvaluator< V > Class Template Reference

The CombigridEvaluator class evaluates a numerical method on different full grids and combines them using the combination technique. More...

#include <CombigridEvaluator.hpp>

Inheritance diagram for sgpp::combigrid::CombigridEvaluator< V >:
sgpp::combigrid::AbstractLevelEvaluator

Public Member Functions

bool addLevel (MultiIndex const &level)
 For some reason, SWIG cannot convert the shared_ptr into the more abstract type, so we need this 'duplicate'. More...
 
void addLevelsFromSerializedStructure (std::string serializedStructure)
 Equivalent to deserializing serializedStructure and then calling addLevelsFromStructure(). More...
 
void addLevelsFromStructure (std::shared_ptr< TreeStorage< uint8_t >> storage)
 Adds all levels for which an entry is contained in storage. More...
 
void clear ()
 Clears the already computed values. More...
 
 CombigridEvaluator (size_t numDimensions, std::shared_ptr< AbstractFullGridEvaluator< V >> multiEval, std::shared_ptr< NormStrategy< V >> normStrategy=nullptr)
 Constructor. More...
 
bool containsLevel (MultiIndex const &level)
 
std::shared_ptr< AbstractMultiStorage< V > > differences () const
 Returns the storage with the Delta-values. More...
 
std::vector< base::DataVectorgetAllGridPoints ()
 
double getDifferenceNorm (MultiIndex const &level)
 
base::DataMatrix getGridPointMatrix ()
 
std::shared_ptr< TreeStorage< uint8_t > > getLevelStructure ()
 
std::vector< ThreadPool::TaskgetLevelTasks (MultiIndex const &level, ThreadPool::Task callback)
 
std::string getSerializedLevelStructure ()
 
size_t getUpperPointBound () const
 
getValue () const
 
size_t maxNewPoints (MultiIndex const &level)
 
size_t maxNumPointsForRegular (size_t q)
 
size_t numDims () const
 
size_t numPoints (MultiIndex const &level)
 
virtual void setMutex (std::shared_ptr< std::recursive_mutex > mutexPtr)
 Sets the mutex that is locked (if not nullptr) whenever problematic operations on data are executed. More...
 
- Public Member Functions inherited from sgpp::combigrid::AbstractLevelEvaluator
virtual ~AbstractLevelEvaluator ()
 

Detailed Description

template<typename V>
class sgpp::combigrid::CombigridEvaluator< V >

The CombigridEvaluator class evaluates a numerical method on different full grids and combines them using the combination technique.

The numerical method on a full grid is given by an AbstractFullGridEvaluator. The template parameter V determines whether this does single or multi evaluation, confer also the description in algebraic/FloatArrayVector.hpp

Constructor & Destructor Documentation

◆ CombigridEvaluator()

template<typename V >
sgpp::combigrid::CombigridEvaluator< V >::CombigridEvaluator ( size_t  numDimensions,
std::shared_ptr< AbstractFullGridEvaluator< V >>  multiEval,
std::shared_ptr< NormStrategy< V >>  normStrategy = nullptr 
)
inline

Constructor.

Parameters
numDimensionsDimensionality of the problem.
multiEvalEvaluation method for full grids whose results are then combined into a single value.
normStrategydefines how the norm of differences is computed.

Member Function Documentation

◆ addLevel()

template<typename V >
bool sgpp::combigrid::CombigridEvaluator< V >::addLevel ( MultiIndex const &  level)
inlinevirtual

For some reason, SWIG cannot convert the shared_ptr into the more abstract type, so we need this 'duplicate'.

Performs an evaluation on the given level and adds the gained information to the current numerical approximation value.

Returns
Returns true if the level was already there or (if it was computed and the difference was not nan or +-inf).

Implements sgpp::combigrid::AbstractLevelEvaluator.

References CGLOG, sgpp::combigrid::CombigridEvaluator< V >::containsLevel(), level, sgpp::combigrid::CombigridEvaluator< V >::maxNewPoints(), python.convergence::norm(), and python.utils.pca_normalize_dataset::V.

Referenced by sgpp::combigrid::CombigridEvaluator< V >::addLevelsFromStructure().

◆ addLevelsFromSerializedStructure()

template<typename V >
void sgpp::combigrid::CombigridEvaluator< V >::addLevelsFromSerializedStructure ( std::string  serializedStructure)
inline

Equivalent to deserializing serializedStructure and then calling addLevelsFromStructure().

"Inverse" operation to getSerializedLevelStructure().

References sgpp::combigrid::CombigridEvaluator< V >::addLevelsFromStructure().

◆ addLevelsFromStructure()

template<typename V >
void sgpp::combigrid::CombigridEvaluator< V >::addLevelsFromStructure ( std::shared_ptr< TreeStorage< uint8_t >>  storage)
inline

Adds all levels for which an entry is contained in storage.

"Inverse" operation to getLevelStructure().

References sgpp::combigrid::CombigridEvaluator< V >::addLevel().

Referenced by sgpp::combigrid::CombigridEvaluator< V >::addLevelsFromSerializedStructure().

◆ clear()

template<typename V >
void sgpp::combigrid::CombigridEvaluator< V >::clear ( )
inlinevirtual

Clears the already computed values.

This method has to be called if a parameter changed etc.

Implements sgpp::combigrid::AbstractLevelEvaluator.

◆ containsLevel()

template<typename V >
bool sgpp::combigrid::CombigridEvaluator< V >::containsLevel ( MultiIndex const &  level)
inlinevirtual
Returns
true iff the given level has already been added.

Implements sgpp::combigrid::AbstractLevelEvaluator.

Referenced by sgpp::combigrid::CombigridEvaluator< V >::addLevel().

◆ differences()

template<typename V >
std::shared_ptr<AbstractMultiStorage<V> > sgpp::combigrid::CombigridEvaluator< V >::differences ( ) const
inline

Returns the storage with the Delta-values.

◆ getAllGridPoints()

template<typename V >
std::vector<base::DataVector> sgpp::combigrid::CombigridEvaluator< V >::getAllGridPoints ( )
inlinevirtual
Returns
a vector with all grid points where the function has been evaluated (without duplicates).

Implements sgpp::combigrid::AbstractLevelEvaluator.

References friedman::p.

Referenced by sgpp::combigrid::CombigridEvaluator< V >::getGridPointMatrix().

◆ getDifferenceNorm()

template<typename V >
double sgpp::combigrid::CombigridEvaluator< V >::getDifferenceNorm ( MultiIndex const &  level)
inlinevirtual
Returns
the norm of the difference/Delta value (in the single-evaluation case this is the absolute value) for the given level.

Implements sgpp::combigrid::AbstractLevelEvaluator.

◆ getGridPointMatrix()

template<typename V >
base::DataMatrix sgpp::combigrid::CombigridEvaluator< V >::getGridPointMatrix ( )
inlinevirtual
Returns
a DataMatrix with all grid points where the function has been evaluated in its columns (without duplicates)

Implements sgpp::combigrid::AbstractLevelEvaluator.

References sgpp::combigrid::CombigridEvaluator< V >::getAllGridPoints(), python.statsfileInfo::i, and m.

◆ getLevelStructure()

template<typename V >
std::shared_ptr<TreeStorage<uint8_t> > sgpp::combigrid::CombigridEvaluator< V >::getLevelStructure ( )
inlinevirtual
Returns
a TreeStorage which contains an entry at an index i iff the level i has been added to this CombigridEvaluator.

Implements sgpp::combigrid::AbstractLevelEvaluator.

Referenced by sgpp::combigrid::CombigridEvaluator< V >::getSerializedLevelStructure().

◆ getLevelTasks()

template<typename V >
std::vector<ThreadPool::Task> sgpp::combigrid::CombigridEvaluator< V >::getLevelTasks ( MultiIndex const &  level,
ThreadPool::Task  callback 
)
inlinevirtual
Returns
a vector of tasks which can be precomputed in parallel to make the (serialized) execution of addLevel() faster
Parameters
levelthe level which one wants to compute
callbackThis callback is called (with already locked mutex) from inside one of the returned tasks when all tasks for the given level are completed and the level can be added.

Implements sgpp::combigrid::AbstractLevelEvaluator.

◆ getSerializedLevelStructure()

template<typename V >
std::string sgpp::combigrid::CombigridEvaluator< V >::getSerializedLevelStructure ( )
inline

◆ getUpperPointBound()

template<typename V >
size_t sgpp::combigrid::CombigridEvaluator< V >::getUpperPointBound ( ) const
inlinevirtual
Returns
An upper bound for the number of points (function evaluations) used for the current computation. This bound is exact if nesting is used or if otherwise each grid point only occurs in exactly one level.

Implements sgpp::combigrid::AbstractLevelEvaluator.

◆ getValue()

template<typename V >
V sgpp::combigrid::CombigridEvaluator< V >::getValue ( ) const
inline
Returns
the numerical approximation value computed by the combination technique. No computation is done here.

◆ maxNewPoints()

template<typename V >
size_t sgpp::combigrid::CombigridEvaluator< V >::maxNewPoints ( MultiIndex const &  level)
inlinevirtual
Returns
an estimate (upper bound, in the case of nested points normally exact) of the number of new function evaluations (grid points) that have to be performed when adding this level.

Implements sgpp::combigrid::AbstractLevelEvaluator.

Referenced by sgpp::combigrid::CombigridEvaluator< V >::addLevel(), and sgpp::combigrid::CombigridEvaluator< V >::maxNumPointsForRegular().

◆ maxNumPointsForRegular()

template<typename V >
size_t sgpp::combigrid::CombigridEvaluator< V >::maxNumPointsForRegular ( size_t  q)
inlinevirtual

◆ numDims()

template<typename V >
size_t sgpp::combigrid::CombigridEvaluator< V >::numDims ( ) const
inlinevirtual
Returns
the dimensionality of the problem.

Implements sgpp::combigrid::AbstractLevelEvaluator.

◆ numPoints()

template<typename V >
size_t sgpp::combigrid::CombigridEvaluator< V >::numPoints ( MultiIndex const &  level)
inlinevirtual
Returns
the total number of grid points in a given level.

Implements sgpp::combigrid::AbstractLevelEvaluator.

◆ setMutex()

template<typename V >
virtual void sgpp::combigrid::CombigridEvaluator< V >::setMutex ( std::shared_ptr< std::recursive_mutex >  mutexPtr)
inlinevirtual

Sets the mutex that is locked (if not nullptr) whenever problematic operations on data are executed.

Implements sgpp::combigrid::AbstractLevelEvaluator.


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