JDFTx  1.1.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)=0
 Returns the objective function at the current state and store the gradient in grad, if non-null.
 
virtual Vector precondition (const Vector &grad)
 
virtual bool report (int iter)
 
virtual void constrain (Vector &)
 
virtual double sync (double x) const
 Override to synchronize scalars over MPI processes (if the same minimization is happening in sync over many processes)
 
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

template<typename Vector>
virtual void Minimizable< Vector >::constrain ( Vector &  )
inlinevirtual

Constrain an arbitrary vector to the space of free directions for minimize. Used only to generate a random direction for fdTest within the valid minimization subspace.

Reimplemented in IonicMinimizer, WannierMinimizer, ElecMinimizer, LatticeMinimizer, BandMinimizer, and InverseKohnSham.

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

template<typename Vector>
virtual Vector Minimizable< Vector >::precondition ( const Vector &  grad)
inlinevirtual

Override to enable preconditioning: return the preconditioned gradient, given the gradient The last call to compute() is guaranteed to be at the same position, so a cached result may be returned

Reimplemented in InvertKS, FluidMixture, WannierMinimizer, IonicMinimizer, ElecMinimizer, NonlinearPCM, LatticeMinimizer, InverseKohnSham, BandMinimizer, and WannierMinimizerFD.

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, IonicMinimizer, ElecMinimizer, LatticeMinimizer, InverseKohnSham, and BandMinimizer.


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