GiNaC  1.8.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GiNaC::expairseq Class Reference

A sequence of class expair. More...

#include <expairseq.h>

Inheritance diagram for GiNaC::expairseq:
GiNaC::basic GiNaC::refcounted GiNaC::add GiNaC::mul

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...
 
- Public Member Functions inherited from GiNaC::basic
virtual ~basic ()
 basic destructor, virtual because class ex will delete objects of derived classes via a basic*. More...
 
 basic (const basic &other)
 
const basicoperator= (const basic &other)
 basic assignment operator: the other object might be of a derived class. More...
 
virtual basicduplicate () 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 exlet_op (size_t i)
 Return modifiable operand/member at position i. More...
 
virtual exoperator[] (const ex &index)
 
virtual exoperator[] (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 basichold () const
 Stop further evaluation. More...
 
unsigned gethash () const
 
const basicsetflag (unsigned f) const
 Set some status_flags. More...
 
const basicclearflag (unsigned f) const
 Clear some status_flags. More...
 
- Public Member Functions inherited from GiNaC::refcounted
 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
 
- Protected Member Functions inherited from GiNaC::basic
 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
 
- Protected Attributes inherited from GiNaC::basic
unsigned flags
 of type status_flags More...
 
unsigned hashvalue
 hash value More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ expairseq() [1/4]

GiNaC::expairseq::expairseq ( const ex lh,
const ex rh 
)

◆ expairseq() [2/4]

GiNaC::expairseq::expairseq ( const exvector v)

◆ expairseq() [3/4]

GiNaC::expairseq::expairseq ( const epvector v,
const ex oc,
bool  do_index_renaming = false 
)

◆ expairseq() [4/4]

GiNaC::expairseq::expairseq ( epvector &&  vp,
const ex oc,
bool  do_index_renaming = false 
)

Member Function Documentation

◆ precedence()

unsigned GiNaC::expairseq::precedence ( ) const
inlineoverridevirtual

Return relative operator precedence (for parenthezing output).

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::mul.

Definition at line 62 of file expairseq.h.

◆ info()

bool GiNaC::expairseq::info ( unsigned  inf) const
overridevirtual

Information about the object.

See also
class info_flags

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::mul.

◆ nops()

size_t GiNaC::expairseq::nops ( ) const
overridevirtual

◆ op()

ex GiNaC::expairseq::op ( size_t  i) const
overridevirtual

◆ map()

ex GiNaC::expairseq::map ( map_function f) const
overridevirtual

Construct new expression by applying the specified function to all sub-expressions (one level only, not recursively).

Reimplemented from GiNaC::basic.

◆ eval()

ex GiNaC::expairseq::eval ( ) const
overridevirtual

Perform automatic non-interruptive term rewriting rules.

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::mul.

◆ to_rational()

ex GiNaC::expairseq::to_rational ( exmap repl) const
overridevirtual

◆ to_polynomial()

ex GiNaC::expairseq::to_polynomial ( exmap repl) const
overridevirtual

◆ match()

bool GiNaC::expairseq::match ( const ex pattern,
exmap repl_lst 
) const
overridevirtual

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.

◆ subs()

ex GiNaC::expairseq::subs ( const exmap m,
unsigned  options = 0 
) const
overridevirtual

Substitute a set of objects by arbitrary expressions.

The ex returned will already be evaluated.

Reimplemented from GiNaC::basic.

◆ conjugate()

ex GiNaC::expairseq::conjugate ( ) const
overridevirtual

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::mul.

◆ archive()

void GiNaC::expairseq::archive ( archive_node n) const
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.

◆ read_archive()

void GiNaC::expairseq::read_archive ( const archive_node n,
lst syms 
)
overridevirtual

Load (deserialize) the object from an archive node.

Construct object from archive_node.

Note
This method is essentially a constructor. However, constructors can't be virtual. So, if unarchiving routines are implemented as constructors one would need to define such a constructor in every class, even if all it does is simply calling constructor of a superclass.

Reimplemented from GiNaC::basic.

◆ is_equal_same_type()

bool GiNaC::expairseq::is_equal_same_type ( const basic other) const
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.

◆ return_type()

unsigned GiNaC::expairseq::return_type ( ) const
overrideprotectedvirtual

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::mul.

◆ calchash()

unsigned GiNaC::expairseq::calchash ( ) const
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.

◆ expand()

ex GiNaC::expairseq::expand ( unsigned  options = 0) const
overrideprotectedvirtual

Expand expression, i.e.

multiply it out and return the result as a new expression.

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::mul.

◆ thisexpairseq() [1/2]

virtual ex GiNaC::expairseq::thisexpairseq ( const epvector v,
const ex oc,
bool  do_index_renaming = false 
) const
protectedvirtual

Reimplemented in GiNaC::mul, and GiNaC::add.

Referenced by to_polynomial(), and to_rational().

◆ thisexpairseq() [2/2]

virtual ex GiNaC::expairseq::thisexpairseq ( epvector &&  vp,
const ex oc,
bool  do_index_renaming = false 
) const
protectedvirtual

Reimplemented in GiNaC::mul, and GiNaC::add.

◆ printseq()

virtual void GiNaC::expairseq::printseq ( const print_context c,
char  delim,
unsigned  this_precedence,
unsigned  upper_precedence 
) const
protectedvirtual

◆ printpair()

virtual void GiNaC::expairseq::printpair ( const print_context c,
const expair p,
unsigned  upper_precedence 
) const
protectedvirtual

◆ split_ex_to_pair()

virtual expair GiNaC::expairseq::split_ex_to_pair ( const ex e) const
protectedvirtual

Reimplemented in GiNaC::mul, and GiNaC::add.

Referenced by to_polynomial(), and to_rational().

◆ combine_ex_with_coeff_to_pair()

virtual expair GiNaC::expairseq::combine_ex_with_coeff_to_pair ( const ex e,
const ex c 
) const
protectedvirtual

Reimplemented in GiNaC::mul, and GiNaC::add.

◆ combine_pair_with_coeff_to_pair()

virtual expair GiNaC::expairseq::combine_pair_with_coeff_to_pair ( const expair p,
const ex c 
) const
protectedvirtual

Reimplemented in GiNaC::mul, and GiNaC::add.

◆ recombine_pair_to_ex()

virtual ex GiNaC::expairseq::recombine_pair_to_ex ( const expair p) const
protectedvirtual

Reimplemented in GiNaC::mul, and GiNaC::add.

Referenced by to_polynomial(), and to_rational().

◆ expair_needs_further_processing()

virtual bool GiNaC::expairseq::expair_needs_further_processing ( epp  it)
protectedvirtual

Reimplemented in GiNaC::mul.

◆ default_overall_coeff()

virtual ex GiNaC::expairseq::default_overall_coeff ( ) const
protectedvirtual

Reimplemented in GiNaC::mul.

Referenced by to_polynomial(), and to_rational().

◆ combine_overall_coeff() [1/2]

virtual void GiNaC::expairseq::combine_overall_coeff ( const ex c)
protectedvirtual

Reimplemented in GiNaC::mul.

◆ combine_overall_coeff() [2/2]

virtual void GiNaC::expairseq::combine_overall_coeff ( const ex c1,
const ex c2 
)
protectedvirtual

Reimplemented in GiNaC::mul.

◆ can_make_flat()

virtual bool GiNaC::expairseq::can_make_flat ( const expair p) const
protectedvirtual

Reimplemented in GiNaC::mul.

◆ do_print()

void GiNaC::expairseq::do_print ( const print_context c,
unsigned  level 
) const
protected

◆ do_print_tree()

void GiNaC::expairseq::do_print_tree ( const print_tree c,
unsigned  level 
) const
protected

◆ construct_from_2_ex()

void GiNaC::expairseq::construct_from_2_ex ( const ex lh,
const ex rh 
)
protected

Referenced by GiNaC::add::add(), and GiNaC::mul::mul().

◆ construct_from_2_expairseq()

void GiNaC::expairseq::construct_from_2_expairseq ( const expairseq s1,
const expairseq s2 
)
protected

◆ construct_from_expairseq_ex()

void GiNaC::expairseq::construct_from_expairseq_ex ( const expairseq s,
const ex e 
)
protected

◆ construct_from_exvector()

void GiNaC::expairseq::construct_from_exvector ( const exvector v)
protected

Referenced by GiNaC::add::add(), and GiNaC::mul::mul().

◆ construct_from_epvector() [1/2]

void GiNaC::expairseq::construct_from_epvector ( const epvector v,
bool  do_index_renaming = false 
)
protected

Referenced by GiNaC::add::add(), and GiNaC::mul::mul().

◆ construct_from_epvector() [2/2]

void GiNaC::expairseq::construct_from_epvector ( epvector &&  v,
bool  do_index_renaming = false 
)
protected

◆ make_flat() [1/2]

void GiNaC::expairseq::make_flat ( const exvector v)
protected

◆ make_flat() [2/2]

void GiNaC::expairseq::make_flat ( const epvector v,
bool  do_index_renaming = false 
)
protected

◆ canonicalize()

void GiNaC::expairseq::canonicalize ( )
protected

◆ combine_same_terms_sorted_seq()

void GiNaC::expairseq::combine_same_terms_sorted_seq ( )
protected

◆ is_canonical()

bool GiNaC::expairseq::is_canonical ( ) const
protected

Referenced by GiNaC::add::add(), and GiNaC::mul::mul().

◆ expandchildren()

epvector GiNaC::expairseq::expandchildren ( unsigned  options) const
protected

Referenced by GiNaC::add::expand().

◆ evalchildren()

epvector GiNaC::expairseq::evalchildren ( ) const
protected

Referenced by GiNaC::add::eval().

◆ subschildren()

epvector GiNaC::expairseq::subschildren ( const exmap m,
unsigned  options = 0 
) const
protected

Member Data Documentation

◆ seq

epvector GiNaC::expairseq::seq
protected

◆ overall_coeff

ex GiNaC::expairseq::overall_coeff
protected

The documentation for this class was generated from the following files:

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.