Go to the documentation of this file.
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;
274 ex::ex(
int i) : bp(construct_from_int(i))
280 ex::ex(
unsigned int i) : bp(construct_from_uint(i))
286 ex::ex(
long i) : bp(construct_from_long(i))
292 ex::ex(
unsigned long i) : bp(construct_from_ulong(i))
298 ex::ex(
long long i) : bp(construct_from_longlong(i))
304 ex::ex(
unsigned long long i) : bp(construct_from_ulonglong(i))
310 ex::ex(
double const d) : bp(construct_from_double(d))
316 ex::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);
370 class const_iterator :
public std::iterator<std::random_access_iterator_tag, ex, ptrdiff_t, const ex *, const ex &> {
393 return std::unique_ptr<ex>(
new ex(
operator*()));
466 return !(*
this == other);
476 return other < *
this;
481 return !(other < *
this);
486 return !(*
this < other);
506 return !(*
this == other);
556 return !(*
this == other);
560 std::stack<internal::_iter_rep, std::vector<internal::_iter_rep>>
s;
564 while (!
s.empty() &&
s.top().i ==
s.top().i_end) {
573 if (current.
i != current.
i_end) {
574 const ex & child = current.
e.
op(current.
i);
621 return !(*
this == other);
625 std::stack<internal::_iter_rep, std::vector<internal::_iter_rep>>
s;
629 while (
s.top().i !=
s.top().i_end) {
631 const ex & child = current.
e.
op(current.
i);
638 if (
s.top().i ==
s.top().i_end)
686 return e1.
bp == e2.
bp;
713 {
return thisex.
nops(); }
731 {
return thisex.
find(pattern, found); }
737 {
return thisex.
degree(s); }
743 {
return thisex.
coeff(s,
n); }
746 {
return thisex.
numer(); }
749 {
return thisex.
denom(); }
755 {
return thisex.
normal(); }
763 inline ex collect(
const ex & thisex,
const ex & s,
bool distributed =
false)
764 {
return thisex.
collect(s, distributed); }
767 {
return thisex.
eval(); }
770 {
return thisex.
evalf(); }
773 {
return thisex.
evalm(); }
779 {
return thisex.
diff(s, nth); }
785 {
return thisex.
match(pattern, repl_lst); }
811 inline ex op(
const ex & thisex,
size_t i)
812 {
return thisex.
op(i); }
815 {
return thisex.
lhs(); }
818 {
return thisex.
rhs(); }
860 template<
class T1,
class T2>
871 template<
class T1,
class T2,
class T3>
893 template<
class C,
class T1>
904 template<
class C,
class T1,
class T2>
916 template<
class C,
class T1,
class T2,
class T3>
925 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) {}
929 inline ex
ex::map(ex f(
const ex &))
const
931 pointer_to_map_function fcn(f);
941 return is_a<T>(*obj.
bp);
948 return is_exactly_a<T>(*obj.
bp);
965 return static_cast<const T &
>(*e.
bp);
997 return e1.is_equal(e2);
1003 #endif // ndef GINAC_EX_H
const_iterator & operator-=(difference_type n) noexcept
void swap(ex &other) noexcept
Efficiently swap the contents of two expressions.
bool operator()(const ex &lh, const ex &rh) const
bool is_a(const basic &obj)
Check if obj is a T, including base classes.
pointer_to_map_function(ex x(const ex &))
pointer_to_member_to_map_function_3args(ex(C::*member)(const ex &, T1, T2, T3), C &obj, T1 a1, T2 a2, T3 a3)
ex expand(unsigned options=0) const
const_postorder_iterator(const ex &e, size_t n)
const_postorder_iterator postorder_end() const noexcept
ex real_part(const ex &thisex)
const_iterator end() const noexcept
bool operator!=(const const_postorder_iterator &other) const noexcept
ex operator()(const ex &e) override
friend bool are_ex_trivially_equal(const ex &, const ex &)
Compare two objects of class quickly without doing a deep tree traversal.
Helper class to initialize the library.
const_iterator & operator--() noexcept
std::size_t operator()(const GiNaC::ex &e) const noexcept
void dbgprint() const
Little wrapper arount print to be called within a debugger.
friend const T & ex_to(const ex &)
Return a reference to the basic-derived class T object embedded in an expression.
ex to_rational(exmap &repl) const
Rationalization of non-rational functions.
ex normal() const
Normalization of rational functions.
std::stack< internal::_iter_rep, std::vector< internal::_iter_rep > > s
ex symmetrize(const ex &thisex)
ex coeff(const ex &s, int n=1) const
ex operator()(const ex &e) override
~library_init()
Dtor of static initialization helpers.
pointer operator->() const
ex map(ex(*f)(const ex &e)) const
exvector get_free_indices() const
bool has(const ex &pattern, unsigned options=0) const
static ptr< basic > construct_from_basic(const basic &other)
Helper function for the ex-from-basic constructor.
void swap(ex &e1, ex &e2)
Function object for map().
pointer operator->() const
int compare(const ex &other) const
pointer_to_member_to_map_function_2args(ex(C::*member)(const ex &, T1, T2), C &obj, T1 a1, T2 a2)
ex subs(const exmap &m, unsigned options=0) const
Base class for print_contexts.
const_postorder_iterator & operator++()
friend bool is_exactly_a(const ex &)
Check if ex is a handle to a T, not including base classes.
@ dynallocated
heap-allocated (i.e. created by new if we want to be clever and bypass the stack,
ex evalf(const ex &thisex)
bool operator<(const const_iterator &other) const noexcept
ex denom() const
Get denominator of an expression.
bool operator>(const const_iterator &other) const noexcept
void traverse_preorder(visitor &v) const
Traverse expression tree with given visitor, preorder traversal.
friend bool is_a(const ex &)
Check if ex is a handle to a T, including base classes.
ex collect(const ex &s, bool distributed=false) const
std::vector< ex > exvector
ex series(const ex &thisex, const ex &r, int order, unsigned options=0)
Degenerate base class for visitors.
ex diff(const ex &thisex, const symbol &s, unsigned nth=1)
ex(* ptr)(const ex &, T1, T2, T3)
const_iterator operator--(int) noexcept
const_iterator(const ex &e_, size_t i_) noexcept
int degree(const ex &s) const
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
static basic & construct_from_uint(unsigned int i)
const_iterator & operator+=(difference_type n) noexcept
static basic & construct_from_int(int i)
bool has(const ex &thisex, const ex &pattern, unsigned options=0)
bool is_equal(const ex &other) const
void dbgprinttree() const
Little wrapper arount printtree to be called within a debugger.
ex unit(const ex &x) const
Compute unit part (= sign of leading coefficient) of a multivariate polynomial in Q[x].
ex primpart(const ex &x) const
Compute primitive part of a multivariate polynomial in Q[x].
const_iterator operator++(int) noexcept
void traverse_postorder(visitor &v) const
Traverse expression tree with given visitor, postorder traversal.
ex conjugate(const ex &thisex)
static void init_unarchivers()
std::ostream & operator<<(std::ostream &os, const archive_node &n)
Write archive_node to binary data stream.
ex eval_ncmul(const exvector &v) const
const_postorder_iterator() noexcept
pointer_to_member_to_map_function(ex(C::*member)(const ex &), C &obj)
ex numer_denom() const
Get numerator and denominator of an expression.
ex operator[](const ex &index) const
ex collect(const ex &thisex, const ex &s, bool distributed=false)
bool are_ex_trivially_equal(const ex &e1, const ex &e2)
Compare two objects of class quickly without doing a deep tree traversal.
ex symmetrize_cyclic() const
Symmetrize expression by cyclic permutation over its free indices.
const_iterator() noexcept
void makewriteable()
Make this ex writable (if more than one ex handle the same basic) by unlinking the object and creatin...
ex smod(const numeric &xi) const
ex to_polynomial(const ex &thisex, exmap &repl)
static ptr< basic > construct_from_string_and_lst(const std::string &s, const ex &l)
bool info(unsigned inf) const
static int count
How many static objects were created? Only the first one must create the static flyweights on the hea...
bool match(const ex &pattern) const
Check whether expression matches a specified pattern.
static basic & construct_from_ulonglong(unsigned long long i)
const_preorder_iterator & operator++()
bool find(const ex &thisex, const ex &pattern, exset &found)
Lightweight wrapper for GiNaC's symbolic objects.
bool operator!=(const _iter_rep &other) const noexcept
void accept(visitor &v) const
const_iterator begin() const noexcept
ex normal(const ex &thisex)
ex(* ptr)(const ex &, T1)
static basic & construct_from_ulong(unsigned long i)
numeric max_coefficient() const
Return maximum (absolute value) coefficient of a polynomial.
ex numer(const ex &thisex)
bool find(const ex &pattern, exset &found) const
Find all occurrences of a pattern.
ex tcoeff(const ex &s) const
ex map(map_function &f) const
ex diff(const symbol &s, unsigned nth=1) const
Compute partial derivative of an expression.
bool operator==(const const_postorder_iterator &other) const noexcept
pointer_to_map_function_3args(ex x(const ex &, T1, T2, T3), T1 a1, T2 a2, T3 a3)
ex operator[](size_t i) const
int ldegree(const ex &s) const
ex to_polynomial(exmap &repl) const
ex expand(const ex &thisex, unsigned options=0)
ex operator()(const ex &e) override
static basic & construct_from_longlong(long long i)
static basic & construct_from_double(double d)
const_preorder_iterator preorder_end() const noexcept
bool operator()(const ex &lh, const ex &rh) const
friend const_iterator operator+(difference_type n, const const_iterator &it) noexcept
bool operator()(const ex &lh, const ex &rh) const
std::stack< internal::_iter_rep, std::vector< internal::_iter_rep > > s
Helper class for storing information about known scalar products which are to be automatically replac...
bool match(const ex &pattern, exmap &repls) const
void print(const print_context &c, unsigned level=0) const
Print expression to stream.
ex eval(const ex &thisex)
reference operator*() const
const T & ex_to(const ex &e)
Return a reference to the basic-derived class T object embedded in an expression.
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
To distinguish between different kinds of non-commutative objects.
ex denom(const ex &thisex)
int ldegree(const ex &thisex, const ex &s)
bool operator!=(const const_preorder_iterator &other) const noexcept
bool is_exactly_a(const basic &obj)
Check if obj is a T, not including base classes.
ex rhs() const
Right hand side of relational expression.
bool match(const ex &thisex, const ex &pattern, exmap &repl_lst)
std::set< ex, ex_is_less > exset
ex to_rational(const ex &thisex, exmap &repl)
library_init()
Ctor of static initialization helpers.
const_preorder_iterator operator++(int)
ex op(const ex &thisex, size_t i)
const_preorder_iterator preorder_begin() const
Wrapper template for making GiNaC classes out of STL containers.
pointer_to_map_function_1arg(ex x(const ex &, T1), T1 a1)
ex antisymmetrize() const
Antisymmetrize expression over its free indices.
bool operator>=(const const_iterator &other) const noexcept
bool operator()(const GiNaC::ex &e1, const GiNaC::ex &e2) const noexcept
bool is_zero_matrix() const
Check whether expression is zero or zero matrix.
std::map< ex, ex, ex_is_less > exmap
ex operator()(const ex &e) override
ex series(const ex &r, int order, unsigned options=0) const
Compute the truncated series expansion of an expression.
ex imag_part(const ex &thisex)
ex lcoeff(const ex &s) const
std::unique_ptr< ex > operator->() const
ex coeff(const ex &thisex, const ex &s, int n=1)
ex(* ptr)(const ex &, T1, T2)
const_iterator operator+(difference_type n) const noexcept
int degree(const ex &thisex, const ex &s)
ex eval_integ(const ex &thisex)
ex operator()(const ex &e) override
ex numer_denom(const ex &thisex)
_iter_rep(const ex &e_, size_t i_, size_t i_end_)
Interface to GiNaC's ABC.
const_postorder_iterator postorder_begin() const
reference operator*() const
friend difference_type operator-(const const_iterator &lhs, const const_iterator &rhs) noexcept
ex subs(const ex &thisex, const exmap &m, unsigned options=0)
void share(const ex &other) const
Share equal objects between expressions.
const_preorder_iterator() noexcept
bool is_polynomial(const ex &vars) const
Check whether expression is a polynomial.
bool is_zero(const ex &thisex)
bool is_polynomial(const ex &thisex, const ex &vars)
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
const_preorder_iterator(const ex &e, size_t n)
ex operator()(const ex &e) override
ex symmetrize() const
Symmetrize expression over its free indices.
bool operator!=(const const_iterator &other) const noexcept
ex symmetrize_cyclic(const ex &thisex)
const_iterator operator-(difference_type n) const noexcept
ex evalm(const ex &thisex)
ex antisymmetrize(const ex &thisex)
void swap(GiNaC::ex &a, GiNaC::ex &b)
Specialization of std::swap() for ex objects.
void operator()(ex &lh, ex &rh) const
bool operator<=(const const_iterator &other) const noexcept
ex simplify_indexed(unsigned options=0) const
Simplify/canonicalize expression containing indexed objects.
const_postorder_iterator operator++(int)
const_iterator & operator++() noexcept
unsigned return_type() const
ex numer() const
Get numerator of an expression.
size_t nops(const ex &thisex)
Class of (intrusively) reference-counted pointers that support copy-on-write semantics.
bool operator==(const const_iterator &other) const noexcept
Reference-counted pointer template.
ex operator()(const ex &e) override
bool operator==(const _iter_rep &other) const noexcept
ex operator[](difference_type n) const
static library_init library_initializer
For construction of flyweights, etc.
ptr< basic > bp
pointer to basic object managed by this
pointer_to_member_to_map_function_1arg(ex(C::*member)(const ex &, T1), C &obj, T1 a1)
numeric integer_content() const
Compute the integer content (= GCD of all numeric coefficients) of an expanded polynomial.
ex & let_op(size_t i)
Return modifiable operand/member at position i.
ex simplify_indexed(const ex &thisex, unsigned options=0)
ex content(const ex &x) const
Compute content part (= unit normal GCD of all coefficients) of a multivariate polynomial in Q[x].
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
#define GINAC_ASSERT(X)
Assertion macro for checking invariances.
ex lhs() const
Left hand side of relational expression.
static basic & construct_from_long(long i)
ex operator()(const ex &e) override
bool operator==(const const_preorder_iterator &other) const noexcept
void traverse(visitor &v) const
pointer_to_map_function_2args(ex x(const ex &, T1, T2), T1 a1, T2 a2)
This page is part of the GiNaC
developer's reference. It was generated automatically by doxygen. For
an introduction, see the tutorial.