3 * Interface to GiNaC's non-commutative products of expressions. */
6 * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
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.
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.
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
23 #ifndef __GINAC_NCMUL_H__
24 #define __GINAC_NCMUL_H__
26 #include <ginac/exprseq.h>
28 #ifndef NO_GINAC_NAMESPACE
30 #endif // ndef NO_GINAC_NAMESPACE
32 /** Non-commutative product of expressions. */
33 class ncmul : public exprseq
36 friend ex nonsimplified_ncmul(exvector const & v);
37 friend ex simplified_ncmul(exvector const & v);
41 // default constructor, destructor, copy constructor assignment operator and helpers
45 ncmul(ncmul const & other);
46 ncmul const & operator=(ncmul const & other);
48 void copy(ncmul const & other);
49 void destroy(bool call_parent);
53 ncmul(ex const & lh, ex const & rh);
54 ncmul(ex const & f1, ex const & f2, ex const & f3);
55 ncmul(ex const & f1, ex const & f2, ex const & f3,
57 ncmul(ex const & f1, ex const & f2, ex const & f3,
58 ex const & f4, ex const & f5);
59 ncmul(ex const & f1, ex const & f2, ex const & f3,
60 ex const & f4, ex const & f5, ex const & f6);
61 ncmul(exvector const & v, bool discardable=false);
62 ncmul(exvector * vp); // vp will be deleted
64 // functions overriding virtual functions from bases classes
66 basic * duplicate() const;
67 void print(ostream & os, unsigned upper_precedence) const;
68 void printraw(ostream & os) const;
69 void printcsrc(ostream & os, unsigned upper_precedence) const;
70 bool info(unsigned inf) const;
71 int degree(symbol const & s) const;
72 int ldegree(symbol const & s) const;
73 ex expand(unsigned options=0) const;
74 ex coeff(symbol const & s, int const n=1) const;
75 ex eval(int level=0) const;
76 ex diff(symbol const & s) const;
77 ex subs(lst const & ls, lst const & lr) const;
78 exvector get_indices(void) const;
79 ex thisexprseq(exvector const & v) const;
80 ex thisexprseq(exvector * vp) const;
82 int compare_same_type(basic const & other) const;
83 unsigned return_type(void) const;
84 unsigned return_type_tinfo(void) const;
86 // new virtual functions which can be overridden by derived classes
89 // non-virtual functions in this class
91 unsigned count_factors(ex const & e) const;
92 void append_factors(exvector & v, ex const & e) const;
93 exvector expandchildren(unsigned options) const;
95 exvector const & get_factors(void) const;
100 static unsigned precedence;
105 extern const ncmul some_ncmul;
106 extern type_info const & typeid_ncmul;
110 ex nonsimplified_ncmul(exvector const & v);
111 ex simplified_ncmul(exvector const & v);
114 inline const ncmul &ex_to_ncmul(const ex &e)
116 return static_cast <const ncmul &>(*e.bp);
119 #ifndef NO_GINAC_NAMESPACE
121 #endif // ndef NO_GINAC_NAMESPACE
123 #endif // ndef __GINAC_NCMUL_H__