Template Numerical Library version\ main:52827a2
Loading...
Searching...
No Matches
TNL::Solvers::Optimization::Momentum< Vector, SolverMonitor > Class Template Reference
Inheritance diagram for TNL::Solvers::Optimization::Momentum< Vector, SolverMonitor >:
Collaboration diagram for TNL::Solvers::Optimization::Momentum< Vector, SolverMonitor >:

Public Types

using DeviceType = typename Vector::DeviceType
 
using IndexType = typename Vector::IndexType
 
using RealType = typename Vector::RealType
 
using VectorType = Vector
 
using VectorView = typename Vector::ViewType
 
- Public Types inherited from TNL::Solvers::IterativeSolver< Vector::RealType, Vector::IndexType, IterativeSolverMonitor< typename Vector::RealType, typename Vector::IndexType > >
using SolverMonitorType
 Type of an object used for monitoring of the convergence.
 

Public Member Functions

const RealType & getMomentum () const
 
const RealType & getRelaxation () const
 
void setMomentum (const RealType &beta)
 
void setRelaxation (const RealType &lambda)
 
bool setup (const Config::ParameterContainer &parameters, const std::string &prefix="")
 
template<typename GradientGetter >
bool solve (VectorView &w, GradientGetter &&getGradient)
 
- Public Member Functions inherited from TNL::Solvers::IterativeSolver< Vector::RealType, Vector::IndexType, IterativeSolverMonitor< typename Vector::RealType, typename Vector::IndexType > >
 IterativeSolver ()=default
 Default constructor.
 
bool checkConvergence ()
 Checks whether the convergence occurred already.
 
bool checkNextIteration ()
 Checks if the solver is allowed to do the next iteration.
 
const Vector::RealType & getConvergenceResidue () const
 Gets the the convergence threshold.
 
const Vector::RealType & getDivergenceResidue () const
 Gets the limit for the divergence criterion.
 
const Vector::IndexType & getIterations () const
 Gets the number of iterations performed by the solver so far.
 
const Vector::IndexType & getMaxIterations () const
 Gets the maximal number of iterations the solver is allowed to perform.
 
const Vector::IndexType & getMinIterations () const
 Gets the minimal number of iterations the solver is supposed to do.
 
const Vector::RealType & getResidue () const
 Gets the residue reached at the current iteration.
 
bool nextIteration ()
 Proceeds to the next iteration.
 
void resetIterations ()
 Sets the the number of the current iterations to zero.
 
void setConvergenceResidue (const Vector::RealType &convergenceResidue)
 Sets the threshold for the convergence.
 
void setDivergenceResidue (const Vector::RealType &divergenceResidue)
 Sets the residue limit for the divergence criterion.
 
void setMaxIterations (const Vector::IndexType &maxIterations)
 Sets the maximal number of iterations the solver is allowed to perform.
 
void setMinIterations (const Vector::IndexType &minIterations)
 Sets the minimal number of iterations the solver is supposed to do.
 
void setRefreshRate (const Vector::IndexType &refreshRate)
 Sets the refresh rate (in milliseconds) for the solver monitor.
 
void setResidue (const Vector::RealType &residue)
 Sets the residue reached at the current iteration.
 
void setSolverMonitor (SolverMonitorType &solverMonitor)
 Sets the solver monitor object.
 
bool setup (const Config::ParameterContainer &parameters, const std::string &prefix="")
 Method for setup of the iterative solver based on configuration parameters.
 

Static Public Member Functions

static void configSetup (Config::ConfigDescription &config, const std::string &prefix="")
 
- Static Public Member Functions inherited from TNL::Solvers::IterativeSolver< Vector::RealType, Vector::IndexType, IterativeSolverMonitor< typename Vector::RealType, typename Vector::IndexType > >
static void configSetup (Config::ConfigDescription &config, const std::string &prefix="")
 This method defines configuration entries for setup of the iterative solver.
 

Protected Attributes

VectorType gradient
 
RealType momentum = 0.9
 
RealType relaxation = 1.0
 
VectorType v
 
- Protected Attributes inherited from TNL::Solvers::IterativeSolver< Vector::RealType, Vector::IndexType, IterativeSolverMonitor< typename Vector::RealType, typename Vector::IndexType > >
Vector::RealType convergenceResidue
 
Vector::IndexType currentIteration
 
Vector::RealType currentResidue
 
Vector::RealType divergenceResidue
 
Vector::IndexType maxIterations
 
Vector::IndexType minIterations
 
Vector::IndexType refreshRate
 
std::ofstream residualHistoryFile
 
std::string residualHistoryFileName
 
IterativeSolverMonitor< typename Vector::RealType, typename Vector::IndexType > * solverMonitor
 

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