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 /** Non-commutative product of expressions. */
26 class ncmul : public exprseq
29 friend ex nonsimplified_ncmul(exvector const & v);
30 friend ex simplified_ncmul(exvector const & v);
34 // default constructor, destructor, copy constructor assignment operator and helpers
38 ncmul(ncmul const & other);
39 ncmul const & operator=(ncmul const & other);
41 void copy(ncmul const & other);
42 void destroy(bool call_parent);
46 ncmul(ex const & lh, ex const & rh);
47 ncmul(ex const & f1, ex const & f2, ex const & f3);
48 ncmul(ex const & f1, ex const & f2, ex const & f3,
50 ncmul(ex const & f1, ex const & f2, ex const & f3,
51 ex const & f4, ex const & f5);
52 ncmul(ex const & f1, ex const & f2, ex const & f3,
53 ex const & f4, ex const & f5, ex const & f6);
54 ncmul(exvector const & v, bool discardable=false);
55 ncmul(exvector * vp); // vp will be deleted
57 // functions overriding virtual functions from bases classes
59 basic * duplicate() const;
60 void printraw(ostream & os) const;
61 void print(ostream & os, unsigned upper_precedence) const;
62 void printcsrc(ostream & os, unsigned upper_precedence) const;
63 bool info(unsigned inf) const;
64 int degree(symbol const & s) const;
65 int ldegree(symbol const & s) const;
66 ex expand(unsigned options=0) const;
67 ex coeff(symbol const & s, int const n=1) const;
68 ex eval(int level=0) const;
69 ex diff(symbol const & s) const;
70 ex subs(lst const & ls, lst const & lr) const;
71 exvector get_indices(void) const;
72 ex thisexprseq(exvector const & v) const;
73 ex thisexprseq(exvector * vp) const;
75 int compare_same_type(basic const & other) const;
76 unsigned return_type(void) const;
77 unsigned return_type_tinfo(void) const;
79 // new virtual functions which can be overridden by derived classes
82 // non-virtual functions in this class
84 unsigned count_factors(ex const & e) const;
85 void append_factors(exvector & v, ex const & e) const;
86 exvector expandchildren(unsigned options) const;
88 exvector const & get_factors(void) const;
93 static unsigned precedence;
98 extern const ncmul some_ncmul;
99 extern type_info const & typeid_ncmul;
103 ex nonsimplified_ncmul(exvector const & v);
104 ex simplified_ncmul(exvector const & v);
106 #define ex_to_ncmul(X) static_cast<ncmul const &>(*(X).bp)
108 #endif // ndef __GINAC_NCMUL_H__