FAUST compiler  0.9.9.6b8
mterm.hh
Go to the documentation of this file.
1 #ifndef __MTERM__
2 #define __MTERM__
3 
4 #include <stdio.h>
5 #include <assert.h>
6 #include "tlib.hh"
7 #include "signals.hh"
8 #include "sigprint.hh"
9 #include "simplify.hh"
10 #include "normalize.hh"
11 #include "sigorderrules.hh"
12 #include <map>
13 #include <list>
14 
15 using namespace std;
16 
21 class mterm
22 {
23 
25  map<Tree,int> fFactors;
26 
27  public:
28  mterm ();
29  mterm (int k);
30  mterm (double k);
31  mterm (Tree t);
32  mterm (const mterm& m);
33 
34  void cleanup();
35  bool isNotZero() const;
36  bool isNegative() const;
37 
38  const mterm& operator = (const mterm& m);
39 
40  const mterm& operator *= (Tree m);
41  const mterm& operator /= (Tree m);
42 
43  const mterm& operator += (const mterm& m);
44  const mterm& operator -= (const mterm& m);
45 
46  const mterm& operator *= (const mterm& m);
47  const mterm& operator /= (const mterm& m);
48 
49  mterm operator * (const mterm& m) const;
50  mterm operator / (const mterm& m) const;
51  ostream& print(ostream& dst) const;
52 
53  int complexity() const;
54  Tree normalizedTree(bool sign=false,
55  bool neg=false) const;
56  Tree signatureTree() const;
57 
58  bool hasDivisor (const mterm& n) const;
59  friend mterm gcd (const mterm& m1, const mterm& m2);
60 };
61 
62 inline ostream& operator << (ostream& s, const mterm& m) { return m.print(s); }
63 
64 
65 #endif
mterm gcd(const mterm &m1, const mterm &m2)
return a mterm that is the greatest common divisor of two mterms
Definition: mterm.cpp:299
Tree fCoef
constant part of the term (usually 1 or -1)
Definition: mterm.hh:24
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
map< Tree, int > fFactors
non constant terms and their power
Definition: mterm.hh:25
Implements a multiplicative term, a term of type k*x^n*y^m*...
Definition: mterm.hh:21
interval operator*(const interval &x, const interval &y)
Definition: interval.hh:84
interval operator/(const interval &x, const interval &y)
Definition: interval.hh:97
ostream & operator<<(ostream &s, const mterm &m)
Definition: mterm.hh:62
ostream & print(ostream &dst) const
print a mterm k*x1**n1*x2**n2...
Definition: mterm.cpp:48
void print(Tree t, FILE *out)
Definition: list.cpp:154