1 #include <symengine/printers.h>
2 #include <symengine/subs.h>
3 #include <symengine/serialize-cereal.h>
11 #define STRINGIFY0(x) #x
12 #define STRINGIFY(x) STRINGIFY0(x)
16 #define SYMENGINE_INCLUDE_ALL
17 #define SYMENGINE_ENUM(type, Class) STRINGIFY(Class),
18 #include "symengine/type_codes.inc"
21 #undef SYMENGINE_INCLUDE_ALL
28 return type_names[id];
33 auto a = this->get_type_code();
34 auto b = o.get_type_code();
42 return a < b ? -1 : 1;
54 unsigned short major = SYMENGINE_MAJOR_VERSION;
55 unsigned short minor = SYMENGINE_MINOR_VERSION;
56 cereal::PortableBinaryOutputArchive{oss}(major, minor,
63 unsigned short major, minor;
66 cereal::PortableBinaryInputArchive iarchive{iss};
67 iarchive(major, minor);
68 if (major != SYMENGINE_MAJOR_VERSION or minor != SYMENGINE_MINOR_VERSION) {
69 throw SerializationError(StreamFmt()
70 <<
"SymEngine-" << SYMENGINE_MAJOR_VERSION
71 <<
"." << SYMENGINE_MINOR_VERSION
72 <<
" was asked to deserialize an object "
73 <<
"created using SymEngine-" << major <<
"."
85 RCP<const Basic> Basic::xreplace(
const map_basic_basic &xreplace_dict)
const
90 const char *get_version()
92 return SYMENGINE_VERSION;
97 return is_a_Number(b) or is_a<Symbol>(b) or is_a<Constant>(b);
The lowest unit of symbolic representation.
RCP< const Basic > subs(const map_basic_basic &subs_dict) const
Substitutes 'subs_dict' into 'self'.
std::string dumps() const
Returns a string of the instance serialized.
std::string __str__() const
static RCP< const Basic > loads(const std::string &)
Creates an instance of a serialized string.
int __cmp__(const Basic &o) const
Comparison operator.
virtual int compare(const Basic &o) const =0
RCP< Basic > rcp_from_this()
Get RCP<T> pointer to self (it will cast the pointer to T)
Main namespace for SymEngine package.
bool is_a_Number(const Basic &b)
bool is_a_Atom(const Basic &b)
Returns true if b is an atom. i.e. b.get_args returns an empty vector.
RCP< const Basic > xreplace(const RCP< const Basic > &x, const map_basic_basic &subs_dict, bool cache=true)
Mappings in the subs_dict are applied to the expression tree of x