]> www.ginac.de Git - ginac.git/blob - ginac/mul.h
- modified the comment blocks so the copyright message no longer appears in
[ginac.git] / ginac / mul.h
1 /** @file mul.h
2  *
3  *  Interface to GiNaC's products of expressions. */
4
5 /*
6  *  GiNaC Copyright (C) 1999 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_MUL_H__
24 #define __GINAC_MUL_H__
25
26 #include <ginac/expairseq.h>
27
28 /** Product of expressions. */
29 class mul : public expairseq
30 {
31     friend class add;
32     friend class ncmul;
33     friend class power;
34
35 // member functions
36
37     // default constructor, destructor, copy constructor assignment operator and helpers
38 public:
39     mul();
40     ~mul();
41     mul(mul const & other);
42     mul const & operator=(mul const & other);
43 protected:
44     void copy(mul const & other);
45     void destroy(bool call_parent);
46
47     // other constructors
48 public:
49     mul(ex const & lh, ex const & rh);
50     mul(exvector const & v);
51     mul(epvector const & v);
52     //mul(epvector const & v, bool do_not_canonicalize=0);
53     mul(epvector const & v, ex const & oc);
54     mul(epvector * vp, ex const & oc);
55     mul(ex const & lh, ex const & mh, ex const & rh);
56
57     // functions overriding virtual functions from bases classes
58 public:
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 type, 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 coeff(symbol const & s, int const n=1) const;
67     ex eval(int level=0) const;
68     ex diff(symbol const & s) const;
69     ex series(symbol const & s, ex const & point, int order) const;
70     ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
71     numeric integer_content(void) const;
72     ex smod(numeric const &xi) const;
73     numeric max_coefficient(void) const;
74     exvector get_indices(void) const;
75     ex simplify_ncmul(exvector const & v) const;
76 protected:
77     int compare_same_type(basic const & other) const;
78     bool is_equal_same_type(basic const & other) const;
79     unsigned return_type(void) const;
80     unsigned return_type_tinfo(void) const;
81     ex thisexpairseq(epvector const & v, ex const & oc) const;
82     ex thisexpairseq(epvector * vp, ex const & oc) const;
83     void printpair(ostream & os, expair const & p,
84                    unsigned upper_precedence) const;
85     expair split_ex_to_pair(ex const & e) const;
86     expair combine_ex_with_coeff_to_pair(ex const & e,
87                                          ex const & c) const;
88     expair combine_pair_with_coeff_to_pair(expair const & p,
89                                            ex const & c) const;
90     ex recombine_pair_to_ex(expair const & p) const;
91     bool expair_needs_further_processing(epp it);
92     ex default_overall_coeff(void) const;
93     void combine_overall_coeff(ex const & c);
94     void combine_overall_coeff(ex const & c1, ex const & c2);
95     bool can_make_flat(expair const & p) const;
96     ex expand(unsigned options=0) const;
97     
98     // new virtual functions which can be overridden by derived classes
99     // none
100
101     // non-virtual functions in this class
102 protected:
103     epvector * expandchildren(unsigned options) const;
104
105 // member variables
106
107 protected:
108     static unsigned precedence;
109 };
110
111 // global constants
112
113 extern const mul some_mul;
114 extern type_info const & typeid_mul;
115
116 #define ex_to_mul(X) static_cast<mul const &>(*(X).bp)
117
118 #endif // ndef __GINAC_MUL_H__