]> www.ginac.de Git - ginac.git/blob - ginac/ncmul.h
building in separate directory didn't work
[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-2001 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #ifndef __GINAC_NCMUL_H__
24 #define __GINAC_NCMUL_H__
25
26 #include "exprseq.h"
27
28 #ifndef NO_NAMESPACE_GINAC
29 namespace GiNaC {
30 #endif // ndef NO_NAMESPACE_GINAC
31
32 /** Non-commutative product of expressions. */
33 class ncmul : public exprseq
34 {
35         GINAC_DECLARE_REGISTERED_CLASS(ncmul, exprseq)
36
37         friend class power;
38         friend ex nonsimplified_ncmul(const exvector & v);
39         friend ex simplified_ncmul(const exvector & v);
40
41 // member functions
42
43         // other constructors
44 public:
45         ncmul(const ex & lh, const ex & rh);
46         ncmul(const ex & f1, const ex & f2, const ex & f3);
47         ncmul(const ex & f1, const ex & f2, const ex & f3,
48               const ex & f4);
49         ncmul(const ex & f1, const ex & f2, const ex & f3,
50               const ex & f4, const ex & f5);
51         ncmul(const ex & f1, const ex & f2, const ex & f3,
52               const ex & f4, const ex & f5, const ex & f6);
53         ncmul(const exvector & v, bool discardable=false);
54         ncmul(exvector * vp); // vp will be deleted
55
56         // functions overriding virtual functions from bases classes
57 public:
58         void print(std::ostream & os, unsigned upper_precedence) const;
59         void printraw(std::ostream & os) const;
60         void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence = 0) const;
61         bool info(unsigned inf) const;
62         int degree(const symbol & s) const;
63         int ldegree(const symbol & s) const;
64         ex expand(unsigned options=0) const;
65         ex coeff(const symbol & s, int n=1) const;
66         ex eval(int level=0) const;
67         ex subs(const lst & ls, const lst & lr) const;
68         exvector get_indices(void) const;
69         ex thisexprseq(const exvector & v) const;
70         ex thisexprseq(exvector * vp) const;
71 protected:
72         ex derivative(const symbol & s) const;
73         unsigned return_type(void) const;
74         unsigned return_type_tinfo(void) 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         unsigned count_factors(const ex & e) const;
82         void append_factors(exvector & v, const ex & e) const;
83         exvector expandchildren(unsigned options) const;
84 public:
85         const exvector & get_factors(void) const;
86
87 // member variables
88
89 protected:
90         static unsigned precedence;
91 };
92
93 // friend funtions 
94
95 ex nonsimplified_ncmul(const exvector & v);
96 ex simplified_ncmul(const exvector & v);
97
98 // utility functions
99 inline const ncmul &ex_to_ncmul(const ex &e)
100 {
101         return static_cast <const ncmul &>(*e.bp);
102 }
103
104 #ifndef NO_NAMESPACE_GINAC
105 } // namespace GiNaC
106 #endif // ndef NO_NAMESPACE_GINAC
107
108 #endif // ndef __GINAC_NCMUL_H__