<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>FAUST compiler: mterm.hh Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.3 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <h1>mterm.hh</h1><a href="mterm_8hh.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef __MTERM__</span> <a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define __MTERM__</span> <a name="l00003"></a>00003 <span class="preprocessor"></span> <a name="l00004"></a>00004 <span class="preprocessor">#include <stdio.h></span> <a name="l00005"></a>00005 <span class="preprocessor">#include <assert.h></span> <a name="l00006"></a>00006 <span class="preprocessor">#include "<a class="code" href="tlib_8hh.html">tlib.hh</a>"</span> <a name="l00007"></a>00007 <span class="preprocessor">#include "<a class="code" href="signals_8hh.html">signals.hh</a>"</span> <a name="l00008"></a>00008 <span class="preprocessor">#include "<a class="code" href="sigprint_8hh.html">sigprint.hh</a>"</span> <a name="l00009"></a>00009 <span class="preprocessor">#include "<a class="code" href="simplify_8hh.html">simplify.hh</a>"</span> <a name="l00010"></a>00010 <span class="preprocessor">#include "<a class="code" href="normalize_8hh.html">normalize.hh</a>"</span> <a name="l00011"></a>00011 <span class="preprocessor">#include "<a class="code" href="sigorderrules_8hh.html">sigorderrules.hh</a>"</span> <a name="l00012"></a>00012 <span class="preprocessor">#include <map></span> <a name="l00013"></a>00013 <span class="preprocessor">#include <list></span> <a name="l00014"></a>00014 <a name="l00015"></a>00015 <span class="keyword">using namespace </span>std; <a name="l00016"></a>00016 <a name="l00021"></a><a class="code" href="classmterm.html">00021</a> <span class="keyword">class </span><a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a> <a name="l00022"></a>00022 { <a name="l00023"></a>00023 <a name="l00024"></a><a class="code" href="classmterm.html#acc0c29889a33734c89b3bcd81c2b7c07">00024</a> <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> <a class="code" href="classmterm.html#acc0c29889a33734c89b3bcd81c2b7c07" title="constant part of the term (usually 1 or -1)">fCoef</a>; <a name="l00025"></a><a class="code" href="classmterm.html#a9147de42ca9a68d4b755409479cafa83">00025</a> map<Tree,int> <a class="code" href="classmterm.html#a9147de42ca9a68d4b755409479cafa83" title="non constant terms and their power">fFactors</a>; <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="keyword">public</span>: <a name="l00028"></a>00028 <a class="code" href="classmterm.html#aa4dfb5d965e25d3cd29f8fa0ed1268e8" title="create a 0 mterm">mterm</a> (); <a name="l00029"></a>00029 <a class="code" href="classmterm.html#aa4dfb5d965e25d3cd29f8fa0ed1268e8" title="create a 0 mterm">mterm</a> (<span class="keywordtype">int</span> k); <a name="l00030"></a>00030 <a class="code" href="classmterm.html#aa4dfb5d965e25d3cd29f8fa0ed1268e8" title="create a 0 mterm">mterm</a> (<span class="keywordtype">double</span> k); <a name="l00031"></a>00031 <a class="code" href="classmterm.html#aa4dfb5d965e25d3cd29f8fa0ed1268e8" title="create a 0 mterm">mterm</a> (<a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> t); <a name="l00032"></a>00032 <a class="code" href="classmterm.html#aa4dfb5d965e25d3cd29f8fa0ed1268e8" title="create a 0 mterm">mterm</a> (<span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& m); <a name="l00033"></a>00033 <a name="l00034"></a>00034 <span class="keywordtype">void</span> <a class="code" href="classmterm.html#a44217f3cde3aca6ad383892f7817ec2d" title="remove usued factors">cleanup</a>(); <a name="l00035"></a>00035 <span class="keywordtype">bool</span> <a class="code" href="classmterm.html#a8c72d30bd49ba9cfe32f4a399b808c2f" title="true if mterm doesn&#39;t represent number 0">isNotZero</a>() <span class="keyword">const</span>; <a name="l00036"></a>00036 <span class="keywordtype">bool</span> <a class="code" href="classmterm.html#ade41b1583af893a4225b2e379aa4b155" title="true if mterm has a negative coefficient">isNegative</a>() <span class="keyword">const</span>; <a name="l00037"></a>00037 <a name="l00038"></a>00038 <span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& <a class="code" href="classmterm.html#a3f5e96fff55d267109e505c35d864935" title="replace the content with a copy of m">operator = </a>(<span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& m); <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& <a class="code" href="classmterm.html#acbae796c207ab237554ee7f6f4ee392a" title="multiply in place by a multiplicative exp">operator *= </a>(<a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> m); <a name="l00041"></a>00041 <span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& <a class="code" href="classmterm.html#a00c303e748117461a6711a55146ec28d" title="divide in place by a multiplicative exp">operator /= </a>(<a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> m); <a name="l00042"></a>00042 <a name="l00043"></a>00043 <span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& <a class="code" href="classmterm.html#a6ff1a10da12a077065b506a7f72aa00e" title="add in place an mterm of same signature">operator += </a>(<span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& m); <a name="l00044"></a>00044 <span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& <a class="code" href="classmterm.html#a2a089dec86947829b7fcdd9c1ca01813" title="add in place an mterm of same signature">operator -= </a>(<span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& m); <a name="l00045"></a>00045 <a name="l00046"></a>00046 <span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& <a class="code" href="classmterm.html#acbae796c207ab237554ee7f6f4ee392a" title="multiply in place by a multiplicative exp">operator *= </a>(<span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& m); <a name="l00047"></a>00047 <span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& <a class="code" href="classmterm.html#a00c303e748117461a6711a55146ec28d" title="divide in place by a multiplicative exp">operator /= </a>(<span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& m); <a name="l00048"></a>00048 <a name="l00049"></a>00049 <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a> <a class="code" href="classmterm.html#ab809f391f059aaa6f9697b334038e0ce" title="mterms multiplication">operator * </a>(<span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& m) <span class="keyword">const</span>; <a name="l00050"></a>00050 <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a> <a class="code" href="classmterm.html#a45be51dbecf9c0933ea2469c1c2cb759" title="mterms division">operator / </a>(<span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& m) <span class="keyword">const</span>; <a name="l00051"></a>00051 ostream& <a class="code" href="classmterm.html#a6583aaf049ecff5c718a47b645fcfbf2" title="print a mterm k*x1**n1*x2**n2...">print</a>(ostream& dst) <span class="keyword">const</span>; <a name="l00052"></a>00052 <a name="l00053"></a>00053 <span class="keywordtype">int</span> <a class="code" href="classmterm.html#a693c15c5f4ed5f1aab26ef0910598508" title="return an evaluation of the complexity">complexity</a>() <span class="keyword">const</span>; <a name="l00054"></a>00054 <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> <a class="code" href="classmterm.html#a6aaebc7c5e6ace53d4ff3e996701a99f" title="return the normalized tree of the mterm">normalizedTree</a>(<span class="keywordtype">bool</span> sign=<span class="keyword">false</span>, <a name="l00055"></a>00055 <span class="keywordtype">bool</span> neg=<span class="keyword">false</span>) <span class="keyword">const</span>; <a name="l00056"></a>00056 <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> <a class="code" href="classmterm.html#a9577faff72c619359db27cbbd00a1752" title="return a signature (a normalized tree)">signatureTree</a>() <span class="keyword">const</span>; <a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="keywordtype">bool</span> <a class="code" href="classmterm.html#af2c39e6a83ada2076d5be06a83b92fdd" title="return true if this can be divided by n">hasDivisor</a> (<span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& n) <span class="keyword">const</span>; <a name="l00059"></a>00059 <span class="keyword">friend</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a> <a class="code" href="classmterm.html#a385a9a70763e3f9d9b1c6df07a58d4a2" title="return a mterm that is the greatest common divisor of two mterms">gcd</a> (<span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& m1, <span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& m2); <a name="l00060"></a>00060 }; <a name="l00061"></a>00061 <a name="l00062"></a><a class="code" href="mterm_8hh.html#a1e0b4fce4e06323e407802473aa7b32c">00062</a> <span class="keyword">inline</span> ostream& <a class="code" href="ppbox_8hh.html#a23b1718100bac6cb41d43dd01f226eef">operator << </a>(ostream& s, <span class="keyword">const</span> <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>& m) { <span class="keywordflow">return</span> m.<a class="code" href="classmterm.html#a6583aaf049ecff5c718a47b645fcfbf2" title="print a mterm k*x1**n1*x2**n2...">print</a>(s); } <a name="l00063"></a>00063 <a name="l00064"></a>00064 <a name="l00065"></a>00065 <span class="preprocessor">#endif</span> </pre></div></div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Wed Apr 28 23:59:59 2010 for FAUST compiler by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>