#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 | |
SparsePolynomial & | operator+= (const SparsePolynomial &b) |
SparsePolynomial & | operator-= (const SparsePolynomial &b) |
Friends | |
SparsePolynomial | operator* (const SparsePolynomial &a, const SparsePolynomial &b) |
The class to store a polynomial with a large number of zero coefficient (only non-zeros are stored in std::map)
C | - type of coefficients |
D | - type of degrees |
M | - maximum degree to store in the polynomial |
|
default |
constructs zero polynomial
MR::SparsePolynomial< C, D, M >::SparsePolynomial | ( | std::map< D, C > && | m | ) |
takes existing coefficients in ownership
MR::SparsePolynomial< C, D, M >::SparsePolynomial | ( | C | c0, |
D | d1, | ||
C | c1 ) |
constructs polynomial c0 + c1*x^d1
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
|
inlinenodiscard |
returns true if no single polynomial coefficient is defined
|
inlinenodiscard |
gets read-only access to all not-zero coefficients
|
nodiscard |
returns true if the coefficient for the smallest not-zero degress is positive
SparsePolynomial< C, D, M > & MR::SparsePolynomial< C, D, M >::operator+= | ( | const SparsePolynomial< C, D, M > & | b | ) |
SparsePolynomial< C, D, M > & MR::SparsePolynomial< C, D, M >::operator-= | ( | const SparsePolynomial< C, D, M > & | b | ) |
|
inline |
sets coefficient for given degree to zero
|
friend |