75 template<
class T>
friend inline const T &
ex_to(
const ex &);
76 template<
class T>
friend inline bool is_a(
const ex &);
91 ex(
unsigned long long i);
98 ex(const
std::
string &s, const
ex &l);
132 bool info(
unsigned inf)
const {
return bp->info(inf); }
135 size_t nops()
const {
return bp->nops(); }
136 ex op(
size_t i)
const {
return bp->op(i); }
153 bool match(
const ex & pattern)
const;
154 bool match(
const ex & pattern,
exmap & repls)
const {
return bp->match(pattern, repls); }
181 ex collect(
const ex & s,
bool distributed =
false)
const {
return bp->collect(s, distributed); }
246 void share(
const ex & other)
const;
280ex::ex(
unsigned int i) : bp(construct_from_uint(i))
286ex::ex(
long i) : bp(construct_from_long(i))
292ex::ex(
unsigned long i) : bp(construct_from_ulong(i))
298ex::ex(
long long i) : bp(construct_from_longlong(i))
304ex::ex(
unsigned long long i) : bp(construct_from_ulonglong(i))
310ex::ex(
double const d) : bp(construct_from_double(d))
316ex::ex(
const std::string &s,
const ex &l) : bp(construct_from_string_and_lst(s, l))
324#ifdef GINAC_COMPARE_STATISTICS
325 compare_statistics.total_compares++;
329#ifdef GINAC_COMPARE_STATISTICS
330 compare_statistics.nontrivial_compares++;
332 const int cmpval =
bp->compare(*other.
bp);
347#ifdef GINAC_COMPARE_STATISTICS
348 compare_statistics.total_is_equals++;
352#ifdef GINAC_COMPARE_STATISTICS
353 compare_statistics.nontrivial_is_equals++;
355 const bool equal =
bp->is_equal(*other.
bp);
398 return std::unique_ptr<ex>(
new ex(
operator*()));
471 return !(*
this == other);
481 return other < *
this;
486 return !(other < *
this);
491 return !(*
this < other);
511 return !(*
this == other);
566 return !(*
this == other);
570 std::stack<internal::_iter_rep, std::vector<internal::_iter_rep>>
s;
574 while (!
s.empty() &&
s.top().i ==
s.top().i_end) {
583 if (current.
i != current.
i_end) {
584 const ex & child = current.
e.
op(current.
i);
636 return !(*
this == other);
640 std::stack<internal::_iter_rep, std::vector<internal::_iter_rep>>
s;
644 while (
s.top().i !=
s.top().i_end) {
646 const ex & child = current.
e.
op(current.
i);
653 if (
s.top().i ==
s.top().i_end)
701 return e1.
bp == e2.
bp;
728{
return thisex.
nops(); }
746{
return thisex.
find(pattern, found); }
752{
return thisex.
degree(s); }
758{
return thisex.
coeff(s,
n); }
761{
return thisex.
numer(); }
764{
return thisex.
denom(); }
770{
return thisex.
normal(); }
779{
return thisex.
collect(s, distributed); }
782{
return thisex.
eval(); }
785{
return thisex.
evalf(); }
788{
return thisex.
evalm(); }
794{
return thisex.
diff(s, nth); }
800{
return thisex.
match(pattern, repl_lst); }
827{
return thisex.
op(i); }
830{
return thisex.
lhs(); }
833{
return thisex.
rhs(); }
875template<
class T1,
class T2>
886template<
class T1,
class T2,
class T3>
908template<
class C,
class T1>
919template<
class C,
class T1,
class T2>
931template<
class C,
class T1,
class T2,
class T3>
940 explicit pointer_to_member_to_map_function_3args(
ex (C::*member)(
const ex &, T1, T2, T3), C &obj, T1 a1, T2 a2, T3 a3) :
ptr(member),
c(obj),
arg1(a1),
arg2(a2),
arg3(a3) {}
944inline ex
ex::map(ex f(
const ex &))
const
946 pointer_to_map_function fcn(f);
956 return is_a<T>(*obj.
bp);
963 return is_exactly_a<T>(*obj.
bp);
980 return static_cast<const T &
>(*e.
bp);
1012 return e1.is_equal(e2);
#define GINAC_ASSERT(X)
Assertion macro for checking invariances.
Interface to GiNaC's ABC.
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
bool operator<(const const_iterator &other) const noexcept
ptrdiff_t difference_type
friend const_iterator operator+(difference_type n, const const_iterator &it) noexcept
const_iterator operator+(difference_type n) const noexcept
bool operator<=(const const_iterator &other) const noexcept
bool operator>(const const_iterator &other) const noexcept
bool operator>=(const const_iterator &other) const noexcept
std::random_access_iterator_tag iterator_category
std::unique_ptr< ex > operator->() const
bool operator!=(const const_iterator &other) const noexcept
friend difference_type operator-(const const_iterator &lhs, const const_iterator &rhs) noexcept
const_iterator(const ex &e_, size_t i_) noexcept
const_iterator operator-(difference_type n) const noexcept
const_iterator operator++(int) noexcept
const_iterator & operator--() noexcept
bool operator==(const const_iterator &other) const noexcept
const_iterator & operator+=(difference_type n) noexcept
const_iterator & operator++() noexcept
ex operator[](difference_type n) const
const_iterator() noexcept
const_iterator & operator-=(difference_type n) noexcept
const_iterator operator--(int) noexcept
std::forward_iterator_tag iterator_category
ptrdiff_t difference_type
const_postorder_iterator & operator++()
bool operator!=(const const_postorder_iterator &other) const noexcept
std::stack< internal::_iter_rep, std::vector< internal::_iter_rep > > s
pointer operator->() const
const_postorder_iterator operator++(int)
reference operator*() const
const_postorder_iterator() noexcept
const_postorder_iterator(const ex &e, size_t n)
bool operator==(const const_postorder_iterator &other) const noexcept
const_preorder_iterator() noexcept
pointer operator->() const
const_preorder_iterator & operator++()
const_preorder_iterator operator++(int)
const_preorder_iterator(const ex &e, size_t n)
reference operator*() const
bool operator==(const const_preorder_iterator &other) const noexcept
std::forward_iterator_tag iterator_category
std::stack< internal::_iter_rep, std::vector< internal::_iter_rep > > s
bool operator!=(const const_preorder_iterator &other) const noexcept
ptrdiff_t difference_type
Wrapper template for making GiNaC classes out of STL containers.
Lightweight wrapper for GiNaC's symbolic objects.
static ptr< basic > construct_from_string_and_lst(const std::string &s, const ex &l)
static basic & construct_from_ulonglong(unsigned long long i)
friend bool is_exactly_a(const ex &)
Check if ex is a handle to a T, not including base classes.
ex to_rational(exmap &repl) const
Rationalization of non-rational functions.
ex unit(const ex &x) const
Compute unit part (= sign of leading coefficient) of a multivariate polynomial in Q[x].
static basic & construct_from_longlong(long long i)
ex map(map_function &f) const
void traverse_preorder(visitor &v) const
Traverse expression tree with given visitor, preorder traversal.
ex operator[](const ex &index) const
static basic & construct_from_int(int i)
numeric integer_content() const
Compute the integer content (= GCD of all numeric coefficients) of an expanded polynomial.
ex primpart(const ex &x) const
Compute primitive part of a multivariate polynomial in Q[x].
ex lcoeff(const ex &s) const
static basic & construct_from_uint(unsigned int i)
void traverse(visitor &v) const
friend bool are_ex_trivially_equal(const ex &, const ex &)
Compare two objects of class quickly without doing a deep tree traversal.
bool match(const ex &pattern) const
Check whether expression matches a specified pattern.
ex map(ex(*f)(const ex &e)) const
bool match(const ex &pattern, exmap &repls) const
bool is_polynomial(const ex &vars) const
Check whether expression is a polynomial.
const_preorder_iterator preorder_end() const noexcept
ex operator[](size_t i) const
const_iterator begin() const noexcept
exvector get_free_indices() const
static ptr< basic > construct_from_basic(const basic &other)
Helper function for the ex-from-basic constructor.
bool find(const ex &pattern, exset &found) const
Find all occurrences of a pattern.
void accept(visitor &v) const
ex diff(const symbol &s, unsigned nth=1) const
Compute partial derivative of an expression.
ex expand(unsigned options=0) const
Expand an expression.
ex tcoeff(const ex &s) const
ex numer_denom() const
Get numerator and denominator of an expression.
bool is_equal(const ex &other) const
static basic & construct_from_double(double d)
ex normal() const
Normalization of rational functions.
int degree(const ex &s) const
friend const T & ex_to(const ex &)
Return a reference to the basic-derived class T object embedded in an expression.
ptr< basic > bp
pointer to basic object managed by this
bool has(const ex &pattern, unsigned options=0) const
ex & let_op(size_t i)
Return modifiable operand/member at position i.
numeric max_coefficient() const
Return maximum (absolute value) coefficient of a polynomial.
ex eval_ncmul(const exvector &v) const
ex simplify_indexed(unsigned options=0) const
Simplify/canonicalize expression containing indexed objects.
bool is_zero_matrix() const
Check whether expression is zero or zero matrix.
ex to_polynomial(exmap &repl) const
static basic & construct_from_ulong(unsigned long i)
const_postorder_iterator postorder_end() const noexcept
const_preorder_iterator preorder_begin() const
ex symmetrize_cyclic() const
Symmetrize expression by cyclic permutation over its free indices.
unsigned return_type() const
void unitcontprim(const ex &x, ex &u, ex &c, ex &p) const
Compute unit part, content part, and primitive part of a multivariate polynomial in Q[x].
return_type_t return_type_tinfo() const
void share(const ex &other) const
Share equal objects between expressions.
void swap(ex &other) noexcept
Efficiently swap the contents of two expressions.
const_iterator end() const noexcept
static basic & construct_from_long(long i)
ex smod(const numeric &xi) const
ex series(const ex &r, int order, unsigned options=0) const
Compute the truncated series expansion of an expression.
ex subs(const exmap &m, unsigned options=0) const
bool info(unsigned inf) const
int compare(const ex &other) const
ex symmetrize() const
Symmetrize expression over its free indices.
friend bool is_a(const ex &)
Check if ex is a handle to a T, including base classes.
ex lhs() const
Left hand side of relational expression.
ex denom() const
Get denominator of an expression.
void print(const print_context &c, unsigned level=0) const
Print expression to stream.
ex collect(const ex &s, bool distributed=false) const
void dbgprinttree() const
Little wrapper arount printtree to be called within a debugger.
ex content(const ex &x) const
Compute content part (= unit normal GCD of all coefficients) of a multivariate polynomial in Q[x].
int ldegree(const ex &s) const
ex rhs() const
Right hand side of relational expression.
ex numer() const
Get numerator of an expression.
ex coeff(const ex &s, int n=1) const
void dbgprint() const
Little wrapper arount print to be called within a debugger.
void traverse_postorder(visitor &v) const
Traverse expression tree with given visitor, postorder traversal.
const_postorder_iterator postorder_begin() const
void makewriteable()
Make this ex writable (if more than one ex handle the same basic) by unlinking the object and creatin...
ex antisymmetrize() const
Antisymmetrize expression over its free indices.
Helper class to initialize the library.
library_init()
Ctor of static initialization helpers.
static int count
How many static objects were created? Only the first one must create the static flyweights on the hea...
static void init_unarchivers()
~library_init()
Dtor of static initialization helpers.
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
ex(* ptr)(const ex &, T1)
ex operator()(const ex &e) override
pointer_to_map_function_1arg(ex x(const ex &, T1), T1 a1)
ex operator()(const ex &e) override
pointer_to_map_function_2args(ex x(const ex &, T1, T2), T1 a1, T2 a2)
ex(* ptr)(const ex &, T1, T2)
pointer_to_map_function_3args(ex x(const ex &, T1, T2, T3), T1 a1, T2 a2, T3 a3)
ex operator()(const ex &e) override
ex(* ptr)(const ex &, T1, T2, T3)
ex operator()(const ex &e) override
pointer_to_map_function(ex x(const ex &))
ex operator()(const ex &e) override
pointer_to_member_to_map_function_1arg(ex(C::*member)(const ex &, T1), C &obj, T1 a1)
ex operator()(const ex &e) override
pointer_to_member_to_map_function_2args(ex(C::*member)(const ex &, T1, T2), C &obj, T1 a1, T2 a2)
pointer_to_member_to_map_function_3args(ex(C::*member)(const ex &, T1, T2, T3), C &obj, T1 a1, T2 a2, T3 a3)
ex operator()(const ex &e) override
pointer_to_member_to_map_function(ex(C::*member)(const ex &), C &obj)
ex operator()(const ex &e) override
Base class for print_contexts.
Class of (intrusively) reference-counted pointers that support copy-on-write semantics.
Helper class for storing information about known scalar products which are to be automatically replac...
@ dynallocated
heap-allocated (i.e. created by new if we want to be clever and bypass the stack,
Degenerate base class for visitors.
bool is_zero(const ex &thisex)
ex real_part(const ex &thisex)
std::ostream & operator<<(std::ostream &os, const archive_node &n)
Write archive_node to binary data stream.
ex denom(const ex &thisex)
bool is_polynomial(const ex &thisex, const ex &vars)
ex to_rational(const ex &thisex, exmap &repl)
std::map< ex, ex, ex_is_less > exmap
const T & ex_to(const ex &e)
Return a reference to the basic-derived class T object embedded in an expression.
std::set< ex, ex_is_less > exset
ex symmetrize(const ex &thisex)
bool are_ex_trivially_equal(const ex &e1, const ex &e2)
Compare two objects of class quickly without doing a deep tree traversal.
ex series(const ex &thisex, const ex &r, int order, unsigned options=0)
ex conjugate(const ex &thisex)
ex diff(const ex &thisex, const symbol &s, unsigned nth=1)
ex simplify_indexed(const ex &thisex, unsigned options=0)
ex subs(const ex &thisex, const exmap &m, unsigned options=0)
ex eval(const ex &thisex)
int degree(const ex &thisex, const ex &s)
bool match(const ex &thisex, const ex &pattern, exmap &repl_lst)
int ldegree(const ex &thisex, const ex &s)
bool is_a(const basic &obj)
Check if obj is a T, including base classes.
ex evalf(const ex &thisex)
ex normal(const ex &thisex)
ex antisymmetrize(const ex &thisex)
ex op(const ex &thisex, size_t i)
ex coeff(const ex &thisex, const ex &s, int n=1)
ex numer(const ex &thisex)
ex collect(const ex &thisex, const ex &s, bool distributed=false)
ex eval_integ(const ex &thisex)
void swap(ex &e1, ex &e2)
bool find(const ex &thisex, const ex &pattern, exset &found)
ex evalm(const ex &thisex)
bool is_exactly_a(const basic &obj)
Check if obj is a T, not including base classes.
ex symmetrize_cyclic(const ex &thisex)
bool has(const ex &thisex, const ex &pattern, unsigned options=0)
std::vector< ex > exvector
ex numer_denom(const ex &thisex)
size_t nops(const ex &thisex)
ex imag_part(const ex &thisex)
ex to_polynomial(const ex &thisex, exmap &repl)
static library_init library_initializer
For construction of flyweights, etc.
ex expand(const ex &thisex, unsigned options=0)
void swap(GiNaC::ex &a, GiNaC::ex &b)
Specialization of std::swap() for ex objects.
Reference-counted pointer template.
bool operator()(const ex &lh, const ex &rh) const
bool operator()(const ex &lh, const ex &rh) const
void operator()(ex &lh, ex &rh) const
bool operator==(const _iter_rep &other) const noexcept
bool operator!=(const _iter_rep &other) const noexcept
_iter_rep(const ex &e_, size_t i_, size_t i_end_)
Function object for map().
bool operator()(const ex &lh, const ex &rh) const
To distinguish between different kinds of non-commutative objects.
bool operator()(const GiNaC::ex &e1, const GiNaC::ex &e2) const noexcept
std::size_t operator()(const GiNaC::ex &e) const noexcept