]> www.ginac.de Git - ginac.git/blob - ginac/ncmul.h
Alexeis patches for documentation and correct degree of 1/symbol.
[ginac.git] / ginac / ncmul.h
1 /** @file ncmul.h
2  *
3  *  Interface to GiNaC's non-commutative products of expressions. */
4
5 /*
6  *  GiNaC Copyright (C) 1999-2007 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
28 namespace GiNaC {
29
30 /** Non-commutative product of expressions. */
31 class ncmul : public exprseq
32 {
33         GINAC_DECLARE_REGISTERED_CLASS(ncmul, exprseq)
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
42 public:
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, bool discardable=false);
52         ncmul(std::auto_ptr<exvector> vp);
53
54         // functions overriding virtual functions from base classes
55 public:
56         unsigned precedence() const {return 50;}
57         bool info(unsigned inf) const;
58         int degree(const ex & s) const;
59         int ldegree(const ex & s) const;
60         ex expand(unsigned options=0) const;
61         ex coeff(const ex & s, int n=1) const;
62         ex eval(int level=0) const;
63         ex evalm() const;
64         exvector get_free_indices() const;
65         ex thiscontainer(const exvector & v) const;
66         ex thiscontainer(std::auto_ptr<exvector> vp) const;
67         ex conjugate() const;
68         ex real_part() const;
69         ex imag_part() const;
70
71 protected:
72         ex derivative(const symbol & s) const;
73         unsigned return_type() const;
74         tinfo_t return_type_tinfo() const;
75         
76         // new virtual functions which can be overridden by derived classes
77         // none
78
79         // non-virtual functions in this class
80 protected:
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         std::auto_ptr<exvector> expandchildren(unsigned options) const;
86 public:
87         const exvector & get_factors() const;
88 };
89
90 // friend funtions 
91
92 ex reeval_ncmul(const exvector & v);
93 ex hold_ncmul(const exvector & v);
94
95 } // namespace GiNaC
96
97 #endif // ndef __GINAC_NCMUL_H__