GiNaC  1.8.0
mul.h
Go to the documentation of this file.
1 
5 /*
6  * GiNaC Copyright (C) 1999-2020 Johannes Gutenberg University Mainz, Germany
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef GINAC_MUL_H
24 #define GINAC_MUL_H
25 
26 #include "expairseq.h"
27 
28 namespace GiNaC {
29 
31 class mul : public expairseq
32 {
34 
35  friend class add;
36  friend class ncmul;
37  friend class power;
38 
39  // other constructors
40 public:
41  mul(const ex & lh, const ex & rh);
42  mul(const exvector & v);
43  mul(const epvector & v);
44  mul(const epvector & v, const ex & oc, bool do_index_renaming = false);
45  mul(epvector && vp);
46  mul(epvector && vp, const ex & oc, bool do_index_renaming = false);
47  mul(const ex & lh, const ex & mh, const ex & rh);
48 
49  // functions overriding virtual functions from base classes
50 public:
51  unsigned precedence() const override {return 50;}
52  bool info(unsigned inf) const override;
53  bool is_polynomial(const ex & var) const override;
54  int degree(const ex & s) const override;
55  int ldegree(const ex & s) const override;
56  ex coeff(const ex & s, int n = 1) const override;
57  bool has(const ex & other, unsigned options = 0) const override;
58  ex eval() const override;
59  ex evalf() const override;
60  ex real_part() const override;
61  ex imag_part() const override;
62  ex evalm() const override;
63  ex series(const relational & s, int order, unsigned options = 0) const override;
64  ex normal(exmap & repl, exmap & rev_lookup, lst & modifier) const override;
65  numeric integer_content() const override;
66  ex smod(const numeric &xi) const override;
67  numeric max_coefficient() const override;
68  exvector get_free_indices() const override;
69  ex conjugate() const override;
70 protected:
71  ex derivative(const symbol & s) const override;
72  ex eval_ncmul(const exvector & v) const override;
73  unsigned return_type() const override;
74  return_type_t return_type_tinfo() const override;
75  ex thisexpairseq(const epvector & v, const ex & oc, bool do_index_renaming = false) const override;
76  ex thisexpairseq(epvector && vp, const ex & oc, bool do_index_renaming = false) const override;
77  expair split_ex_to_pair(const ex & e) const override;
78  expair combine_ex_with_coeff_to_pair(const ex & e, const ex & c) const override;
79  expair combine_pair_with_coeff_to_pair(const expair & p, const ex & c) const override;
80  ex recombine_pair_to_ex(const expair & p) const override;
81  bool expair_needs_further_processing(epp it) override;
82  ex default_overall_coeff() const override;
83  void combine_overall_coeff(const ex & c) override;
84  void combine_overall_coeff(const ex & c1, const ex & c2) override;
85  bool can_make_flat(const expair & p) const override;
86  ex expand(unsigned options=0) const override;
87 
88  // new virtual functions which can be overridden by derived classes
89  // none
90 
91  // non-virtual functions in this class
92 public:
93  ex algebraic_subs_mul(const exmap & m, unsigned options) const;
94 protected:
95  void find_real_imag(ex&, ex&) const;
96  void print_overall_coeff(const print_context & c, const char *mul_sym) const;
97  void do_print(const print_context & c, unsigned level) const;
98  void do_print_latex(const print_latex & c, unsigned level) const;
99  void do_print_csrc(const print_csrc & c, unsigned level) const;
100  void do_print_python_repr(const print_python_repr & c, unsigned level) const;
101  static bool can_be_further_expanded(const ex & e);
102  epvector expandchildren(unsigned options) const;
103 };
105 
106 } // namespace GiNaC
107 
108 #endif // ndef GINAC_MUL_H
int ldegree(const ex &s) const override
Return degree of lowest power in object s.
Definition: mul.cpp:412
Non-commutative product of expressions.
Definition: ncmul.h:32
bool expair_needs_further_processing(epp it) override
Definition: mul.cpp:1007
ex real_part() const override
Definition: mul.cpp:608
void combine_overall_coeff(const ex &c) override
Definition: mul.cpp:1035
A sequence of class expair.
Definition: expairseq.h:49
expair combine_ex_with_coeff_to_pair(const ex &e, const ex &c) const override
Definition: mul.cpp:956
ex evalf() const override
Evaluate object numerically.
Definition: mul.cpp:577
Definition: add.cpp:38
Product of expressions.
Definition: mul.h:31
numeric integer_content() const override
Definition: normal.cpp:348
This class holds a relation consisting of two expressions and a logical relation between them...
Definition: relational.h:34
Interface to sequences of expression pairs.
Context for python-parsable output.
Definition: print.h:138
unsigned precedence() const override
Return relative operator precedence (for parenthezing output).
Definition: mul.h:51
ex smod(const numeric &xi) const override
Apply symmetric modular homomorphism to an expanded multivariate polynomial.
Definition: normal.cpp:1228
ex derivative(const symbol &s) const override
Implementation of ex::diff() for a product.
Definition: mul.cpp:863
ex eval() const override
Perform automatic term rewriting rules in this class.
Definition: mul.cpp:468
ex recombine_pair_to_ex(const expair &p) const override
Definition: mul.cpp:999
ex series(const relational &s, int order, unsigned options=0) const override
Implementation of ex::series() for product.
Definition: pseries.cpp:864
ex expand(unsigned options=0) const override
Expand expression, i.e.
Definition: mul.cpp:1072
ex algebraic_subs_mul(const exmap &m, unsigned options) const
Definition: mul.cpp:770
expair split_ex_to_pair(const ex &e) const override
Definition: mul.cpp:946
bool has(const ex &other, unsigned options=0) const override
Test for occurrence of a pattern.
Definition: mul.cpp:754
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
Definition: numeric.h:81
Context for latex-parsable output.
Definition: print.h:122
exvector get_free_indices() const override
Return a vector containing the free indices of an expression.
Definition: indexed.cpp:479
ex eval_ncmul(const exvector &v) const override
Definition: mul.cpp:660
unsigned options
Definition: factor.cpp:2480
expair combine_pair_with_coeff_to_pair(const expair &p, const ex &c) const override
Definition: mul.cpp:976
mvec m
Definition: factor.cpp:771
ex default_overall_coeff() const override
Definition: mul.cpp:1030
ex conjugate() const override
Definition: mul.cpp:829
void do_print_python_repr(const print_python_repr &c, unsigned level) const
Definition: mul.cpp:261
void do_print_latex(const print_latex &c, unsigned level) const
Definition: mul.cpp:168
ex thisexpairseq(const epvector &v, const ex &oc, bool do_index_renaming=false) const override
Definition: mul.cpp:936
Sum of expressions.
Definition: add.h:31
numeric max_coefficient() const override
Implementation ex::max_coefficient().
Definition: normal.cpp:1185
To distinguish between different kinds of non-commutative objects.
Definition: registrar.h:43
void do_print_csrc(const print_csrc &c, unsigned level) const
Definition: mul.cpp:208
bool can_make_flat(const expair &p) const override
Definition: mul.cpp:1050
ex evalm() const override
Evaluate sums, products and integer powers of matrices.
Definition: mul.cpp:622
std::vector< ex > exvector
Definition: basic.h:46
std::map< ex, ex, ex_is_less > exmap
Definition: basic.h:50
epvector::iterator epp
expair-vector pointer
Definition: expairseq.h:34
void print_overall_coeff(const print_context &c, const char *mul_sym) const
Definition: mul.cpp:126
return_type_t return_type_tinfo() const override
Definition: mul.cpp:922
void do_print(const print_context &c, unsigned level) const
Definition: mul.cpp:148
static bool can_be_further_expanded(const ex &e)
Definition: mul.cpp:1058
epvector expandchildren(unsigned options) const
Member-wise expand the expairs representing this sequence.
Definition: mul.cpp:1258
size_t n
Definition: factor.cpp:1463
Base class for print_contexts.
Definition: print.h:102
A pair of expressions.
Definition: expair.h:37
int degree(const ex &s) const override
Return degree of highest power in object s.
Definition: mul.cpp:397
bool info(unsigned inf) const override
Information about the object.
Definition: mul.cpp:272
bool is_polynomial(const ex &var) const override
Check whether this is a polynomial in the given variables.
Definition: mul.cpp:386
Lightweight wrapper for GiNaC&#39;s symbolic objects.
Definition: ex.h:72
This class holds a two-component object, a basis and and exponent representing exponentiation.
Definition: power.h:38
ex imag_part() const override
Definition: mul.cpp:615
int order
Basic CAS symbol.
Definition: symbol.h:38
Wrapper template for making GiNaC classes out of STL containers.
Definition: container.h:73
#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the declaration of each registered class.
Definition: registrar.h:153
Base context for C source output.
Definition: print.h:157
unsigned return_type() const override
Definition: mul.cpp:889
void find_real_imag(ex &, ex &) const
Definition: mul.cpp:587
std::vector< expair > epvector
expair-vector
Definition: expairseq.h:33
GINAC_DECLARE_UNARCHIVER(add)
ex normal(exmap &repl, exmap &rev_lookup, lst &modifier) const override
Implementation of ex::normal() for a product.
Definition: normal.cpp:2371
ex coeff(const ex &s, int n=1) const override
Return coefficient of degree n in object s.
Definition: mul.cpp:427
size_t c
Definition: factor.cpp:770

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