2#include <symengine/polys/basic_conversions.h>
7umap_basic_num _find_gens_poly_pow(
const RCP<const Basic> &x,
8 const RCP<const Basic> &base);
26 void add_to_gen_set(
const RCP<const Basic> &base,
27 const RCP<const Number> &
exp)
29 auto it = gen_set.
find(base);
30 if (
it == gen_set.
end()) {
48 void bvisit(
const Pow &x)
54 add_to_gen_set(pow(x.
get_base(), minus_one), one);
59 RCP<const Basic> base = x.
get_base();
63 base = pow(base, minus_one);
64 add_to_gen_set(base,
divnum(one,
r->get_den()));
74 void bvisit(
const Add &x)
76 for (
auto it : x.get_dict())
77 it.first->accept(*
this);
80 void bvisit(
const Mul &x)
82 for (
auto it : x.get_dict())
83 it.first->accept(*
this);
86 void bvisit(
const Number &x)
91 void bvisit(
const Basic &x)
104 RCP<const Basic> the_base;
114 void bvisit(
const Add &x)
119 for (
auto it : x.get_dict()) {
120 RCP<const Number>
mulx = one,
divx = one;
122 if (
it.second->is_negative())
132 void bvisit(
const Mul &x)
136 RCP<const Number>
mulx = one,
divx = one;
138 if (x.get_coef()->is_negative())
144 auto dict = x.get_dict();
148 void bvisit(
const Number &x)
159 void bvisit(
const Basic &x)
171umap_basic_num _find_gens_poly_pow(
const RCP<const Basic> &x,
172 const RCP<const Basic> &base)
174 PolyGeneratorVisitorPow v;
175 return v.apply(*x, base);
The base class for representing addition in symbolic expressions.
const RCP< const Number > & get_coef() const
The lowest unit of symbolic representation.
RCP< const T2 > rcp_from_this_cast() const
Get RCP<T2> pointer to self (it will cast the pointer to T2)
RCP< T > rcp_from_this()
Get RCP<T> pointer to self (it will cast the pointer to T)
static RCP< const Basic > from_dict(const RCP< const Number > &coef, map_basic_basic &&d)
Create a Mul from a dict.
virtual bool is_positive() const =0
RCP< const Basic > get_base() const
RCP< const Basic > get_exp() const
Main namespace for SymEngine package.
bool is_a_Number(const Basic &b)
void hash_combine(hash_t &seed, const T &v)
RCP< const Basic > exp(const RCP< const Basic > &x)
Returns the natural exponential function E**x = pow(E, x)
RCP< const Integer > lcm(const Integer &a, const Integer &b)
Least Common Multiple.
RCP< const Basic > mul(const RCP< const Basic > &a, const RCP< const Basic > &b)
Multiplication.
RCP< const Number > mulnum(const RCP< const Number > &self, const RCP< const Number > &other)
Multiply self and other
RCP< const Number > divnum(const RCP< const Number > &self, const RCP< const Number > &other)
Divide self and other