carl
24.04
Computer ARithmetic Library
|
Represents a single term, that is a numeric coefficient and a monomial. More...
#include <Term.h>
Public Member Functions | |
Term ()=default | |
Default constructor. More... | |
Term (const Coefficient &c) | |
Constructs a term of value . More... | |
Term (Variable v) | |
Constructs a term of value . More... | |
Term (Monomial::Arg m) | |
Constructs a term of value . More... | |
Term (Monomial::Arg &&m) | |
Constructs a term of value . More... | |
Term (const Coefficient &c, Monomial::Arg m) | |
Constructs a term of value . More... | |
Term (Coefficient &&c, Monomial::Arg &&m) | |
Constructs a term of value . More... | |
Term (const Coefficient &c, Variable v, uint e) | |
Constructs a term of value . More... | |
Coefficient & | coeff () |
Get the coefficient. More... | |
const Coefficient & | coeff () const |
Monomial::Arg & | monomial () |
Get the monomial. More... | |
const Monomial::Arg & | monomial () const |
uint | tdeg () const |
Gives the total degree, i.e. More... | |
bool | is_zero () const |
Checks whether the term is zero. More... | |
bool | is_one () const |
Checks whether the term equals one. More... | |
bool | is_constant () const |
Checks whether the monomial is a constant. More... | |
bool | integer_valued () const |
bool | is_linear () const |
Checks whether the monomial has exactly the degree one. More... | |
std::size_t | num_variables () const |
bool | has (Variable v) const |
Term | drop_variable (Variable v) const |
Removes the given variable from the term. More... | |
bool | has_no_other_variable (Variable v) const |
Checks if the monomial is either a constant or the only variable occuring is the variable v. More... | |
bool | is_single_variable () const |
Variable | single_variable () const |
For terms with exactly one variable, get this variable. More... | |
bool | is_square () const |
Checks if the term is a square. More... | |
void | clear () |
Set the term to zero with the canonical representation. More... | |
void | negate () |
Negates the term by negating the coefficient. More... | |
Term | divide (const Coefficient &c) const |
bool | divide (const Coefficient &c, Term &res) const |
bool | divide (Variable v, Term &res) const |
bool | divide (const Monomial::Arg &m, Term &res) const |
bool | divide (const Term &t, Term &res) const |
Term | calcLcmAndDivideBy (const Monomial::Arg &m) const |
bool | sqrt (Term &res) const |
Calculates the square root of this term. More... | |
template<typename C = Coefficient, EnableIf< is_field_type< C >> = dummy> | |
bool | divisible (const Term &t) const |
template<typename C = Coefficient, DisableIf< is_field_type< C >> = dummy> | |
bool | divisible (const Term &t) const |
bool | is_consistent () const |
Static Public Member Functions | |
static bool | monomialEqual (const Term &lhs, const Term &rhs) |
Checks if two terms have the same monomial. More... | |
static bool | monomialEqual (const std::shared_ptr< const Term > &lhs, const std::shared_ptr< const Term > &rhs) |
static bool | monomialLess (const Term &lhs, const Term &rhs) |
static bool | monomialLess (const std::shared_ptr< const Term > &lhs, const std::shared_ptr< const Term > &rhs) |
Private Types | |
using | CoefficientType = Coefficient |
Private Attributes | |
CoefficientType | mCoeff = constant_zero<CoefficientType>::get() |
Monomial::Arg | mMonomial |
Friends | |
template<typename Coeff > | |
std::ostream & | operator<< (std::ostream &os, const Term< Coeff > &rhs) |
Streaming operator for Term. More... | |
Division operators | |
template<typename Coeff > | |
const Term< Coeff > | operator/ (const Term< Coeff > &lhs, uint rhs) |
Perform a division involving a term. More... | |
Represents a single term, that is a numeric coefficient and a monomial.
|
private |
|
default |
Default constructor.
Constructs a term of value zero.
|
explicit |
Constructs a term of value .
c | Coefficient. |
|
explicit |
Constructs a term of value .
v | Variable. |
|
explicit |
Constructs a term of value .
m | Monomial pointer. |
|
explicit |
Constructs a term of value .
m | Monomial pointer. |
carl::Term< Coefficient >::Term | ( | const Coefficient & | c, |
Monomial::Arg | m | ||
) |
Constructs a term of value .
c | Coefficient. |
m | Monomial pointer. |
carl::Term< Coefficient >::Term | ( | Coefficient && | c, |
Monomial::Arg && | m | ||
) |
Constructs a term of value .
c | Coefficient. |
m | Monomial pointer. |
carl::Term< Coefficient >::Term | ( | const Coefficient & | c, |
Variable | v, | ||
uint | e | ||
) |
Constructs a term of value .
c | Coefficient. |
v | Variable. |
e | Exponent. |
Term carl::Term< Coefficient >::calcLcmAndDivideBy | ( | const Monomial::Arg & | m | ) | const |
|
inline |
|
inline |
|
inline |
Term carl::Term< Coefficient >::divide | ( | const Coefficient & | c | ) | const |
c | a non-zero coefficient. |
bool carl::Term< Coefficient >::divide | ( | const Coefficient & | c, |
Term< Coefficient > & | res | ||
) | const |
bool carl::Term< Coefficient >::divide | ( | const Monomial::Arg & | m, |
Term< Coefficient > & | res | ||
) | const |
bool carl::Term< Coefficient >::divide | ( | const Term< Coefficient > & | t, |
Term< Coefficient > & | res | ||
) | const |
bool carl::Term< Coefficient >::divide | ( | Variable | v, |
Term< Coefficient > & | res | ||
) | const |
bool carl::Term< Coefficient >::divisible | ( | const Term< Coefficient > & | t | ) | const |
bool carl::Term< Coefficient >::divisible | ( | const Term< Coefficient > & | t | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
bool carl::Term< Coefficient >::is_consistent | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
bool carl::Term< Coefficient >::sqrt | ( | Term< Coefficient > & | res | ) | const |
Calculates the square root of this term.
Returns true, iff the term is a square as checked by is_square(). In that case, res will changed to be the square root. Otherwise, res is undefined.
res | Square root of this term. |
|
inline |
|
friend |
Perform a division involving a term.
lhs | Left hand side. |
rhs | Right hand side. |
lhs / rhs
|
private |
|
private |