MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::SparsePolynomial< C, D, M > Class Template Reference

#include <MRSparsePolynomial.h>

Public Member Functions

 SparsePolynomial ()=default
 constructs zero polynomial
 
 SparsePolynomial (std::map< D, C > &&)
 takes existing coefficients in ownership
 
 SparsePolynomial (C c0, D d1, C c1)
 constructs polynomial c0 + c1*x^d1
 
 SparsePolynomial (C c0, D d1, C c1, D d2, C c2)
 constructs polynomial c0 + c1*x^d1 + c2*x^d2
 
void setZeroCoeff (D d)
 sets coefficient for given degree to zero
 
bool empty () const
 returns true if no single polynomial coefficient is defined
 
bool isPositive () const
 returns true if the coefficient for the smallest not-zero degress is positive
 
const std::map< D, C > & get () const
 gets read-only access to all not-zero coefficients
 
SparsePolynomialoperator+= (const SparsePolynomial &b)
 
SparsePolynomialoperator-= (const SparsePolynomial &b)
 

Friends

SparsePolynomial operator* (const SparsePolynomial &a, const SparsePolynomial &b)
 

Detailed Description

template<typename C, typename D, D M>
class MR::SparsePolynomial< C, D, M >

The class to store a polynomial with a large number of zero coefficient (only non-zeros are stored in std::map)

Template Parameters
C- type of coefficients
D- type of degrees
M- maximum degree to store in the polynomial

Constructor & Destructor Documentation

◆ SparsePolynomial() [1/4]

template<typename C , typename D , D M>
MR::SparsePolynomial< C, D, M >::SparsePolynomial ( )
default

constructs zero polynomial

◆ SparsePolynomial() [2/4]

template<typename C , typename D , D M>
MR::SparsePolynomial< C, D, M >::SparsePolynomial ( std::map< D, C > && m)

takes existing coefficients in ownership

◆ SparsePolynomial() [3/4]

template<typename C , typename D , D M>
MR::SparsePolynomial< C, D, M >::SparsePolynomial ( C c0,
D d1,
C c1 )

constructs polynomial c0 + c1*x^d1

◆ SparsePolynomial() [4/4]

template<typename C , typename D , D M>
MR::SparsePolynomial< C, D, M >::SparsePolynomial ( C c0,
D d1,
C c1,
D d2,
C c2 )

constructs polynomial c0 + c1*x^d1 + c2*x^d2

Member Function Documentation

◆ empty()

template<typename C , typename D , D M>
bool MR::SparsePolynomial< C, D, M >::empty ( ) const
inlinenodiscard

returns true if no single polynomial coefficient is defined

◆ get()

template<typename C , typename D , D M>
const std::map< D, C > & MR::SparsePolynomial< C, D, M >::get ( ) const
inlinenodiscard

gets read-only access to all not-zero coefficients

◆ isPositive()

template<typename C , typename D , D M>
bool MR::SparsePolynomial< C, D, M >::isPositive ( ) const
nodiscard

returns true if the coefficient for the smallest not-zero degress is positive

◆ operator+=()

template<typename C , typename D , D M>
SparsePolynomial< C, D, M > & MR::SparsePolynomial< C, D, M >::operator+= ( const SparsePolynomial< C, D, M > & b)

◆ operator-=()

template<typename C , typename D , D M>
SparsePolynomial< C, D, M > & MR::SparsePolynomial< C, D, M >::operator-= ( const SparsePolynomial< C, D, M > & b)

◆ setZeroCoeff()

template<typename C , typename D , D M>
void MR::SparsePolynomial< C, D, M >::setZeroCoeff ( D d)
inline

sets coefficient for given degree to zero

Friends And Related Symbol Documentation

◆ operator*

template<typename C , typename D , D M>
SparsePolynomial operator* ( const SparsePolynomial< C, D, M > & a,
const SparsePolynomial< C, D, M > & b )
friend

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