1 #include <symengine/polys/msymenginepoly.h>
6 RCP<const Basic> MIntPoly::as_symbolic()
const
9 for (
const auto &p : get_poly().dict_) {
10 RCP<const Basic> res =
integer(p.second);
12 for (
auto sym : get_vars()) {
13 if (0 != p.first[whichvar])
24 hash_t seed = SYMENGINE_MINTPOLY;
25 for (
auto var : get_vars())
26 hash_combine<std::string>(seed, var->__str__());
28 for (
auto &p : get_poly().dict_) {
30 hash_combine<hash_t>(t, mp_get_si(p.second));
36 integer_class MIntPoly::eval(
40 integer_class ans(0), temp, term;
41 for (
auto bucket : get_poly().dict_) {
43 unsigned int whichvar = 0;
44 for (
auto sym : get_vars()) {
45 mp_pow_ui(temp, vals.find(sym)->second, bucket.first[whichvar]);
54 RCP<const Basic> MExprPoly::as_symbolic()
const
57 for (
const auto &p : get_poly().dict_) {
58 RCP<const Basic> res = (p.second.get_basic());
60 for (
auto sym : get_vars()) {
61 if (0 != p.first[whichvar])
72 hash_t seed = SYMENGINE_MEXPRPOLY;
73 for (
auto var : get_vars())
74 hash_combine<std::string>(seed, var->__str__());
76 for (
auto &p : get_poly().dict_) {
78 hash_combine<Basic>(t, *(p.second.get_basic()));
89 for (
auto bucket : get_poly().dict_) {
91 unsigned int whichvar = 0;
92 for (
auto sym : get_vars()) {
93 term *= pow(vals.find(sym)->second, bucket.first[whichvar]);
101 unsigned int reconcile(vec_uint &v1, vec_uint &v2, set_basic &s,
102 const set_basic &s1,
const set_basic &s2)
106 unsigned int pos = 0;
113 s.insert(s2.begin(), s2.end());
116 if (i != s1.end() and
eq(*it, **i)) {
120 if (j != s2.end() and
eq(*it, **j)) {
hash_t __hash__() const override
hash_t __hash__() const override
Main namespace for SymEngine package.
std::enable_if< std::is_integral< T >::value, RCP< const Integer > >::type integer(T i)
bool eq(const Basic &a, const Basic &b)
Checks equality for a and b
RCP< const Basic > mul(const RCP< const Basic > &a, const RCP< const Basic > &b)
Multiplication.
RCP< const Basic > add(const RCP< const Basic > &a, const RCP< const Basic > &b)
Adds two objects (safely).