3 * Interface to GiNaC's non-commutative products of expressions.
5 * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef __GINAC_NCMUL_H__
23 #define __GINAC_NCMUL_H__
25 #include <ginac/exprseq.h>
27 /** Non-commutative product of expressions. */
28 class ncmul : public exprseq
31 friend ex nonsimplified_ncmul(exvector const & v);
32 friend ex simplified_ncmul(exvector const & v);
36 // default constructor, destructor, copy constructor assignment operator and helpers
40 ncmul(ncmul const & other);
41 ncmul const & operator=(ncmul const & other);
43 void copy(ncmul const & other);
44 void destroy(bool call_parent);
48 ncmul(ex const & lh, ex const & rh);
49 ncmul(ex const & f1, ex const & f2, ex const & f3);
50 ncmul(ex const & f1, ex const & f2, ex const & f3,
52 ncmul(ex const & f1, ex const & f2, ex const & f3,
53 ex const & f4, ex const & f5);
54 ncmul(ex const & f1, ex const & f2, ex const & f3,
55 ex const & f4, ex const & f5, ex const & f6);
56 ncmul(exvector const & v, bool discardable=false);
57 ncmul(exvector * vp); // vp will be deleted
59 // functions overriding virtual functions from bases classes
61 basic * duplicate() const;
62 void printraw(ostream & os) const;
63 void print(ostream & os, unsigned upper_precedence) const;
64 void printcsrc(ostream & os, unsigned upper_precedence) const;
65 bool info(unsigned inf) const;
66 int degree(symbol const & s) const;
67 int ldegree(symbol const & s) const;
68 ex expand(unsigned options=0) const;
69 ex coeff(symbol const & s, int const n=1) const;
70 ex eval(int level=0) const;
71 ex diff(symbol const & s) const;
72 ex subs(lst const & ls, lst const & lr) const;
73 exvector get_indices(void) const;
74 ex thisexprseq(exvector const & v) const;
75 ex thisexprseq(exvector * vp) const;
77 int compare_same_type(basic const & other) const;
78 unsigned return_type(void) const;
79 unsigned return_type_tinfo(void) const;
81 // new virtual functions which can be overridden by derived classes
84 // non-virtual functions in this class
86 unsigned count_factors(ex const & e) const;
87 void append_factors(exvector & v, ex const & e) const;
88 exvector expandchildren(unsigned options) const;
90 exvector const & get_factors(void) const;
95 static unsigned precedence;
100 extern const ncmul some_ncmul;
101 extern type_info const & typeid_ncmul;
105 ex nonsimplified_ncmul(exvector const & v);
106 ex simplified_ncmul(exvector const & v);
108 #define ex_to_ncmul(X) static_cast<ncmul const &>(*(X).bp)
110 #endif // ndef __GINAC_NCMUL_H__