GiNaC 1.8.7
Public Member Functions | Protected Member Functions | Friends | List of all members
GiNaC::ncmul Class Reference

Non-commutative product of expressions. More...

#include <ncmul.h>

Inheritance diagram for GiNaC::ncmul:
GiNaC::container< C > GiNaC::basic GiNaC::container_storage< C > GiNaC::refcounted

Public Member Functions

 ncmul (const ex &lh, const ex &rh)
 
 ncmul (const ex &f1, const ex &f2, const ex &f3)
 
 ncmul (const ex &f1, const ex &f2, const ex &f3, const ex &f4)
 
 ncmul (const ex &f1, const ex &f2, const ex &f3, const ex &f4, const ex &f5)
 
 ncmul (const ex &f1, const ex &f2, const ex &f3, const ex &f4, const ex &f5, const ex &f6)
 
 ncmul (const exvector &v)
 
 ncmul (exvector &&v)
 
unsigned precedence () const override
 Return relative operator precedence (for parenthezing output). More...
 
bool info (unsigned inf) const override
 Information about the object. More...
 
int degree (const ex &s) const override
 Return degree of highest power in object s. More...
 
int ldegree (const ex &s) const override
 Return degree of lowest power in object s. More...
 
ex expand (unsigned options=0) const override
 Expand expression, i.e. More...
 
ex coeff (const ex &s, int n=1) const override
 Return coefficient of degree n in object s. More...
 
ex eval () const override
 Perform automatic term rewriting rules in this class. More...
 
ex evalm () const override
 Evaluate sums, products and integer powers of matrices. More...
 
exvector get_free_indices () const override
 Return a vector containing the free indices of an expression. More...
 
ex thiscontainer (const exvector &v) const override
 
ex thiscontainer (exvector &&v) const override
 
ex conjugate () const override
 
ex real_part () const override
 
ex imag_part () const override
 
const exvectorget_factors () const
 
- Public Member Functions inherited from GiNaC::container< C >
 container (STLT const &s)
 
 container (STLT &&v)
 
 container (exvector::const_iterator b, exvector::const_iterator e)
 
 container (std::initializer_list< ex > il)
 
bool info (unsigned inf) const override
 Information about the object. More...
 
unsigned precedence () const override
 Return relative operator precedence (for parenthezing output). 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...
 
exlet_op (size_t i) override
 Return modifiable operand/member at position i. More...
 
ex subs (const exmap &m, unsigned options=0) const override
 Substitute a set of objects by arbitrary expressions. More...
 
void read_archive (const archive_node &n, lst &sym_lst) override
 Load (deserialize) the object from an archive node. More...
 
void archive (archive_node &n) const override
 Archive the object. More...
 
containerprepend (const ex &b)
 Add element at front. More...
 
containerappend (const ex &b)
 Add element at back. More...
 
containerremove_first ()
 Remove first element. More...
 
containerremove_last ()
 Remove last element. More...
 
containerremove_all ()
 Remove all elements. More...
 
containersort ()
 Sort elements. More...
 
containerunique ()
 Remove adjacent duplicate elements. More...
 
const_iterator begin () const
 
const_iterator end () const
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
- 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 eval () const
 Perform automatic non-interruptive term rewriting rules. 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 unsigned precedence () const
 Return relative operator precedence (for parenthezing output). More...
 
virtual bool info (unsigned inf) const
 Information about the object. More...
 
virtual size_t nops () const
 Number of operands/members. More...
 
virtual ex op (size_t i) const
 Return operand/member at position i. 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 bool match (const ex &pattern, exmap &repls) const
 Check whether the expression matches a given pattern. More...
 
virtual ex subs (const exmap &m, unsigned options=0) const
 Substitute a set of objects by arbitrary expressions. More...
 
virtual ex map (map_function &f) const
 Construct new expression by applying the specified function to all sub-expressions (one level only, not recursively). 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 expand (unsigned options=0) const
 Expand expression, i.e. 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 ex to_rational (exmap &repl) const
 Default implementation of ex::to_rational(). More...
 
virtual ex to_polynomial (exmap &repl) const
 
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 unsigned return_type () const
 
virtual return_type_t return_type_tinfo () const
 
virtual ex conjugate () 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...
 
virtual void archive (archive_node &n) const
 Save (serialize) the object into archive node. More...
 
virtual void read_archive (const archive_node &n, lst &syms)
 Load (deserialize) the object from an archive node. 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

ex derivative (const symbol &s) const override
 Implementation of ex::diff() for a non-commutative product. More...
 
unsigned return_type () const override
 
return_type_t return_type_tinfo () const override
 
void do_print (const print_context &c, unsigned level) const
 
void do_print_csrc (const print_context &c, unsigned level) const
 
size_t count_factors (const ex &e) const
 
void append_factors (exvector &v, const ex &e) const
 
exvector expandchildren (unsigned options) const
 
- Protected Member Functions inherited from GiNaC::container< C >
ex conjugate () const override
 
ex real_part () const override
 
ex imag_part () const override
 
bool is_equal_same_type (const basic &other) const override
 Returns true if two objects of same type are equal. More...
 
virtual ex thiscontainer (const STLT &v) const
 Similar to duplicate(), but with a preset sequence. More...
 
virtual ex thiscontainer (STLT &&v) const
 Similar to duplicate(), but with a preset sequence (which gets pilfered). More...
 
virtual void printseq (const print_context &c, char openbracket, char delim, char closebracket, unsigned this_precedence, unsigned upper_precedence=0) const
 Print sequence of contained elements. More...
 
void do_print (const print_context &c, unsigned level) const
 
void do_print_tree (const print_tree &c, unsigned level) const
 
void do_print_python (const print_python &c, unsigned level) const
 
void do_print_python_repr (const print_python_repr &c, unsigned level) const
 
STLT 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...
 
virtual bool is_equal_same_type (const basic &other) const
 Returns true if two objects of same type are equal. More...
 
virtual unsigned calchash () const
 Compute the hash value of an object and if it makes sense to store it in the objects status_flags, do so. 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 Member Functions inherited from GiNaC::container_storage< C >
 container_storage ()
 
 container_storage (size_t n, const ex &e)
 
 container_storage (std::initializer_list< ex > il)
 
template<class In >
 container_storage (In b, In e)
 
void reserve (size_t)
 
 ~container_storage ()
 
void reserve (size_t n)
 
void reserve (std::vector< ex > &v, size_t n)
 

Friends

class power
 
ex reeval_ncmul (const exvector &v)
 
ex hold_ncmul (const exvector &v)
 

Additional Inherited Members

- Public Types inherited from GiNaC::container< C >
typedef STLT::const_iterator const_iterator
 
typedef STLT::const_reverse_iterator const_reverse_iterator
 
- Protected Types inherited from GiNaC::container< C >
typedef container_storage< C >::STLT STLT
 
- Protected Types inherited from GiNaC::container_storage< C >
typedef C< exSTLT
 
- Static Protected Member Functions inherited from GiNaC::container< C >
static unsigned get_default_flags ()
 Specialization of container::get_default_flags() for lst. More...
 
static char get_open_delim ()
 Specialization of container::get_open_delim() for lst. More...
 
static char get_close_delim ()
 Specialization of container::get_close_delim() for lst. More...
 
- Static Protected Member Functions inherited from GiNaC::container_storage< C >
static void reserve (STLT &, size_t)
 
- Protected Attributes inherited from GiNaC::basic
unsigned flags
 of type status_flags More...
 
unsigned hashvalue
 hash value More...
 
- Protected Attributes inherited from GiNaC::container_storage< C >
STLT seq
 

Detailed Description

Non-commutative product of expressions.

Definition at line 32 of file ncmul.h.

Constructor & Destructor Documentation

◆ ncmul() [1/7]

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

Definition at line 60 of file ncmul.cpp.

◆ ncmul() [2/7]

GiNaC::ncmul::ncmul ( const ex f1,
const ex f2,
const ex f3 
)

Definition at line 64 of file ncmul.cpp.

◆ ncmul() [3/7]

GiNaC::ncmul::ncmul ( const ex f1,
const ex f2,
const ex f3,
const ex f4 
)

Definition at line 68 of file ncmul.cpp.

◆ ncmul() [4/7]

GiNaC::ncmul::ncmul ( const ex f1,
const ex f2,
const ex f3,
const ex f4,
const ex f5 
)

Definition at line 73 of file ncmul.cpp.

◆ ncmul() [5/7]

GiNaC::ncmul::ncmul ( const ex f1,
const ex f2,
const ex f3,
const ex f4,
const ex f5,
const ex f6 
)

Definition at line 78 of file ncmul.cpp.

◆ ncmul() [6/7]

GiNaC::ncmul::ncmul ( const exvector v)

Definition at line 83 of file ncmul.cpp.

◆ ncmul() [7/7]

GiNaC::ncmul::ncmul ( exvector &&  v)

Definition at line 87 of file ncmul.cpp.

Member Function Documentation

◆ precedence()

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

Return relative operator precedence (for parenthezing output).

Reimplemented from GiNaC::container< C >.

Definition at line 57 of file ncmul.h.

Referenced by do_print(), and do_print_csrc().

◆ info()

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

Information about the object.

See also
class info_flags

Reimplemented from GiNaC::container< C >.

Definition at line 113 of file ncmul.cpp.

◆ degree()

int GiNaC::ncmul::degree ( const ex s) const
overridevirtual

Return degree of highest power in object s.

Reimplemented from GiNaC::basic.

Definition at line 196 of file ncmul.cpp.

References GiNaC::basic::is_equal(), and GiNaC::container_storage< C >::seq.

◆ ldegree()

int GiNaC::ncmul::ldegree ( const ex s) const
overridevirtual

Return degree of lowest power in object s.

Reimplemented from GiNaC::basic.

Definition at line 208 of file ncmul.cpp.

References GiNaC::basic::is_equal(), and GiNaC::container_storage< C >::seq.

◆ expand()

ex GiNaC::ncmul::expand ( unsigned  options = 0) const
overridevirtual

Expand expression, i.e.

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

Reimplemented from GiNaC::basic.

Definition at line 120 of file ncmul.cpp.

References GiNaC::_ex1, expandchildren(), GiNaC::status_flags::expanded, k, GiNaC::container< C >::op(), options, GiNaC::rename_dummy_indices_uniquely(), GiNaC::container_storage< C >::seq, and GiNaC::basic::setflag().

◆ coeff()

ex GiNaC::ncmul::coeff ( const ex s,
int  n = 1 
) const
overridevirtual

Return coefficient of degree n in object s.

Reimplemented from GiNaC::basic.

Definition at line 220 of file ncmul.cpp.

References GiNaC::_ex0, GiNaC::_ex1, c, GiNaC::basic::is_equal(), n, and GiNaC::container_storage< C >::seq.

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

◆ eval()

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

Perform automatic term rewriting rules in this class.

In the following x, x1, x2,... stand for a symbolic variables of type ex and c, c1, c2... stand for such expressions that contain a plain number.

  • ncmul(...,*(x1,x2),...,ncmul(x3,x4),...) -> ncmul(...,x1,x2,...,x3,x4,...) (associativity)
  • ncmul(x) -> x
  • ncmul() -> 1
  • ncmul(...,c1,...,c2,...) -> *(c1,c2,ncmul(...)) (pull out commutative elements)
  • ncmul(x1,y1,x2,y2) -> *(ncmul(x1,x2),ncmul(y1,y2)) (collect elements of same type)
  • ncmul(x1,x2,x3,...) -> x::eval_ncmul(x1,x2,x3,...)

Reimplemented from GiNaC::basic.

Definition at line 289 of file ncmul.cpp.

References GiNaC::_ex1, append_factors(), GiNaC::return_types::commutative, count_factors(), GiNaC::status_flags::evaluated, GiNaC::factor(), factors, GiNaC::basic::flags, GINAC_ASSERT, GiNaC::make_flat_inserter::handle_factor(), GiNaC::return_types::noncommutative, GiNaC::return_types::noncommutative_composite, GiNaC::container_storage< C >::reserve(), and GiNaC::container_storage< C >::seq.

◆ evalm()

ex GiNaC::ncmul::evalm ( ) const
overridevirtual

Evaluate sums, products and integer powers of matrices.

Reimplemented from GiNaC::basic.

Definition at line 424 of file ncmul.cpp.

References GiNaC::ex::begin(), GiNaC::matrix::mul(), and GiNaC::container_storage< C >::seq.

◆ get_free_indices()

exvector GiNaC::ncmul::get_free_indices ( ) const
overridevirtual

Return a vector containing the free indices of an expression.

Reimplemented from GiNaC::basic.

Definition at line 494 of file indexed.cpp.

References GiNaC::find_free_and_dummy(), GiNaC::ex::get_free_indices(), GiNaC::container< C >::nops(), and GiNaC::container< C >::op().

◆ thiscontainer() [1/2]

ex GiNaC::ncmul::thiscontainer ( const exvector v) const
override

Definition at line 450 of file ncmul.cpp.

◆ thiscontainer() [2/2]

ex GiNaC::ncmul::thiscontainer ( exvector &&  v) const
override

Definition at line 455 of file ncmul.cpp.

◆ conjugate()

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

◆ real_part()

ex GiNaC::ncmul::real_part ( ) const
overridevirtual

Reimplemented from GiNaC::container< C >.

Definition at line 479 of file ncmul.cpp.

References GiNaC::basic::real_part().

◆ imag_part()

ex GiNaC::ncmul::imag_part ( ) const
overridevirtual

Reimplemented from GiNaC::container< C >.

Definition at line 484 of file ncmul.cpp.

References GiNaC::basic::imag_part().

◆ derivative()

ex GiNaC::ncmul::derivative ( const symbol s) const
overrideprotectedvirtual

Implementation of ex::diff() for a non-commutative product.

It applies the product rule.

See also
ex::diff

Reimplemented from GiNaC::basic.

Definition at line 494 of file ncmul.cpp.

References GiNaC::container_storage< C >::seq, and GiNaC::ex::swap().

◆ return_type()

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

◆ return_type_tinfo()

return_type_t GiNaC::ncmul::return_type_tinfo ( ) const
overrideprotectedvirtual

Reimplemented from GiNaC::basic.

Definition at line 546 of file ncmul.cpp.

References GiNaC::return_types::noncommutative, and GiNaC::container_storage< C >::seq.

Referenced by conjugate().

◆ do_print()

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

Definition at line 102 of file ncmul.cpp.

References c, precedence(), and GiNaC::container< C >::printseq().

◆ do_print_csrc()

void GiNaC::ncmul::do_print_csrc ( const print_context c,
unsigned  level 
) const
protected

Definition at line 107 of file ncmul.cpp.

References c, precedence(), and GiNaC::container< C >::printseq().

◆ count_factors()

size_t GiNaC::ncmul::count_factors ( const ex e) const
protected

◆ append_factors()

void GiNaC::ncmul::append_factors ( exvector v,
const ex e 
) const
protected

◆ expandchildren()

exvector GiNaC::ncmul::expandchildren ( unsigned  options) const
protected

◆ get_factors()

const exvector & GiNaC::ncmul::get_factors ( ) const

Definition at line 600 of file ncmul.cpp.

References GiNaC::container_storage< C >::seq.

Friends And Related Function Documentation

◆ power

friend class power
friend

Definition at line 36 of file ncmul.h.

◆ reeval_ncmul

ex reeval_ncmul ( const exvector v)
friend

Definition at line 609 of file ncmul.cpp.

◆ hold_ncmul

ex hold_ncmul ( const exvector v)
friend

Definition at line 614 of file ncmul.cpp.


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.