GiNaC 1.8.10
ncmul.h
Go to the documentation of this file.
1
5/*
6 * GiNaC Copyright (C) 1999-2026 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, see <https://www.gnu.org/licenses/>.
20 */
21
22#ifndef GINAC_NCMUL_H
23#define GINAC_NCMUL_H
24
25#include "exprseq.h"
26#include "archive.h"
27
28namespace GiNaC {
29
31class ncmul : public exprseq
32{
34
35 friend class power;
36 friend ex reeval_ncmul(const exvector & v);
37 friend ex hold_ncmul(const exvector & v);
38
39// member functions
40
41 // other constructors
42public:
43 ncmul(const ex & lh, const ex & rh);
44 ncmul(const ex & f1, const ex & f2, const ex & f3);
45 ncmul(const ex & f1, const ex & f2, const ex & f3,
46 const ex & f4);
47 ncmul(const ex & f1, const ex & f2, const ex & f3,
48 const ex & f4, const ex & f5);
49 ncmul(const ex & f1, const ex & f2, const ex & f3,
50 const ex & f4, const ex & f5, const ex & f6);
51 ncmul(const exvector & v);
52 ncmul(exvector && v);
53
54 // functions overriding virtual functions from base classes
55public:
56 unsigned precedence() const override {return 50;}
57 bool info(unsigned inf) const override;
58 int degree(const ex & s) const override;
59 int ldegree(const ex & s) const override;
60 ex expand(unsigned options=0) const override;
61 ex coeff(const ex & s, int n=1) const override;
62 ex eval() const override;
63 ex evalm() const override;
64 exvector get_free_indices() const override;
65 ex thiscontainer(const exvector & v) const override;
66 ex thiscontainer(exvector && v) const override;
67 ex conjugate() const override;
68 ex real_part() const override;
69 ex imag_part() const override;
70
71protected:
72 ex derivative(const symbol & s) const override;
73 unsigned return_type() const override;
74 return_type_t return_type_tinfo() const override;
75
76 // new virtual functions which can be overridden by derived classes
77 // none
78
79 // non-virtual functions in this class
80protected:
81 void do_print(const print_context & c, unsigned level) const;
82 void do_print_csrc(const print_context & c, unsigned level) const;
83 size_t count_factors(const ex & e) const;
84 void append_factors(exvector & v, const ex & e) const;
85 exvector expandchildren(unsigned options) const;
86public:
87 const exvector & get_factors() const;
88};
90
91// friend funtions
92
93ex reeval_ncmul(const exvector & v);
94ex hold_ncmul(const exvector & v);
95
96} // namespace GiNaC
97
98#endif // ndef GINAC_NCMUL_H
Archiving of GiNaC expressions.
#define GINAC_DECLARE_UNARCHIVER(classname)
Helper macros to register a class with (un)archiving (a.k.a.
Definition archive.h:218
Wrapper template for making GiNaC classes out of STL containers.
Definition container.h:72
Lightweight wrapper for GiNaC's symbolic objects.
Definition ex.h:72
Non-commutative product of expressions.
Definition ncmul.h:32
unsigned precedence() const override
Return relative operator precedence (for parenthezing output).
Definition ncmul.h:56
int ldegree(const ex &s) const override
Return degree of lowest power in object s.
Definition ncmul.cpp:206
friend ex reeval_ncmul(const exvector &v)
Definition ncmul.cpp:607
int degree(const ex &s) const override
Return degree of highest power in object s.
Definition ncmul.cpp:194
void append_factors(exvector &v, const ex &e) const
Definition ncmul.cpp:264
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:218
return_type_t return_type_tinfo() const override
Definition ncmul.cpp:544
void do_print(const print_context &c, unsigned level) const
Definition ncmul.cpp:100
ex expand(unsigned options=0) const override
Expand expression, i.e.
Definition ncmul.cpp:118
exvector expandchildren(unsigned options) const
Definition ncmul.cpp:568
ex imag_part() const override
Definition ncmul.cpp:482
ex real_part() const override
Definition ncmul.cpp:477
void do_print_csrc(const print_context &c, unsigned level) const
Definition ncmul.cpp:105
ex eval() const override
Perform automatic term rewriting rules in this class.
Definition ncmul.cpp:287
friend ex hold_ncmul(const exvector &v)
Definition ncmul.cpp:612
ex evalm() const override
Evaluate sums, products and integer powers of matrices.
Definition ncmul.cpp:422
ex derivative(const symbol &s) const override
Implementation of ex::diff() for a non-commutative product.
Definition ncmul.cpp:492
unsigned return_type() const override
Definition ncmul.cpp:514
bool info(unsigned inf) const override
Information about the object.
Definition ncmul.cpp:111
const exvector & get_factors() const
Definition ncmul.cpp:598
size_t count_factors(const ex &e) const
Definition ncmul.cpp:251
ex thiscontainer(const exvector &v) const override
Definition ncmul.cpp:448
ex conjugate() const override
Definition ncmul.cpp:458
This class holds a two-component object, a basis and and exponent representing exponentiation.
Definition power.h:38
Base class for print_contexts.
Definition print.h:101
Basic CAS symbol.
Definition symbol.h:38
Definition of GiNaC's exprseq.
unsigned options
Definition factor.cpp:2473
size_t n
Definition factor.cpp:1431
size_t c
Definition factor.cpp:756
Definition add.cpp:35
ex hold_ncmul(const exvector &v)
Definition ncmul.cpp:612
ex reeval_ncmul(const exvector &v)
Definition ncmul.cpp:607
std::vector< ex > exvector
Definition basic.h:47
#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the declaration of each registered class.
Definition registrar.h:151
To distinguish between different kinds of non-commutative objects.
Definition registrar.h:42

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