SSAGES  0.8.3
Software Suite for Advanced General Ensemble Simulations
Public Member Functions | Static Public Member Functions | List of all members
SSAGES::Legendre Class Reference

Defines the class of Legendre polynomials. More...

#include <Basis.h>

Inheritance diagram for SSAGES::Legendre:
Inheritance graph
[legend]

Public Member Functions

 Legendre (unsigned int polyOrd, unsigned int nbins)
 Constructor. More...
 
double Evaluate (double x, int n)
 Calculates the output of the basis function. More...
 
double EvalGrad (double x, int n)
 Calculates the gradient of the basis function. More...
 
double GetNorm (int n)
 Gets the norm of the basis function. More...
 
- Public Member Functions inherited from SSAGES::BasisFunction
 BasisFunction (unsigned int polyOrd, unsigned int nbins, bool isFinite, bool zeroOrder, double boundLow, double boundUp)
 Constructor. More...
 
unsigned int GetOrder ()
 Gets the order of the current polynomial.
 
unsigned int GetBins ()
 Gets the number of bins for the discretization.
 
bool GetZeroOrder ()
 Gets the flag for constant-order polynomials.
 
double GetLower ()
 Gets the lower bound on the CV.
 
double GetUpper ()
 Gets the upper bound on the CV.
 
double GetRange ()
 Gets the magnitude of the range of bounds.
 
virtual double Weight (double val)
 Calculates the gradient of the basis function. More...
 
virtual ~BasisFunction ()
 Destructor.
 

Static Public Member Functions

static LegendreBuild (const Json::Value &json, const std::string &path, unsigned int nbins)
 Build the Legendre polynomial.
 
- Static Public Member Functions inherited from SSAGES::BasisFunction
static BasisFunctionBuild (const Json::Value &json, const std::string &path, unsigned int nbins)
 Build BasisFunction from JSON value. More...
 

Additional Inherited Members

- Protected Attributes inherited from SSAGES::BasisFunction
unsigned int polyOrd_
 Order of the polynomial.
 
unsigned int nbins_
 Number of bins.
 
bool isFinite_
 Flag for finite-range polynomials.
 
bool zeroOrder_
 Flag for constant-order polynomials.
 
double boundLow_
 Lower bound on CV.
 
double boundUp_
 Upper bound on CV.
 

Detailed Description

Defines the class of Legendre polynomials.

Definition at line 241 of file Basis.h.

Constructor & Destructor Documentation

◆ Legendre()

SSAGES::Legendre::Legendre ( unsigned int  polyOrd,
unsigned int  nbins 
)
inline

Constructor.

Parameters
polyOrdOrder of Legendre polynomial.
nbinsNumber of bins.

Constructs an instance of the Legendre function class.

Definition at line 253 of file Basis.h.

253  :
254  BasisFunction(polyOrd, nbins, true, false, -1.0, 1.0)
255  {
256  }
BasisFunction(unsigned int polyOrd, unsigned int nbins, bool isFinite, bool zeroOrder, double boundLow, double boundUp)
Constructor.
Definition: Basis.h:84

Member Function Documentation

◆ EvalGrad()

double SSAGES::Legendre::EvalGrad ( double  val,
int  order 
)
inlinevirtual

Calculates the gradient of the basis function.

Parameters
valInput value for function.
orderOrder of the polynomial.
Returns
Gradient for function.

Reimplemented from SSAGES::BasisFunction.

Definition at line 267 of file Basis.h.

268  {
269  return n == 0 ? 0.0 :
270  n == 1 ? 1.0 :
271  (2.0*n-1.0)/(double)n*(Evaluate(x,n-1) + x * EvalGrad(x,n-1)) - (n-1.0)/(double)n*EvalGrad(x,n-2);
272  }
double EvalGrad(double x, int n)
Calculates the gradient of the basis function.
Definition: Basis.h:267
double Evaluate(double x, int n)
Calculates the output of the basis function.
Definition: Basis.h:259

◆ Evaluate()

double SSAGES::Legendre::Evaluate ( double  val,
int  order 
)
inlinevirtual

Calculates the output of the basis function.

Parameters
valInput value for function.
orderOrder of the polynomial.
Returns
Output value for function.

Reimplemented from SSAGES::BasisFunction.

Definition at line 259 of file Basis.h.

260  {
261  return n == 0 ? 1.0 :
262  n == 1 ? x :
263  (2.0*n-1.0)/(double)n*x*Evaluate(x,n-1) - (n-1.0)/(double)n*Evaluate(x,n-2);
264  }
double Evaluate(double x, int n)
Calculates the output of the basis function.
Definition: Basis.h:259

◆ GetNorm()

double SSAGES::Legendre::GetNorm ( int  order)
inlinevirtual

Gets the norm of the basis function.

Parameters
orderOrder of the polynomial.
Returns
Norm of a specific order of polynomial.

Reimplemented from SSAGES::BasisFunction.

Definition at line 274 of file Basis.h.

275  {
276  return n + 0.5;
277  }

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