JDFTx  1.7.0
Minimizable< Vector > Struct Template Referenceabstract

#include <Minimize.h>

Public Member Functions

virtual void step (const Vector &dir, double alpha)=0
 Move the state in parameter space along direction dir with scale alpha.
 
virtual double compute (Vector *grad, Vector *Kgrad)=0
 Returns the objective function at the current state and store the gradient in grad and preconditioned gradient in Kgrad, if non-null.
 
virtual bool report (int iter)
 
virtual void constrain (Vector &)
 Constrain search directions to the space of free directions for minimize.
 
virtual double sync (double x) const
 Override to synchronize scalars over MPI processes (if the same minimization is happening in sync over many processes)
 
virtual double safeStepSize (const Vector &dir) const
 Override to return maximum safe step size along a given direction. Steps can be arbitrarily large by default.
 
double minimize (const MinimizeParams &params)
 Minimize this objective function with algorithm controlled by params and return the minimized value.
 
void fdTest (const MinimizeParams &params)
 

Detailed Description

template<typename Vector>
struct Minimizable< Vector >

Interface (abstract base class) for the minimization algorithm template

Template Parameters
VectorA data type that represents a direction in the tangent space of the parameter manifold, which must have the following functions/operators defined:
  • Vector& operator*=(double); (scalar multiply)
  • void axpy(double alpha, const Vector& X, Vector& Y); (accumulate operation: Y += alpha*X)
  • double dot(const Vector& X, const Vector& Y); (inner product)
  • Vector clone(const Vector& X); (create a copy)
  • void randomize(Vector&); (initialize with random numbers, used for auto-fdtests)

Member Function Documentation

◆ fdTest()

template<typename Vector >
void Minimizable< Vector >::fdTest ( const MinimizeParams params)

Checks the consistency of the value and gradient returned by compute. params is used primarily to control output

◆ report()

template<typename Vector >
virtual bool Minimizable< Vector >::report ( int  iter)
inlinevirtual

Override for optional processing/reporting after each/every few iterations It should return whether the state was modified

Reimplemented in WannierMinimizer, NonlinearPCM, LatticeMinimizer, IonicMinimizer, and ElecMinimizer.


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