10 #include <boost/version.hpp>
13 #if BOOST_VERSION >= 105900
14 #ifdef USE_CLN_NUMBERS
15 namespace boost {
namespace spirit {
namespace traits {
16 template<>
inline bool scale(
int exp, cln::cl_RA& r, cln::cl_RA acc) {
23 #if BOOST_VERSION < 107000
24 template<>
inline bool is_equal_to_one(
const cln::cl_RA& value) {
30 namespace boost {
namespace spirit {
namespace traits {
31 template<>
inline bool scale(
int exp, mpq_class& r, mpq_class acc) {
38 #if BOOST_VERSION < 107000
39 template<>
inline bool is_equal_to_one(
const mpq_class& value) {
43 template<>
inline mpq_class negate(
bool neg,
const mpq_class& n) {
44 return neg ? mpq_class(-n) : n;
48 #ifdef USE_CLN_NUMBERS
49 namespace boost {
namespace spirit {
namespace traits {
50 template<>
inline void scale(
int exp, cln::cl_RA& n) {
56 #if BOOST_VERSION < 107000
57 template<>
inline bool is_equal_to_one(
const cln::cl_RA& value) {
63 namespace boost {
namespace spirit {
namespace traits {
64 template<>
inline void scale(
int exp, mpq_class& n) {
70 template<>
inline bool is_equal_to_one(
const mpq_class& value) {
73 template<>
inline mpq_class negate(
bool neg,
const mpq_class& n) {
74 return neg ? mpq_class(-n) : n;
82 template<
typename Pol>
91 varname = qi::lexeme[ (qi::alpha | qi::char_(
"~!@$%^&_=<>.?/")) > *(qi::alnum | qi::char_(
"~!@$%^&_=<>.?/"))];
116 for (
const auto&
term: data) {
130 for (
const auto& op: ops) {
131 switch (boost::fusion::at_c<0>(op)) {
132 case ADD: res += boost::fusion::at_c<1>(op);
break;
133 case SUB: res -= boost::fusion::at_c<1>(op);
break;
139 Pol res(
typename Pol::CoeffType(1));
140 for (
const auto& op: ops) res *= op;
145 for (
const auto& op: ops) {
146 switch (boost::fusion::at_c<0>(op)) {
147 case ADD: res += boost::fusion::at_c<1>(op);
break;
148 case SUB: res -= boost::fusion::at_c<1>(op);
break;
157 qi::real_parser<typename Pol::CoeffType,RationalPolicies<typename Pol::CoeffType>>
number;
160 qi::rule<Iterator, Term<typename Pol::CoeffType>(),
Skipper>
term;
#define CARL_LOG_ERROR(channel, msg)
MultivariatePolynomial< Rational > Pol
Monomial::Arg createMonomial(T &&... t)
std::size_t exponent
Type of an exponent.
Interval< Number > exp(const Interval< Number > &i)
uint to_int< uint >(const cln::cl_I &n)
Variable fresh_real_variable() noexcept
Interval< Number > pow(const Interval< Number > &i, Integer exp)
boost::spirit::qi::space_type Skipper
std::string::const_iterator Iterator
A Variable represents an algebraic variable that can be used throughout carl.
std::shared_ptr< const Monomial > Arg
Represents a single term, that is a numeric coefficient and a monomial.
static VariablePool & getInstance()
Returns the single instance of this class by reference.
qi::rule< Iterator, std::string(), Skipper > varname
Term< typename Pol::CoeffType > newTerm(const boost::optional< typename Pol::CoeffType > &c, const boost::optional< Monomial::Arg > &m)
qi::rule< Iterator, Pol(), Skipper > expr_product
qi::rule< Iterator, Monomial::Arg(), Skipper > monomial
Pol mul(const std::vector< Pol > &ops)
qi::symbols< char, Operation > operation
Monomial::Arg newMonomial(const std::vector< boost::fusion::vector2< Variable, typename Pol::CoeffType >> &data) const
qi::rule< Iterator, Pol(), Skipper, qi::locals< Pol > > expr_sum
Variable newVariable(const std::string &s)
Pol addTerms(const Term< typename Pol::CoeffType > &first, const std::vector< boost::fusion::vector2< Operation, Term< typename Pol::CoeffType >>> &ops)
qi::rule< Iterator, Pol(), Skipper > expr
qi::rule< Iterator, Pol(), Skipper > main
qi::symbols< char, Variable > varmap
qi::rule< Iterator, Term< typename Pol::CoeffType >), Skipper > term
qi::rule< Iterator, Variable(), Skipper > variable
void addVariable(Variable::Arg v)
Pol addPolynomials(const Pol &first, const std::vector< boost::fusion::vector2< Operation, Pol >> &ops)
qi::real_parser< typename Pol::CoeffType, RationalPolicies< typename Pol::CoeffType > > number
qi::rule< Iterator, Pol(), Skipper, qi::locals< Pol > > polynomial