GiNaC
1.8.0
|
A sequence of class expair. More...
#include <expairseq.h>
Public Member Functions | |
expairseq (const ex &lh, const ex &rh) | |
expairseq (const exvector &v) | |
expairseq (const epvector &v, const ex &oc, bool do_index_renaming=false) | |
expairseq (epvector &&vp, const ex &oc, bool do_index_renaming=false) | |
unsigned | precedence () const override |
Return relative operator precedence (for parenthezing output). More... | |
bool | info (unsigned inf) const override |
Information about the object. More... | |
size_t | nops () const override |
Number of operands/members. More... | |
ex | op (size_t i) const override |
Return operand/member at position i. More... | |
ex | map (map_function &f) const override |
Construct new expression by applying the specified function to all sub-expressions (one level only, not recursively). More... | |
ex | eval () const override |
Perform automatic non-interruptive term rewriting rules. More... | |
ex | to_rational (exmap &repl) const override |
Implementation of ex::to_rational() for expairseqs. More... | |
ex | to_polynomial (exmap &repl) const override |
Implementation of ex::to_polynomial() for expairseqs. More... | |
bool | match (const ex &pattern, exmap &repl_lst) const override |
Check whether the expression matches a given pattern. More... | |
ex | subs (const exmap &m, unsigned options=0) const override |
Substitute a set of objects by arbitrary expressions. More... | |
ex | conjugate () const override |
void | archive (archive_node &n) const override |
Save (serialize) the object into archive node. More... | |
void | read_archive (const archive_node &n, lst &syms) override |
Load (deserialize) the object from an archive node. More... | |
![]() | |
virtual | ~basic () |
basic destructor, virtual because class ex will delete objects of derived classes via a basic*. More... | |
basic (const basic &other) | |
const basic & | operator= (const basic &other) |
basic assignment operator: the other object might be of a derived class. More... | |
virtual basic * | duplicate () const |
Create a clone of this object on the heap. More... | |
virtual ex | evalf () const |
Evaluate object numerically. More... | |
virtual ex | evalm () const |
Evaluate sums, products and integer powers of matrices. More... | |
virtual ex | eval_integ () const |
Evaluate integrals, if result is known. More... | |
virtual ex | eval_indexed (const basic &i) const |
Perform automatic symbolic evaluations on indexed expression that contains this object as the base expression. More... | |
virtual void | print (const print_context &c, unsigned level=0) const |
Output to stream. More... | |
virtual void | dbgprint () const |
Little wrapper around print to be called within a debugger. More... | |
virtual void | dbgprinttree () const |
Little wrapper around printtree to be called within a debugger. More... | |
virtual ex | operator[] (const ex &index) const |
virtual ex | operator[] (size_t i) const |
virtual ex & | let_op (size_t i) |
Return modifiable operand/member at position i. More... | |
virtual ex & | operator[] (const ex &index) |
virtual ex & | operator[] (size_t i) |
virtual bool | has (const ex &other, unsigned options=0) const |
Test for occurrence of a pattern. More... | |
virtual void | accept (GiNaC::visitor &v) const |
virtual bool | is_polynomial (const ex &var) const |
Check whether this is a polynomial in the given variables. More... | |
virtual int | degree (const ex &s) const |
Return degree of highest power in object s. More... | |
virtual int | ldegree (const ex &s) const |
Return degree of lowest power in object s. More... | |
virtual ex | coeff (const ex &s, int n=1) const |
Return coefficient of degree n in object s. More... | |
virtual ex | collect (const ex &s, bool distributed=false) const |
Sort expanded expression in terms of powers of some object(s). More... | |
virtual ex | series (const relational &r, int order, unsigned options=0) const |
Default implementation of ex::series(). More... | |
virtual ex | normal (exmap &repl, exmap &rev_lookup, lst &modifier) const |
Default implementation of ex::normal(). More... | |
virtual numeric | integer_content () const |
virtual ex | smod (const numeric &xi) const |
Apply symmetric modular homomorphism to an expanded multivariate polynomial. More... | |
virtual numeric | max_coefficient () const |
Implementation ex::max_coefficient(). More... | |
virtual exvector | get_free_indices () const |
Return a vector containing the free indices of an expression. More... | |
virtual ex | add_indexed (const ex &self, const ex &other) const |
Add two indexed expressions. More... | |
virtual ex | scalar_mul_indexed (const ex &self, const numeric &other) const |
Multiply an indexed expression with a scalar. More... | |
virtual bool | contract_with (exvector::iterator self, exvector::iterator other, exvector &v) const |
Try to contract two indexed expressions that appear in the same product. More... | |
virtual return_type_t | return_type_tinfo () const |
virtual ex | real_part () const |
virtual ex | imag_part () const |
template<class T > | |
void | print_dispatch (const print_context &c, unsigned level) const |
Like print(), but dispatch to the specified class. More... | |
void | print_dispatch (const registered_class_info &ri, const print_context &c, unsigned level) const |
Like print(), but dispatch to the specified class. More... | |
ex | subs_one_level (const exmap &m, unsigned options) const |
Helper function for subs(). More... | |
ex | diff (const symbol &s, unsigned nth=1) const |
Default interface of nth derivative ex::diff(s, n). More... | |
int | compare (const basic &other) const |
Compare objects syntactically to establish canonical ordering. More... | |
bool | is_equal (const basic &other) const |
Test for syntactic equality. More... | |
const basic & | hold () const |
Stop further evaluation. More... | |
unsigned | gethash () const |
const basic & | setflag (unsigned f) const |
Set some status_flags. More... | |
const basic & | clearflag (unsigned f) const |
Clear some status_flags. More... | |
![]() | |
refcounted () noexcept | |
unsigned int | add_reference () noexcept |
unsigned int | remove_reference () noexcept |
unsigned int | get_refcount () const noexcept |
void | set_refcount (unsigned int r) noexcept |
Protected Member Functions | |
bool | is_equal_same_type (const basic &other) const override |
Returns true if two objects of same type are equal. More... | |
unsigned | return_type () const override |
unsigned | calchash () const override |
Compute the hash value of an object and if it makes sense to store it in the objects status_flags, do so. More... | |
ex | expand (unsigned options=0) const override |
Expand expression, i.e. More... | |
virtual ex | thisexpairseq (const epvector &v, const ex &oc, bool do_index_renaming=false) const |
virtual ex | thisexpairseq (epvector &&vp, const ex &oc, bool do_index_renaming=false) const |
virtual void | printseq (const print_context &c, char delim, unsigned this_precedence, unsigned upper_precedence) const |
virtual void | printpair (const print_context &c, const expair &p, unsigned upper_precedence) const |
virtual expair | split_ex_to_pair (const ex &e) const |
virtual expair | combine_ex_with_coeff_to_pair (const ex &e, const ex &c) const |
virtual expair | combine_pair_with_coeff_to_pair (const expair &p, const ex &c) const |
virtual ex | recombine_pair_to_ex (const expair &p) const |
virtual bool | expair_needs_further_processing (epp it) |
virtual ex | default_overall_coeff () const |
virtual void | combine_overall_coeff (const ex &c) |
virtual void | combine_overall_coeff (const ex &c1, const ex &c2) |
virtual bool | can_make_flat (const expair &p) const |
void | do_print (const print_context &c, unsigned level) const |
void | do_print_tree (const print_tree &c, unsigned level) const |
void | construct_from_2_ex (const ex &lh, const ex &rh) |
void | construct_from_2_expairseq (const expairseq &s1, const expairseq &s2) |
void | construct_from_expairseq_ex (const expairseq &s, const ex &e) |
void | construct_from_exvector (const exvector &v) |
void | construct_from_epvector (const epvector &v, bool do_index_renaming=false) |
void | construct_from_epvector (epvector &&v, bool do_index_renaming=false) |
void | make_flat (const exvector &v) |
void | make_flat (const epvector &v, bool do_index_renaming=false) |
void | canonicalize () |
void | combine_same_terms_sorted_seq () |
bool | is_canonical () const |
epvector | expandchildren (unsigned options) const |
epvector | evalchildren () const |
epvector | subschildren (const exmap &m, unsigned options=0) const |
![]() | |
basic () | |
virtual ex | eval_ncmul (const exvector &v) const |
virtual bool | match_same_type (const basic &other) const |
Returns true if the attributes of two objects are similar enough for a match. More... | |
virtual ex | derivative (const symbol &s) const |
Default implementation of ex::diff(). More... | |
virtual int | compare_same_type (const basic &other) const |
Returns order relation between two objects of same type. More... | |
void | ensure_if_modifiable () const |
Ensure the object may be modified without hurting others, throws if this is not the case. More... | |
void | do_print (const print_context &c, unsigned level) const |
Default output to stream. More... | |
void | do_print_tree (const print_tree &c, unsigned level) const |
Tree output to stream. More... | |
void | do_print_python_repr (const print_python_repr &c, unsigned level) const |
Python parsable output to stream. More... | |
Protected Attributes | |
epvector | seq |
ex | overall_coeff |
![]() | |
unsigned | flags |
of type status_flags More... | |
unsigned | hashvalue |
hash value More... | |
A sequence of class expair.
This is used for time-critical classes like sums and products of terms since handling a list of coeff and rest is much faster than handling a list of products or powers, respectively. (Not incidentally, Maple does it the same way, maybe others too.) The semantics is (at least) twofold: one for addition and one for multiplication and several methods have to be overridden by derived classes to reflect the change in semantics. However, most functionality turns out to be shared between addition and multiplication, which is the reason why there is this base class.
Definition at line 49 of file expairseq.h.
GiNaC::expairseq::expairseq | ( | const exvector & | v | ) |
|
inlineoverridevirtual |
Return relative operator precedence (for parenthezing output).
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::mul.
Definition at line 62 of file expairseq.h.
|
overridevirtual |
Information about the object.
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::mul.
|
overridevirtual |
Number of operands/members.
Reimplemented from GiNaC::basic.
Referenced by GiNaC::algebraic_match_mul_with_mul(), GiNaC::add::conjugate(), GiNaC::add::do_print_python_repr(), GiNaC::power::expand_add(), GiNaC::power::expand_add_2(), GiNaC::add::get_free_indices(), and GiNaC::mul::get_free_indices().
|
overridevirtual |
Return operand/member at position i.
Reimplemented from GiNaC::basic.
Referenced by GiNaC::algebraic_match_mul_with_mul(), GiNaC::add::conjugate(), GiNaC::add::do_print_python_repr(), GiNaC::add::get_free_indices(), GiNaC::mul::get_free_indices(), GiNaC::add::series(), and GiNaC::mul::series().
|
overridevirtual |
Construct new expression by applying the specified function to all sub-expressions (one level only, not recursively).
Reimplemented from GiNaC::basic.
|
overridevirtual |
Perform automatic non-interruptive term rewriting rules.
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::mul.
Implementation of ex::to_rational() for expairseqs.
Reimplemented from GiNaC::basic.
Definition at line 2705 of file normal.cpp.
References GiNaC::_ex1, default_overall_coeff(), GiNaC::ex::info(), GiNaC::info_flags::numeric, overall_coeff, recombine_pair_to_ex(), seq, split_ex_to_pair(), thisexpairseq(), and GiNaC::ex::to_rational().
Implementation of ex::to_polynomial() for expairseqs.
Reimplemented from GiNaC::basic.
Definition at line 2721 of file normal.cpp.
References GiNaC::_ex1, default_overall_coeff(), GiNaC::ex::info(), GiNaC::info_flags::numeric, overall_coeff, recombine_pair_to_ex(), seq, split_ex_to_pair(), thisexpairseq(), and GiNaC::ex::to_polynomial().
Check whether the expression matches a given pattern.
For every wildcard object in the pattern, a pair with the wildcard as a key and matching expression as a value is added to repl_lst.
Reimplemented from GiNaC::basic.
Substitute a set of objects by arbitrary expressions.
The ex returned will already be evaluated.
Reimplemented from GiNaC::basic.
|
overridevirtual |
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::mul.
|
overridevirtual |
Save (serialize) the object into archive node.
Archive the object.
Losely speaking, this method turns an expression into a byte stream (which can be saved and restored later on, or sent via network, etc.)
Reimplemented from GiNaC::basic.
|
overridevirtual |
Load (deserialize) the object from an archive node.
Construct object from archive_node.
Reimplemented from GiNaC::basic.
|
overrideprotectedvirtual |
Returns true if two objects of same type are equal.
Normally needs not be reimplemented as long as it wasn't overwritten by some parent class, since it just calls compare_same_type(). The reason why this function exists is that sometimes it is easier to determine equality than an order relation and then it can be overridden.
Reimplemented from GiNaC::basic.
|
overrideprotectedvirtual |
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::mul.
|
overrideprotectedvirtual |
Compute the hash value of an object and if it makes sense to store it in the objects status_flags, do so.
The method inherited from class basic computes a hash value based on the type and hash values of possible members. For this reason it is well suited for container classes but atomic classes should override this implementation because otherwise they would all end up with the same hashvalue.
Reimplemented from GiNaC::basic.
|
overrideprotectedvirtual |
Expand expression, i.e.
multiply it out and return the result as a new expression.
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::mul.
|
protectedvirtual |
Reimplemented in GiNaC::mul, and GiNaC::add.
Referenced by to_polynomial(), and to_rational().
|
protectedvirtual |
Reimplemented in GiNaC::mul, and GiNaC::add.
|
protectedvirtual |
|
protectedvirtual |
Reimplemented in GiNaC::mul, and GiNaC::add.
Referenced by to_polynomial(), and to_rational().
|
protectedvirtual |
Reimplemented in GiNaC::mul, and GiNaC::add.
|
protectedvirtual |
Reimplemented in GiNaC::mul, and GiNaC::add.
Reimplemented in GiNaC::mul, and GiNaC::add.
Referenced by to_polynomial(), and to_rational().
|
protectedvirtual |
Reimplemented in GiNaC::mul.
|
protectedvirtual |
Reimplemented in GiNaC::mul.
Referenced by to_polynomial(), and to_rational().
|
protectedvirtual |
Reimplemented in GiNaC::mul.
|
protectedvirtual |
Reimplemented in GiNaC::mul.
|
protectedvirtual |
Reimplemented in GiNaC::mul.
|
protected |
|
protected |
Referenced by GiNaC::add::add(), and GiNaC::mul::mul().
|
protected |
|
protected |
Referenced by GiNaC::add::add(), and GiNaC::mul::mul().
|
protected |
Referenced by GiNaC::add::add(), and GiNaC::mul::mul().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by GiNaC::add::add(), and GiNaC::mul::mul().
|
protected |
Referenced by GiNaC::add::expand().
|
protected |
Referenced by GiNaC::add::eval().
|
protected |
Definition at line 127 of file expairseq.h.
Referenced by GiNaC::add::coeff(), GiNaC::add::degree(), GiNaC::add::derivative(), GiNaC::mul::do_print(), GiNaC::add::do_print_csrc(), GiNaC::mul::do_print_latex(), GiNaC::add::eval(), GiNaC::mul::eval(), GiNaC::add::eval_ncmul(), GiNaC::add::evalm(), GiNaC::power::expand(), GiNaC::mul::expand(), GiNaC::power::expand_add(), GiNaC::power::expand_add_2(), GiNaC::add::imag_part(), GiNaC::add::info(), GiNaC::add::integer_content(), GiNaC::mul::integer_content(), GiNaC::add::is_polynomial(), GiNaC::add::ldegree(), GiNaC::add::max_coefficient(), GiNaC::mul::max_coefficient(), GiNaC::add::normal(), GiNaC::mul::normal(), GiNaC::add::print_add(), GiNaC::add::real_part(), GiNaC::add::return_type(), GiNaC::add::return_type_tinfo(), GiNaC::add::series(), GiNaC::mul::series(), GiNaC::add::smod(), GiNaC::mul::smod(), to_polynomial(), and to_rational().
|
protected |
Definition at line 128 of file expairseq.h.
Referenced by GiNaC::add::add(), GiNaC::add::coeff(), GiNaC::add::combine_ex_with_coeff_to_pair(), GiNaC::add::degree(), GiNaC::add::do_print_csrc(), GiNaC::mul::do_print_csrc(), GiNaC::add::eval(), GiNaC::mul::eval(), GiNaC::power::eval(), GiNaC::add::evalm(), GiNaC::add::expand(), GiNaC::power::expand(), GiNaC::mul::expand(), GiNaC::power::expand_add(), GiNaC::power::expand_add_2(), GiNaC::add::imag_part(), GiNaC::add::info(), GiNaC::add::integer_content(), GiNaC::mul::integer_content(), GiNaC::add::ldegree(), GiNaC::add::max_coefficient(), GiNaC::mul::max_coefficient(), GiNaC::mul::mul(), GiNaC::add::normal(), GiNaC::mul::normal(), GiNaC::add::print_add(), GiNaC::mul::print_overall_coeff(), GiNaC::add::real_part(), GiNaC::add::series(), GiNaC::mul::series(), GiNaC::add::smod(), GiNaC::mul::smod(), GiNaC::add::split_ex_to_pair(), to_polynomial(), and to_rational().