carl
24.04
Computer ARithmetic Library
|
#include <RationalFunction.h>
Public Types | |
using | PolyType = Pol |
using | CoeffType = typename Pol::CoeffType |
using | NumberType = typename Pol::NumberType |
Public Member Functions | |
RationalFunction () | |
RationalFunction (int v) | |
RationalFunction (const CoeffType &c) | |
template<typename P = Pol, DisableIf< needs_cache_type< P >> = dummy> | |
RationalFunction (Variable v) | |
RationalFunction (const Pol &p) | |
RationalFunction (Pol &&p) | |
RationalFunction (const Pol &nom, const Pol &denom) | |
RationalFunction (Pol &&nom, Pol &&denom) | |
RationalFunction (std::optional< std::pair< Pol, Pol >> &"ient, const CoeffType &num, bool simplified) | |
RationalFunction (const RationalFunction &_rf)=default | |
RationalFunction (RationalFunction &&_rf)=default | |
~RationalFunction () noexcept=default | |
RationalFunction & | operator= (const RationalFunction &_rf)=default |
RationalFunction & | operator= (RationalFunction &&_rf)=default |
Pol | nominator () const |
Pol | denominator () const |
const Pol & | nominatorAsPolynomial () const |
const Pol & | denominatorAsPolynomial () const |
CoeffType | nominatorAsNumber () const |
CoeffType | denominatorAsNumber () const |
bool | isSimplified () const |
Checks if this rational function has been simplified since it's last modification. More... | |
void | simplify () |
RationalFunction | inverse () const |
Returns the inverse of this rational function. More... | |
bool | is_zero () const |
Check whether the rational function is zero. More... | |
bool | is_one () const |
bool | is_constant () const |
CoeffType | constant_part () const |
std::set< Variable > | gatherVariables () const |
Collect all occurring variables. More... | |
void | gatherVariables (std::set< Variable > &vars) const |
Add all occurring variables to the set vars. More... | |
CoeffType | evaluate (const std::map< Variable, CoeffType > &substitutions) const |
Evaluate the polynomial at the point described by substitutions. More... | |
RationalFunction | substitute (const std::map< Variable, CoeffType > &substitutions) const |
RationalFunction | derivative (const Variable &x, unsigned nth=1) const |
Derivative of the rational function with respect to variable x. More... | |
std::string | toString (bool infix=true, bool friendlyNames=true) const |
In-place addition operators | |
RationalFunction & | operator+= (const RationalFunction &rhs) |
Add something to this rational function and return the changed rational function. More... | |
RationalFunction & | operator+= (const Pol &rhs) |
Add something to this rational function and return the changed rational function. More... | |
RationalFunction & | operator+= (const Term< CoeffType > &rhs) |
Add something to this rational function and return the changed rational function. More... | |
RationalFunction & | operator+= (const Monomial::Arg &rhs) |
Add something to this rational function and return the changed rational function. More... | |
template<typename P = Pol, DisableIf< needs_cache_type< P >> = dummy> | |
RationalFunction & | operator+= (Variable rhs) |
Add something to this rational function and return the changed rational function. More... | |
RationalFunction & | operator+= (const CoeffType &rhs) |
Add something to this rational function and return the changed rational function. More... | |
In-place subtraction operators | |
RationalFunction & | operator-= (const RationalFunction &rhs) |
Subtract something from this rational function and return the changed rational function. More... | |
RationalFunction & | operator-= (const Pol &rhs) |
Subtract something from this rational function and return the changed rational function. More... | |
RationalFunction & | operator-= (const Term< CoeffType > &rhs) |
Subtract something from this rational function and return the changed rational function. More... | |
RationalFunction & | operator-= (const Monomial::Arg &rhs) |
Subtract something from this rational function and return the changed rational function. More... | |
template<typename P = Pol, DisableIf< needs_cache_type< P >> = dummy> | |
RationalFunction & | operator-= (Variable rhs) |
Subtract something from this rational function and return the changed rational function. More... | |
RationalFunction & | operator-= (const CoeffType &rhs) |
Subtract something from this rational function and return the changed rational function. More... | |
In-place multiplication operators | |
RationalFunction & | operator*= (const RationalFunction &rhs) |
Multiply something with this rational function and return the changed rational function. More... | |
RationalFunction & | operator*= (const Pol &rhs) |
Multiply something with this rational function and return the changed rational function. More... | |
RationalFunction & | operator*= (const Term< CoeffType > &rhs) |
Multiply something with this rational function and return the changed rational function. More... | |
RationalFunction & | operator*= (const Monomial::Arg &rhs) |
Multiply something with this rational function and return the changed rational function. More... | |
template<typename P = Pol, DisableIf< needs_cache_type< P >> = dummy> | |
RationalFunction & | operator*= (Variable rhs) |
Multiply something with this rational function and return the changed rational function. More... | |
RationalFunction & | operator*= (const CoeffType &rhs) |
Multiply something with this rational function and return the changed rational function. More... | |
RationalFunction & | operator*= (carl::sint rhs) |
Multiply something with this rational function and return the changed rational function. More... | |
In-place division operators | |
RationalFunction & | operator/= (const RationalFunction &rhs) |
Divide this rational function by something and return the changed rational function. More... | |
RationalFunction & | operator/= (const Pol &rhs) |
Divide this rational function by something and return the changed rational function. More... | |
RationalFunction & | operator/= (const Term< CoeffType > &rhs) |
Divide this rational function by something and return the changed rational function. More... | |
RationalFunction & | operator/= (const Monomial::Arg &rhs) |
Divide this rational function by something and return the changed rational function. More... | |
template<typename P = Pol, DisableIf< needs_cache_type< P >> = dummy> | |
RationalFunction & | operator/= (Variable rhs) |
Divide this rational function by something and return the changed rational function. More... | |
RationalFunction & | operator/= (const CoeffType &rhs) |
Divide this rational function by something and return the changed rational function. More... | |
RationalFunction & | operator/= (unsigned long rhs) |
Divide this rational function by something and return the changed rational function. More... | |
Private Member Functions | |
void | eliminateCommonFactor (bool _justNormalize) |
Helper function for simplify which eliminates the common factor. More... | |
template<bool byInverse = false> | |
RationalFunction & | add (const RationalFunction &rhs) |
template<bool byInverse = false> | |
RationalFunction & | add (const Pol &rhs) |
template<bool byInverse = false, typename P = Pol, DisableIf< needs_cache_type< P >> = dummy> | |
RationalFunction & | add (Variable rhs) |
template<bool byInverse = false> | |
RationalFunction & | add (const CoeffType &rhs) |
Private Attributes | |
std::optional< std::pair< Pol, Pol > > | mPolynomialQuotient |
CoeffType | mNumberQuotient |
bool | mIsSimplified |
Friends | |
template<typename PolA , bool ASA> | |
bool | operator== (const RationalFunction< PolA, ASA > &lhs, const RationalFunction< PolA, ASA > &rhs) |
template<typename PolA , bool ASA> | |
bool | operator< (const RationalFunction< PolA, ASA > &lhs, const RationalFunction< PolA, ASA > &rhs) |
template<typename PolA , bool ASA> | |
std::ostream & | operator<< (std::ostream &os, const RationalFunction< PolA, ASA > &rhs) |
Definition at line 21 of file RationalFunction.h.
using carl::RationalFunction< Pol, AutoSimplify >::CoeffType = typename Pol::CoeffType |
Definition at line 24 of file RationalFunction.h.
using carl::RationalFunction< Pol, AutoSimplify >::NumberType = typename Pol::NumberType |
Definition at line 25 of file RationalFunction.h.
using carl::RationalFunction< Pol, AutoSimplify >::PolyType = Pol |
Definition at line 23 of file RationalFunction.h.
|
inline |
|
inlineexplicit |
Definition at line 37 of file RationalFunction.h.
|
inlineexplicit |
Definition at line 41 of file RationalFunction.h.
|
inlineexplicit |
Definition at line 46 of file RationalFunction.h.
|
inlineexplicit |
Definition at line 51 of file RationalFunction.h.
|
inlineexplicit |
Definition at line 60 of file RationalFunction.h.
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
Definition at line 90 of file RationalFunction.h.
|
default |
|
default |
|
defaultnoexcept |
|
private |
|
private |
|
private |
|
private |
|
inline |
|
inline |
Definition at line 118 of file RationalFunction.h.
|
inline |
Definition at line 151 of file RationalFunction.h.
|
inline |
Definition at line 135 of file RationalFunction.h.
RationalFunction carl::RationalFunction< Pol, AutoSimplify >::derivative | ( | const Variable & | x, |
unsigned | nth = 1 |
||
) | const |
Derivative of the rational function with respect to variable x.
x | the main variable |
nth | which derivative one should take |
Currently only nth = 1 is supported
Curretnly only factorized polynomials are supported
|
private |
Helper function for simplify which eliminates the common factor.
_justNormalize |
|
inline |
Evaluate the polynomial at the point described by substitutions.
substitutions | A mapping from variable to constant values. |
Definition at line 239 of file RationalFunction.h.
|
inline |
Collect all occurring variables.
Definition at line 217 of file RationalFunction.h.
|
inline |
Add all occurring variables to the set vars.
vars |
Definition at line 227 of file RationalFunction.h.
|
inline |
Returns the inverse of this rational function.
Definition at line 176 of file RationalFunction.h.
|
inline |
|
inline |
|
inline |
Check whether the rational function is zero.
Definition at line 189 of file RationalFunction.h.
|
inline |
Checks if this rational function has been simplified since it's last modification.
Note that if AutoSimplify is true, this should always return true.
Definition at line 161 of file RationalFunction.h.
|
inline |
Definition at line 108 of file RationalFunction.h.
|
inline |
Definition at line 143 of file RationalFunction.h.
|
inline |
Definition at line 127 of file RationalFunction.h.
RationalFunction& carl::RationalFunction< Pol, AutoSimplify >::operator*= | ( | carl::sint | rhs | ) |
Multiply something with this rational function and return the changed rational function.
rhs | Right hand side. |
RationalFunction& carl::RationalFunction< Pol, AutoSimplify >::operator*= | ( | const CoeffType & | rhs | ) |
Multiply something with this rational function and return the changed rational function.
rhs | Right hand side. |
|
inline |
Multiply something with this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 368 of file RationalFunction.h.
RationalFunction& carl::RationalFunction< Pol, AutoSimplify >::operator*= | ( | const Pol & | rhs | ) |
Multiply something with this rational function and return the changed rational function.
rhs | Right hand side. |
RationalFunction& carl::RationalFunction< Pol, AutoSimplify >::operator*= | ( | const RationalFunction< Pol, AutoSimplify > & | rhs | ) |
Multiply something with this rational function and return the changed rational function.
rhs | Right hand side. |
|
inline |
Multiply something with this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 365 of file RationalFunction.h.
RationalFunction& carl::RationalFunction< Pol, AutoSimplify >::operator*= | ( | Variable | rhs | ) |
Multiply something with this rational function and return the changed rational function.
rhs | Right hand side. |
|
inline |
Add something to this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 318 of file RationalFunction.h.
|
inline |
Add something to this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 308 of file RationalFunction.h.
|
inline |
Add something to this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 299 of file RationalFunction.h.
|
inline |
Add something to this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 295 of file RationalFunction.h.
|
inline |
Add something to this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 303 of file RationalFunction.h.
|
inline |
Add something to this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 314 of file RationalFunction.h.
|
inline |
Subtract something from this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 351 of file RationalFunction.h.
|
inline |
Subtract something from this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 342 of file RationalFunction.h.
|
inline |
Subtract something from this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 334 of file RationalFunction.h.
|
inline |
Subtract something from this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 330 of file RationalFunction.h.
|
inline |
Subtract something from this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 338 of file RationalFunction.h.
|
inline |
Subtract something from this rational function and return the changed rational function.
rhs | Right hand side. |
Definition at line 347 of file RationalFunction.h.
RationalFunction& carl::RationalFunction< Pol, AutoSimplify >::operator/= | ( | const CoeffType & | rhs | ) |
Divide this rational function by something and return the changed rational function.
rhs | Right hand side. |
|
inline |
Divide this rational function by something and return the changed rational function.
rhs | Right hand side. |
Definition at line 389 of file RationalFunction.h.
RationalFunction& carl::RationalFunction< Pol, AutoSimplify >::operator/= | ( | const Pol & | rhs | ) |
Divide this rational function by something and return the changed rational function.
rhs | Right hand side. |
RationalFunction& carl::RationalFunction< Pol, AutoSimplify >::operator/= | ( | const RationalFunction< Pol, AutoSimplify > & | rhs | ) |
Divide this rational function by something and return the changed rational function.
rhs | Right hand side. |
|
inline |
Divide this rational function by something and return the changed rational function.
rhs | Right hand side. |
Definition at line 386 of file RationalFunction.h.
RationalFunction& carl::RationalFunction< Pol, AutoSimplify >::operator/= | ( | unsigned long | rhs | ) |
Divide this rational function by something and return the changed rational function.
rhs | Right hand side. |
RationalFunction& carl::RationalFunction< Pol, AutoSimplify >::operator/= | ( | Variable | rhs | ) |
Divide this rational function by something and return the changed rational function.
rhs | Right hand side. |
|
default |
|
default |
|
inline |
|
inline |
std::string carl::RationalFunction< Pol, AutoSimplify >::toString | ( | bool | infix = true , |
bool | friendlyNames = true |
||
) | const |
|
friend |
|
friend |
|
friend |
|
private |
Definition at line 30 of file RationalFunction.h.
|
private |
Definition at line 29 of file RationalFunction.h.
|
private |
Definition at line 28 of file RationalFunction.h.