GiNaC 1.8.7
ncmul.h
Go to the documentation of this file.
1
5/*
6 * GiNaC Copyright (C) 1999-2023 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_NCMUL_H
24#define GINAC_NCMUL_H
25
26#include "exprseq.h"
27#include "archive.h"
28
29namespace GiNaC {
30
32class ncmul : public exprseq
33{
35
36 friend class power;
37 friend ex reeval_ncmul(const exvector & v);
38 friend ex hold_ncmul(const exvector & v);
39
40// member functions
41
42 // other constructors
43public:
44 ncmul(const ex & lh, const ex & rh);
45 ncmul(const ex & f1, const ex & f2, const ex & f3);
46 ncmul(const ex & f1, const ex & f2, const ex & f3,
47 const ex & f4);
48 ncmul(const ex & f1, const ex & f2, const ex & f3,
49 const ex & f4, const ex & f5);
50 ncmul(const ex & f1, const ex & f2, const ex & f3,
51 const ex & f4, const ex & f5, const ex & f6);
52 ncmul(const exvector & v);
53 ncmul(exvector && v);
54
55 // functions overriding virtual functions from base classes
56public:
57 unsigned precedence() const override {return 50;}
58 bool info(unsigned inf) const override;
59 int degree(const ex & s) const override;
60 int ldegree(const ex & s) const override;
61 ex expand(unsigned options=0) const override;
62 ex coeff(const ex & s, int n=1) const override;
63 ex eval() const override;
64 ex evalm() const override;
65 exvector get_free_indices() const override;
66 ex thiscontainer(const exvector & v) const override;
67 ex thiscontainer(exvector && v) const override;
68 ex conjugate() const override;
69 ex real_part() const override;
70 ex imag_part() const override;
71
72protected:
73 ex derivative(const symbol & s) const override;
74 unsigned return_type() const override;
75 return_type_t return_type_tinfo() const override;
76
77 // new virtual functions which can be overridden by derived classes
78 // none
79
80 // non-virtual functions in this class
81protected:
82 void do_print(const print_context & c, unsigned level) const;
83 void do_print_csrc(const print_context & c, unsigned level) const;
84 size_t count_factors(const ex & e) const;
85 void append_factors(exvector & v, const ex & e) const;
86 exvector expandchildren(unsigned options) const;
87public:
88 const exvector & get_factors() const;
89};
91
92// friend funtions
93
94ex reeval_ncmul(const exvector & v);
95ex hold_ncmul(const exvector & v);
96
97} // namespace GiNaC
98
99#endif // ndef GINAC_NCMUL_H
Archiving of GiNaC expressions.
Wrapper template for making GiNaC classes out of STL containers.
Definition: container.h:73
Lightweight wrapper for GiNaC's symbolic objects.
Definition: ex.h:72
Non-commutative product of expressions.
Definition: ncmul.h:33
unsigned precedence() const override
Return relative operator precedence (for parenthezing output).
Definition: ncmul.h:57
int ldegree(const ex &s) const override
Return degree of lowest power in object s.
Definition: ncmul.cpp:208
friend ex reeval_ncmul(const exvector &v)
Definition: ncmul.cpp:609
int degree(const ex &s) const override
Return degree of highest power in object s.
Definition: ncmul.cpp:196
void append_factors(exvector &v, const ex &e) const
Definition: ncmul.cpp:266
exvector get_free_indices() const override
Return a vector containing the free indices of an expression.
Definition: indexed.cpp:494
ex coeff(const ex &s, int n=1) const override
Return coefficient of degree n in object s.
Definition: ncmul.cpp:220
return_type_t return_type_tinfo() const override
Definition: ncmul.cpp:546
void do_print(const print_context &c, unsigned level) const
Definition: ncmul.cpp:102
ex expand(unsigned options=0) const override
Expand expression, i.e.
Definition: ncmul.cpp:120
exvector expandchildren(unsigned options) const
Definition: ncmul.cpp:570
ex imag_part() const override
Definition: ncmul.cpp:484
ex real_part() const override
Definition: ncmul.cpp:479
void do_print_csrc(const print_context &c, unsigned level) const
Definition: ncmul.cpp:107
ex eval() const override
Perform automatic term rewriting rules in this class.
Definition: ncmul.cpp:289
friend ex hold_ncmul(const exvector &v)
Definition: ncmul.cpp:614
ex evalm() const override
Evaluate sums, products and integer powers of matrices.
Definition: ncmul.cpp:424
ex derivative(const symbol &s) const override
Implementation of ex::diff() for a non-commutative product.
Definition: ncmul.cpp:494
unsigned return_type() const override
Definition: ncmul.cpp:516
bool info(unsigned inf) const override
Information about the object.
Definition: ncmul.cpp:113
const exvector & get_factors() const
Definition: ncmul.cpp:600
size_t count_factors(const ex &e) const
Definition: ncmul.cpp:253
ex thiscontainer(const exvector &v) const override
Definition: ncmul.cpp:450
ex conjugate() const override
Definition: ncmul.cpp:460
This class holds a two-component object, a basis and and exponent representing exponentiation.
Definition: power.h:39
Base class for print_contexts.
Definition: print.h:103
Basic CAS symbol.
Definition: symbol.h:39
Definition of GiNaC's exprseq.
unsigned options
Definition: factor.cpp:2475
size_t n
Definition: factor.cpp:1432
size_t c
Definition: factor.cpp:757
Definition: add.cpp:38
ex hold_ncmul(const exvector &v)
Definition: ncmul.cpp:614
ex reeval_ncmul(const exvector &v)
Definition: ncmul.cpp:609
GINAC_DECLARE_UNARCHIVER(add)
std::vector< ex > exvector
Definition: basic.h:48
#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the declaration of each registered class.
Definition: registrar.h:153
To distinguish between different kinds of non-commutative objects.
Definition: registrar.h:44

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