OpenMD  2.5
Molecular Dynamics in the Open
OpenMD::Polynomial< Real > Class Template Reference

#include "math/Polynomial.hpp"

Public Types

typedef Polynomial< Real > PolynomialType
 
typedef int ExponentType
 
typedef Real CoefficientType
 
typedef std::map< ExponentType, CoefficientTypePolynomialPairMap
 
typedef PolynomialPairMap::iterator iterator
 
typedef PolynomialPairMap::const_iterator const_iterator
 

Public Member Functions

 Polynomial ()
 
 Polynomial (Real v)
 
Real evaluate (const Real &x)
 
Real evaluateDerivative (const Real &x)
 
void setCoefficient (int exponent, const Real &coefficient)
 
void addCoefficient (int exponent, const Real &coefficient)
 
Real getCoefficient (ExponentType exponent)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
iterator find (ExponentType exponent)
 
size_t size ()
 
int degree ()
 
PolynomialTypeoperator= (const PolynomialType &p)
 
PolynomialTypeoperator+= (const PolynomialType &p)
 
PolynomialTypeoperator-= (const PolynomialType &p)
 
PolynomialTypeoperator*= (const PolynomialType &p)
 
PolynomialTypeoperator*= (const Real v)
 
PolynomialTypeoperator+= (const Real v)
 
PolynomialTypegetDerivative ()
 
DynamicRectMatrix< Real > CreateCompanion ()
 
std::vector< complex< Real > > FindRoots ()
 
std::vector< Real > FindRealRoots ()
 

Private Attributes

PolynomialPairMap polyPairMap_
 

Detailed Description

template<typename Real>
class OpenMD::Polynomial< Real >

A generic Polynomial class

Definition at line 78 of file Polynomial.hpp.

Member Typedef Documentation

◆ CoefficientType

template<typename Real>
typedef Real OpenMD::Polynomial< Real >::CoefficientType

Definition at line 83 of file Polynomial.hpp.

◆ const_iterator

template<typename Real>
typedef PolynomialPairMap::const_iterator OpenMD::Polynomial< Real >::const_iterator

Definition at line 86 of file Polynomial.hpp.

◆ ExponentType

template<typename Real>
typedef int OpenMD::Polynomial< Real >::ExponentType

Definition at line 82 of file Polynomial.hpp.

◆ iterator

template<typename Real>
typedef PolynomialPairMap::iterator OpenMD::Polynomial< Real >::iterator

Definition at line 85 of file Polynomial.hpp.

◆ PolynomialPairMap

template<typename Real>
typedef std::map<ExponentType, CoefficientType> OpenMD::Polynomial< Real >::PolynomialPairMap

Definition at line 84 of file Polynomial.hpp.

◆ PolynomialType

template<typename Real>
typedef Polynomial<Real> OpenMD::Polynomial< Real >::PolynomialType

Definition at line 81 of file Polynomial.hpp.

Constructor & Destructor Documentation

◆ Polynomial() [1/2]

template<typename Real>
OpenMD::Polynomial< Real >::Polynomial ( )
inline

Definition at line 88 of file Polynomial.hpp.

◆ Polynomial() [2/2]

template<typename Real>
OpenMD::Polynomial< Real >::Polynomial ( Real  v)
inline

Definition at line 89 of file Polynomial.hpp.

Member Function Documentation

◆ addCoefficient()

template<typename Real>
void OpenMD::Polynomial< Real >::addCoefficient ( int  exponent,
const Real &  coefficient 
)
inline

Set the coefficent of the specified exponent. If the coefficient is already there, just add the new coefficient to the old one, otherwise, just call setCoefficent

Parameters
exponentexponent of a term in this Polynomial
coefficientmultiplier of a term in this Polynomial

Definition at line 147 of file Polynomial.hpp.

Referenced by OpenMD::PolynomialInversionType::addCoefficient(), OpenMD::PolynomialTorsionType::addCoefficient(), OpenMD::operator*(), OpenMD::Polynomial< RealType >::operator*=(), OpenMD::operator+(), OpenMD::Polynomial< RealType >::operator+=(), OpenMD::operator-(), and OpenMD::Polynomial< RealType >::operator-=().

◆ begin() [1/2]

◆ begin() [2/2]

template<typename Real>
const_iterator OpenMD::Polynomial< Real >::begin ( ) const
inline

Definition at line 178 of file Polynomial.hpp.

◆ CreateCompanion()

template<typename Real>
DynamicRectMatrix<Real> OpenMD::Polynomial< Real >::CreateCompanion ( )
inline

◆ degree()

◆ end() [1/2]

◆ end() [2/2]

template<typename Real>
const_iterator OpenMD::Polynomial< Real >::end ( ) const
inline

Definition at line 186 of file Polynomial.hpp.

◆ evaluate()

template<typename Real>
Real OpenMD::Polynomial< Real >::evaluate ( const Real &  x)
inline

Calculates the value of this Polynomial evaluated at the given x value.

Returns
The value of this Polynomial evaluates at the given x value
Parameters
xthe value of the independent variable for this Polynomial function

Definition at line 96 of file Polynomial.hpp.

Referenced by OpenMD::LegendreCorrFunc::calcCorrVals(), OpenMD::COHZ::calcCorrVals(), OpenMD::LegendreCorrFuncZ::calcCorrVals(), OpenMD::PolynomialBondType::calcForce(), OpenMD::PolynomialBendType::calcForce(), OpenMD::PolynomialTorsionType::calcForce(), and OpenMD::PolynomialInversionType::calcForce().

◆ evaluateDerivative()

template<typename Real>
Real OpenMD::Polynomial< Real >::evaluateDerivative ( const Real &  x)
inline

Returns the first derivative of this polynomial.

Returns
the first derivative of this polynomial
Parameters
x

Definition at line 115 of file Polynomial.hpp.

Referenced by OpenMD::PolynomialBendType::calcForce(), OpenMD::PolynomialBondType::calcForce(), OpenMD::PolynomialTorsionType::calcForce(), and OpenMD::PolynomialInversionType::calcForce().

◆ find()

template<typename Real>
iterator OpenMD::Polynomial< Real >::find ( ExponentType  exponent)
inline

Definition at line 190 of file Polynomial.hpp.

◆ FindRealRoots()

template<typename Real>
std::vector<Real> OpenMD::Polynomial< Real >::FindRealRoots ( )
inline

◆ FindRoots()

template<typename Real>
std::vector<complex<Real> > OpenMD::Polynomial< Real >::FindRoots ( )
inline

Definition at line 310 of file Polynomial.hpp.

◆ getCoefficient()

template<typename Real>
Real OpenMD::Polynomial< Real >::getCoefficient ( ExponentType  exponent)
inline

Returns the coefficient associated with the given power for this Polynomial.

Returns
the coefficient associated with the given power for this Polynomial
Parameters
exponentexponent of any term in this Polynomial

Definition at line 164 of file Polynomial.hpp.

Referenced by OpenMD::Polynomial< RealType >::CreateCompanion(), OpenMD::Polynomial< RealType >::FindRealRoots(), OpenMD::PolynomialInversionType::getCoefficient(), OpenMD::PolynomialTorsionType::getCoefficient(), OpenMD::PolynomialBondType::getCoefficient(), and OpenMD::PolynomialBendType::getCoefficient().

◆ getDerivative()

template<typename Real>
PolynomialType* OpenMD::Polynomial< Real >::getDerivative ( )
inline

Returns the first derivative of this polynomial.

Returns
the first derivative of this polynomial

Definition at line 276 of file Polynomial.hpp.

◆ operator*=() [1/2]

template<typename Real>
PolynomialType& OpenMD::Polynomial< Real >::operator*= ( const PolynomialType p)
inline

Definition at line 241 of file Polynomial.hpp.

◆ operator*=() [2/2]

template<typename Real>
PolynomialType& OpenMD::Polynomial< Real >::operator*= ( const Real  v)
inline

Definition at line 256 of file Polynomial.hpp.

◆ operator+=() [1/2]

template<typename Real>
PolynomialType& OpenMD::Polynomial< Real >::operator+= ( const PolynomialType p)
inline

Definition at line 223 of file Polynomial.hpp.

◆ operator+=() [2/2]

template<typename Real>
PolynomialType& OpenMD::Polynomial< Real >::operator+= ( const Real  v)
inline

Definition at line 267 of file Polynomial.hpp.

◆ operator-=()

template<typename Real>
PolynomialType& OpenMD::Polynomial< Real >::operator-= ( const PolynomialType p)
inline

Definition at line 233 of file Polynomial.hpp.

◆ operator=()

template<typename Real>
PolynomialType& OpenMD::Polynomial< Real >::operator= ( const PolynomialType p)
inline

Definition at line 207 of file Polynomial.hpp.

◆ setCoefficient()

◆ size()

template<typename Real>
size_t OpenMD::Polynomial< Real >::size ( )
inline

Definition at line 194 of file Polynomial.hpp.

Referenced by OpenMD::equal().

Member Data Documentation

◆ polyPairMap_


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