39 template <CepsUInt _ArgsDim>
112 template <CepsUInt _ArgsDim>
std::array< _Type, _N > CepsArray
C++ arrays.
std::vector< _Type, _Alloc > CepsVector
C++ vector.
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
float CepsReal
Need single precision floating point.
#define FLOATING_POINT_EPSILON
A class that describes a monomial of N variables It contains exponents and coefficients for each dime...
Monomial operator/(const Monomial &other) const
Return this/other. There is no check that the resulting exponents are positive.
CepsReal eval(const ArgType &x) override
Evaluate at x (x in )
GradientType gradient(const ArgType &x) const
Evaluate gradient at x (x in )
Monomial(const ExponentType &exponent={})
Constructor with given exponent (or default)
Monomial(const Monomial &that)
Copy constructor.
CepsArray< CepsReal, _ArgsDim > GradientType
convenience typedef
Monomial operator*(const Monomial &other) const
Return this*other.
void setExponents(const ExponentType &exponent)
Sets all the exponents.
CepsArray< CepsInt, _ArgsDim > ExponentType
convenience typedef
ExponentType m_exponent
The exponents for each dimension.
CepsArray< CepsReal, _ArgsDim > ArgType
convenience typedef
CepsBool operator==(const Monomial &other) const
Check equality of monomes (ie same exponents)
ExponentType getExponents() const
get the exponents
Monomial & operator=(const Monomial &that)
Assignment operator.
A class to represent polynomials, as a collection of Monomial and coefficients.
Polynomial operator*(const Polynomial &b)
Returns this*b.
CepsVector< MonomialType > m_mono
The monomes.
Polynomial()
Default constructor, empty polynomial.
typename Monomial< _ArgsDim >::ArgType ArgType
convenience typedef
void add(const Eigen::Matrix< CepsReal, 1, -1 > &coeffs, const CepsVector< ExponentType > &exponents)
Adds several new monomials to the polynomial, Eigen format.
CepsUInt getNumberOfMonomials() const
Returns "size" of polynomial.
void setCoeff(CepsReal coeff, const ExponentType &exponent)
Change the coefficient of a given monomial.
void add(CepsReal coeff, ExponentType exponent)
Adds a new monomial to the polynomial.
GradientType gradient(const ArgType &x) const
Evaluate gradient at x (x in )
CepsReal eval(const ArgType &x) override
Evaluate at x (x in )
CepsBool contains(const MonomialType &other)
Tells if polynomial contains the given monomial.
typename Monomial< _ArgsDim >::ExponentType ExponentType
convenience typedef
typename Monomial< _ArgsDim >::FunctionType FunctionType
convenience typedef
CepsReal & coeffAt(const ExponentType &other)
Get the coefficient of the associated monomial. 0 if missing.
Polynomial & operator=(const Polynomial &that)
Assignment operator.
Polynomial(const Polynomial &that)
Copy constructor.
void pruneZeroCoeffs(CepsReal epsilon=FLOATING_POINT_EPSILON)
Removes monomial with 0 coefficient.
typename Monomial< _ArgsDim >::GradientType GradientType
convenience typedef
CepsBool contains(const ExponentType &other)
Tells if polynomial contains the given monomial.
CepsVector< CepsReal > m_coeffs
Coefficients for all monomes.
void reset()
Wipes the content.
void add(const CepsVector< CepsReal > &coeffs, const CepsVector< ExponentType > &exponents)
Adds several new monomials to the polynomial.
function caller : abstract base, only contains an variadic operator()