Template Numerical Library version\ main:88903d64
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
TNL::Solvers::Optimization::Momentum< Vector, SolverMonitor > Class Template Reference
Inheritance diagram for TNL::Solvers::Optimization::Momentum< Vector, SolverMonitor >:
Inheritance graph
[legend]
Collaboration diagram for TNL::Solvers::Optimization::Momentum< Vector, SolverMonitor >:
Collaboration graph
[legend]

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< Real, Index, SolverMonitor >
using SolverMonitorType = SolverMonitor
 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< Real, Index, SolverMonitor >
 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 RealgetConvergenceResidue () const
 Gets the the convergence threshold.
 
const RealgetDivergenceResidue () const
 Gets the limit for the divergence criterion.
 
const Index & getIterations () const
 Gets the number of iterations performed by the solver so far.
 
const Index & getMaxIterations () const
 Gets the maximal number of iterations the solver is allowed to perform.
 
const Index & getMinIterations () const
 Gets the minimal number of iterations the solver is supposed to do.
 
const RealgetResidue () 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 Real &convergenceResidue)
 Sets the threshold for the convergence.
 
void setDivergenceResidue (const Real &divergenceResidue)
 Sets the residue limit for the divergence criterion.
 
void setMaxIterations (const Index &maxIterations)
 Sets the maximal number of iterations the solver is allowed to perform.
 
void setMinIterations (const Index &minIterations)
 Sets the minimal number of iterations the solver is supposed to do.
 
void setRefreshRate (const Index &refreshRate)
 Sets the refresh rate (in milliseconds) for the solver monitor.
 
void setResidue (const Real &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< Real, Index, SolverMonitor >
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< Real, Index, SolverMonitor >
Real convergenceResidue = 1e-6
 
Index currentIteration = 0
 
Real currentResidue = 0
 
Real divergenceResidue = std::numeric_limits< Real >::max()
 
Index maxIterations = 1000000000
 
Index minIterations = 0
 
Index refreshRate = 1
 
std::ofstream residualHistoryFile
 
std::string residualHistoryFileName = ""
 
SolverMonitorsolverMonitor = nullptr
 

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