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