Loading...
Searching...
No Matches
mul.h
Go to the documentation of this file.
1
6#ifndef SYMENGINE_MUL_H
7#define SYMENGINE_MUL_H
8
9#include <symengine/basic.h>
10
11namespace SymEngine
12{
13
73class Mul : public Basic
74{
75private:
76 RCP<const Number> coef_;
79
80public:
81 IMPLEMENT_TYPEID(SYMENGINE_MUL)
84 Mul(const RCP<const Number> &coef, map_basic_basic &&dict);
86 virtual hash_t __hash__() const;
91 virtual bool __eq__(const Basic &o) const;
92 virtual int compare(const Basic &o) const;
93
94 // Performs canonicalization first:
96 static RCP<const Basic> from_dict(const RCP<const Number> &coef,
97 map_basic_basic &&d);
99 static void dict_add_term(map_basic_basic &d, const RCP<const Basic> &exp,
100 const RCP<const Basic> &t);
101 static void dict_add_term_new(const Ptr<RCP<const Number>> &coef,
103 const RCP<const Basic> &exp,
104 const RCP<const Basic> &t);
106 static void as_base_exp(const RCP<const Basic> &self,
107 const Ptr<RCP<const Basic>> &exp,
108 const Ptr<RCP<const Basic>> &base);
110
113 void as_two_terms(const Ptr<RCP<const Basic>> &a,
114 const Ptr<RCP<const Basic>> &b) const;
116 void power_num(const Ptr<RCP<const Number>> &coef, map_basic_basic &d,
117 const RCP<const Number> &exp) const;
118
120 bool is_canonical(const RCP<const Number> &coef,
121 const map_basic_basic &dict) const;
122
123 virtual vec_basic get_args() const;
124
125 inline const RCP<const Number> &get_coef() const
126 {
127 return coef_;
128 }
129 inline const map_basic_basic &get_dict() const
130 {
131 return dict_;
132 }
133};
135RCP<const Basic> mul(const RCP<const Basic> &a, const RCP<const Basic> &b);
136RCP<const Basic> mul(const vec_basic &a);
138RCP<const Basic> div(const RCP<const Basic> &a, const RCP<const Basic> &b);
140RCP<const Basic> neg(const RCP<const Basic> &a);
141
142} // namespace SymEngine
143
144#endif
The base class for SymEngine.
#define IMPLEMENT_TYPEID(SYMENGINE_ID)
Inline members and functions.
Definition: basic.h:349
The lowest unit of symbolic representation.
Definition: basic.h:97
void as_two_terms(const Ptr< RCP< const Basic > > &a, const Ptr< RCP< const Basic > > &b) const
Rewrite as 2 terms.
Definition: mul.cpp:309
bool is_canonical(const RCP< const Number > &coef, const map_basic_basic &dict) const
Definition: mul.cpp:17
static void as_base_exp(const RCP< const Basic > &self, const Ptr< RCP< const Basic > > &exp, const Ptr< RCP< const Basic > > &base)
Convert to a base and exponent form.
Definition: mul.cpp:320
void power_num(const Ptr< RCP< const Number > > &coef, map_basic_basic &d, const RCP< const Number > &exp) const
Power all terms with the exponent exp
Definition: mul.cpp:448
static void dict_add_term(map_basic_basic &d, const RCP< const Basic > &exp, const RCP< const Basic > &t)
Add terms to dict.
Definition: mul.cpp:150
virtual vec_basic get_args() const
Returns the list of arguments.
Definition: mul.cpp:507
virtual bool __eq__(const Basic &o) const
Definition: mul.cpp:89
static RCP< const Basic > from_dict(const RCP< const Number > &coef, map_basic_basic &&d)
Create a Mul from a dict.
Definition: mul.cpp:115
virtual hash_t __hash__() const
Definition: mul.cpp:78
map_basic_basic dict_
The coefficient (e.g. 2 in 2*x*y)
Definition: mul.h:78
virtual int compare(const Basic &o) const
Definition: mul.cpp:98
Main namespace for SymEngine package.
Definition: add.cpp:19
RCP< const Basic > div(const RCP< const Basic > &a, const RCP< const Basic > &b)
Division.
Definition: mul.cpp:431
RCP< const Basic > exp(const RCP< const Basic > &x)
Returns the natural exponential function E**x = pow(E, x)
Definition: pow.cpp:271
RCP< const Basic > mul(const RCP< const Basic > &a, const RCP< const Basic > &b)
Multiplication.
Definition: mul.cpp:352
RCP< const Basic > neg(const RCP< const Basic > &a)
Negation.
Definition: mul.cpp:443