]> www.ginac.de Git - ginac.git/blob - ginac/ncmul.h
Small fixes to avoid compile warnings (-Wall).
[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-2008 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
29 namespace GiNaC {
30
31 /** Non-commutative product of expressions. */
32 class ncmul : public exprseq
33 {
34         GINAC_DECLARE_REGISTERED_CLASS(ncmul, exprseq)
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
43 public:
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, bool discardable=false);
53         ncmul(std::auto_ptr<exvector> vp);
54
55         // functions overriding virtual functions from base classes
56 public:
57         unsigned precedence() const {return 50;}
58         bool info(unsigned inf) const;
59         int degree(const ex & s) const;
60         int ldegree(const ex & s) const;
61         ex expand(unsigned options=0) const;
62         ex coeff(const ex & s, int n=1) const;
63         ex eval(int level=0) const;
64         ex evalm() const;
65         exvector get_free_indices() const;
66         ex thiscontainer(const exvector & v) const;
67         ex thiscontainer(std::auto_ptr<exvector> vp) const;
68         ex conjugate() const;
69         ex real_part() const;
70         ex imag_part() const;
71
72 protected:
73         ex derivative(const symbol & s) const;
74         unsigned return_type() const;
75         return_type_t return_type_tinfo() const;
76         
77         // new virtual functions which can be overridden by derived classes
78         // none
79
80         // non-virtual functions in this class
81 protected:
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         std::auto_ptr<exvector> expandchildren(unsigned options) const;
87 public:
88         const exvector & get_factors() const;
89 };
90 GINAC_DECLARE_UNARCHIVER(ncmul);
91
92 // friend funtions 
93
94 ex reeval_ncmul(const exvector & v);
95 ex hold_ncmul(const exvector & v);
96
97 } // namespace GiNaC
98
99 #endif // ndef __GINAC_NCMUL_H__