80 return bp->expand(options);
93 return bp->diff(s, nth);
100 return bp->match(pattern, repl_lst);
109 if (
match(pattern)) {
113 bool any_found =
false;
114 for (
size_t i=0; i<
nops(); i++)
115 if (
op(i).
find(pattern, found))
128 for (
auto its = ls.
begin(), itr = lr.
begin(); its != ls.
end(); ++its, ++itr) {
129 m.insert(std::make_pair(*its, *itr));
139 return bp->subs(m, options);
152 const ex & s = e.
op(0);
153 m.insert(std::make_pair(s, e.
op(1)));
160 return bp->subs(m, options);
169 throw(std::invalid_argument(
"basic::subs(ex): argument must be a list of equations"));
170 const ex & s = r.op(0);
171 m.insert(std::make_pair(s, r.
op(1)));
181 return bp->subs(m, options);
184 throw(std::invalid_argument(
"ex::subs(ex): argument must be a relation_equal or a list"));
193 for (
size_t i = 0; i < n; ++i)
201 for (
size_t i = 0; i < n; ++i)
211 return bp->let_op(i);
230 throw std::runtime_error(
"ex::lhs(): not a relation");
238 throw std::runtime_error(
"ex::rhs(): not a relation");
247 for (
auto & it : varlst)
248 if (!
bp->is_polynomial(it))
253 return bp->is_polynomial(vars);
285 if (
bp->get_refcount() <= other.
bp->get_refcount())
311 const ex & tmpex = other.
eval();
538 if (i >= -12 && i <= 12) {
Interface to GiNaC's sums of expressions.
#define GINAC_ASSERT(X)
Assertion macro for checking invariances.
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
virtual ex eval() const
Perform automatic non-interruptive term rewriting rules.
unsigned flags
of type status_flags
virtual basic * duplicate() const
Create a clone of this object on the heap.
const_iterator end() const
const_iterator begin() const
size_t nops() const override
Number of operands/members.
static basic & construct_from_ulonglong(unsigned long long i)
static basic & construct_from_longlong(long long i)
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)
static basic & construct_from_uint(unsigned int i)
bool match(const ex &pattern) const
Check whether expression matches a specified pattern.
bool is_polynomial(const ex &vars) const
Check whether expression is a polynomial.
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.
static basic & construct_from_double(double d)
ptr< basic > bp
pointer to basic object managed by this
ex & let_op(size_t i)
Return modifiable operand/member at position i.
bool is_zero_matrix() const
Check whether expression is zero or zero matrix.
static basic & construct_from_ulong(unsigned long i)
friend bool is_exactly_a(const ex &)
Check if ex is a handle to a T, not including base classes.
void share(const ex &other) const
Share equal objects between expressions.
friend const T & ex_to(const ex &)
Return a reference to the basic-derived class T object embedded in an expression.
static basic & construct_from_long(long i)
ex subs(const exmap &m, unsigned options=0) const
bool info(unsigned inf) const
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.
void print(const print_context &c, unsigned level=0) const
Print expression to stream.
void dbgprinttree() const
Little wrapper arount printtree to be called within a debugger.
ex rhs() const
Right hand side of relational expression.
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.
void makewriteable()
Make this ex writable (if more than one ex handle the same basic) by unlinking the object and creatin...
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
Base class for print_contexts.
Class of (intrusively) reference-counted pointers that support copy-on-write semantics.
unsigned int get_refcount() const noexcept
@ expanded
.expand(0) has already done its job (other expand() options ignore this flag)
@ evaluated
.eval() has already done its job
@ dynallocated
heap-allocated (i.e. created by new if we want to be clever and bypass the stack,
@ not_shareable
don't share instances of this object between different expressions unless explicitly asked to (used b...
@ pattern_is_not_product
used internally by expairseq::subschildren()
@ pattern_is_product
used internally by expairseq::subschildren()
Degenerate base class for visitors.
Interface to GiNaC's light-weight expression handles.
Definition of GiNaC's lst.
Interface to symbolic matrices.
Interface to GiNaC's products of expressions.
container< std::list > lst
std::map< ex, ex, ex_is_less > exmap
std::set< ex, ex_is_less > exset
B & dynallocate(Args &&... args)
Constructs a new (class basic or derived) B object on the heap.
const numeric * _num_10_p
const numeric * _num_11_p
const numeric * _num_12_p
Interface to GiNaC's non-commutative products of expressions.
Makes the interface to the underlying bignum package available.
Interface to GiNaC's symbolic exponentiation (basis^exponent).
Interface to relations between expressions.
Interface to several small and furry utilities needed within GiNaC but not of any interest to the use...