<!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: aterm Class Reference</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 class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> </div> <div class="contents"> <h1>aterm Class Reference</h1><!-- doxytag: class="aterm" --> <p>Implements a additive term, a set of mterms added together m1 + m2 + m3 + . <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="aterm_8hh_source.html">aterm.hh</a>></code></p> <p><a href="classaterm-members.html">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classaterm.html#a42df2a5723bf522cc9b06275d55bcd26">aterm</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">create an empty aterm (equivalent to 0) <a href="#a42df2a5723bf522cc9b06275d55bcd26"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classaterm.html#a4caddc05ab1ce149db0a8ac02dbd7a98">aterm</a> (<a class="el" href="classCTree.html">Tree</a> t)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">create a aterm from an additive exp <a href="#a4caddc05ab1ce149db0a8ac02dbd7a98"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classaterm.html#acb36d6c81f849784e6c9a64706097a0a">aterm</a> (const <a class="el" href="classaterm.html">aterm</a> &a)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">create a copy of an aterm <a href="#acb36d6c81f849784e6c9a64706097a0a"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classaterm.html">aterm</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classaterm.html#a1651df562ad3e2544ecad194bccd19f0">operator+=</a> (<a class="el" href="classCTree.html">Tree</a> t)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">add in place an additive expression tree <a href="#a1651df562ad3e2544ecad194bccd19f0"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classaterm.html">aterm</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classaterm.html#a1544a0e91ff7c3c17782d1161925b11c">operator-=</a> (<a class="el" href="classCTree.html">Tree</a> t)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">add in place an additive expression tree <a href="#a1544a0e91ff7c3c17782d1161925b11c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classaterm.html">aterm</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classaterm.html#a1c9a56a4d1b506d036b0aa7759e6c29b">operator+=</a> (const <a class="el" href="classmterm.html">mterm</a> &m)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">add in place an mterm <a href="#a1c9a56a4d1b506d036b0aa7759e6c29b"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classaterm.html">aterm</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classaterm.html#a16f063fc8e70c8e9245ec42fe33d510e">operator-=</a> (const <a class="el" href="classmterm.html">mterm</a> &m)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">add in place an mterm <a href="#a16f063fc8e70c8e9245ec42fe33d510e"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classCTree.html">Tree</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classaterm.html#a793687477fd756925c4db2914d8a5820">normalizedTree</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">return the corresponding normalized expression tree <a href="#a793687477fd756925c4db2914d8a5820"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">ostream & </td><td class="memItemRight" valign="bottom"><a class="el" href="classaterm.html#a8cb1049e8b593acb1b451dd7db86a2cc">print</a> (ostream &dst) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">print a aterm m1 + m2 + m3 +... <a href="#a8cb1049e8b593acb1b451dd7db86a2cc"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmterm.html">mterm</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classaterm.html#a52130183f30e9b4e998532ca36536dc7">greatestDivisor</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">return the greatest divisor of any two mterms <a href="#a52130183f30e9b4e998532ca36536dc7"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classaterm.html">aterm</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classaterm.html#ae6906479134fa7fac1486aa8f1fccd31">factorize</a> (const <a class="el" href="classmterm.html">mterm</a> &d)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">reorganize the aterm by factorizing d <a href="#ae6906479134fa7fac1486aa8f1fccd31"></a><br/></td></tr> <tr><td colspan="2"><h2>Private Attributes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">map< <a class="el" href="classCTree.html">Tree</a>, <a class="el" href="classmterm.html">mterm</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245">fSig2MTerms</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">mapping between signatures and corresponding mterms <a href="#ae8b30f7dacfc6e2fab5541e6e5c53245"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Implements a additive term, a set of mterms added together m1 + m2 + m3 + . </p> <p>.. </p> <p>Definition at line <a class="el" href="aterm_8hh_source.html#l00023">23</a> of file <a class="el" href="aterm_8hh_source.html">aterm.hh</a>.</p> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a42df2a5723bf522cc9b06275d55bcd26"></a><!-- doxytag: member="aterm::aterm" ref="a42df2a5723bf522cc9b06275d55bcd26" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">aterm::aterm </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>create an empty aterm (equivalent to 0) </p> <p>Definition at line <a class="el" href="aterm_8cpp_source.html#l00011">11</a> of file <a class="el" href="aterm_8cpp_source.html">aterm.cpp</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00012"></a>00012 {} </pre></div></p> </div> </div> <a class="anchor" id="a4caddc05ab1ce149db0a8ac02dbd7a98"></a><!-- doxytag: member="aterm::aterm" ref="a4caddc05ab1ce149db0a8ac02dbd7a98" args="(Tree t)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">aterm::aterm </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>t</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>create a aterm from an additive exp </p> <p>create a aterm from a tree expression </p> <p>Definition at line <a class="el" href="aterm_8cpp_source.html#l00018">18</a> of file <a class="el" href="aterm_8cpp_source.html">aterm.cpp</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00019"></a>00019 { <a name="l00020"></a>00020 <span class="preprocessor"> #ifdef TRACE</span> <a name="l00021"></a>00021 <span class="preprocessor"></span> cerr << <span class="stringliteral">"aterm::aterm ("</span> << <a class="code" href="classppsig.html">ppsig</a>(t)<< <span class="stringliteral">")"</span> << endl; <a name="l00022"></a>00022 <span class="preprocessor"> #endif</span> <a name="l00023"></a>00023 <span class="preprocessor"></span> *<span class="keyword">this</span> += t; <a name="l00024"></a>00024 <span class="preprocessor"> #ifdef TRACE</span> <a name="l00025"></a>00025 <span class="preprocessor"></span> cerr << <span class="stringliteral">"aterm::aterm ("</span> << <a class="code" href="classppsig.html">ppsig</a>(t)<< <span class="stringliteral">") : -> "</span> << *<span class="keyword">this</span> << endl; <a name="l00026"></a>00026 <span class="preprocessor"> #endif</span> <a name="l00027"></a>00027 <span class="preprocessor"></span>} </pre></div></p> </div> </div> <a class="anchor" id="acb36d6c81f849784e6c9a64706097a0a"></a><!-- doxytag: member="aterm::aterm" ref="acb36d6c81f849784e6c9a64706097a0a" args="(const aterm &a)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">aterm::aterm </td> <td>(</td> <td class="paramtype">const <a class="el" href="classaterm.html">aterm</a> & </td> <td class="paramname"> <em>a</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>create a copy of an aterm </p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="ae6906479134fa7fac1486aa8f1fccd31"></a><!-- doxytag: member="aterm::factorize" ref="ae6906479134fa7fac1486aa8f1fccd31" args="(const mterm &d)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classaterm.html">aterm</a> aterm::factorize </td> <td>(</td> <td class="paramtype">const <a class="el" href="classmterm.html">mterm</a> & </td> <td class="paramname"> <em>d</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>reorganize the aterm by factorizing d </p> <p>Definition at line <a class="el" href="aterm_8cpp_source.html#l00241">241</a> of file <a class="el" href="aterm_8cpp_source.html">aterm.cpp</a>.</p> <p>References <a class="el" href="aterm_8hh_source.html#l00026">fSig2MTerms</a>, <a class="el" href="mterm_8cpp_source.html#l00305">mterm::hasDivisor()</a>, <a class="el" href="aterm_8cpp_source.html#l00059">normalizedTree()</a>, <a class="el" href="mterm_8cpp_source.html#l00391">mterm::normalizedTree()</a>, and <a class="el" href="signals_8hh_source.html#l00150">sigMul()</a>.</p> <p>Referenced by <a class="el" href="normalize_8cpp_source.html#l00032">normalizeAddTerm()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00242"></a>00242 { <a name="l00243"></a>00243 <span class="comment">//cerr << "factorize : " << *this << " with " << d << endl;</span> <a name="l00244"></a>00244 <a class="code" href="classaterm.html" title="Implements a additive term, a set of mterms added together m1 + m2 + m3 + .">aterm</a> A; <a name="l00245"></a>00245 <a class="code" href="classaterm.html" title="Implements a additive term, a set of mterms added together m1 + m2 + m3 + .">aterm</a> Q; <a name="l00246"></a>00246 <a name="l00247"></a>00247 <span class="comment">// separate the multiple of m from the others</span> <a name="l00248"></a>00248 <span class="keywordflow">for</span> (SM::const_iterator p1 = <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.begin(); p1 != <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.end(); p1++) { <a name="l00249"></a>00249 <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a> t = p1->second; <a name="l00250"></a>00250 <span class="keywordflow">if</span> (t.<a class="code" href="classmterm.html#af2c39e6a83ada2076d5be06a83b92fdd" title="return true if this can be divided by n">hasDivisor</a>(d)) { <a name="l00251"></a>00251 <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a> q = t/d; <a name="l00252"></a>00252 <span class="comment">//cerr << "q = " << q << endl;</span> <a name="l00253"></a>00253 Q += q; <a name="l00254"></a>00254 <span class="comment">//cerr << "step Q = " << Q << endl;</span> <a name="l00255"></a>00255 } <span class="keywordflow">else</span> { <a name="l00256"></a>00256 A += t; <a name="l00257"></a>00257 <span class="comment">//cerr << "step A = " << A << endl;</span> <a name="l00258"></a>00258 } <a name="l00259"></a>00259 } <a name="l00260"></a>00260 <a name="l00261"></a>00261 <span class="comment">// combines the two parts</span> <a name="l00262"></a>00262 <span class="comment">//cerr << "d.normalizedTree() " << ppsig(d.normalizedTree()) << endl;</span> <a name="l00263"></a>00263 <span class="comment">//cerr << "Q.normalizedTree() " << ppsig(Q.normalizedTree()) << endl;</span> <a name="l00264"></a>00264 <span class="comment">//Tree tt = sigMul(d.normalizedTree(), Q.normalizedTree());</span> <a name="l00265"></a>00265 <span class="comment">//cerr << "tt " << *tt << endl;</span> <a name="l00266"></a>00266 <a name="l00267"></a>00267 <span class="comment">//Tree ttt = sigAdd(</span> <a name="l00268"></a>00268 A += <a class="code" href="signals_8hh.html#a333591913e073c3acd6b891b6da85298">sigMul</a>(d.<a class="code" href="classmterm.html#a6aaebc7c5e6ace53d4ff3e996701a99f" title="return the normalized tree of the mterm">normalizedTree</a>(), Q.<a class="code" href="classaterm.html#a793687477fd756925c4db2914d8a5820" title="return the corresponding normalized expression tree">normalizedTree</a>()); <a name="l00269"></a>00269 <span class="comment">//cerr << "Final A = " << A << endl;</span> <a name="l00270"></a>00270 <span class="comment">//cerr << "Final Tree " << *(A.normalizedTree()) << endl;</span> <a name="l00271"></a>00271 <span class="keywordflow">return</span> A; <a name="l00272"></a>00272 } </pre></div></p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dynsection"> </div> </p> <p><div class="dynheader"> Here is the caller graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> <a class="anchor" id="a52130183f30e9b4e998532ca36536dc7"></a><!-- doxytag: member="aterm::greatestDivisor" ref="a52130183f30e9b4e998532ca36536dc7" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classmterm.html">mterm</a> aterm::greatestDivisor </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>return the greatest divisor of any two mterms </p> <p>Definition at line <a class="el" href="aterm_8cpp_source.html#l00218">218</a> of file <a class="el" href="aterm_8cpp_source.html">aterm.cpp</a>.</p> <p>References <a class="el" href="mterm_8cpp_source.html#l00064">mterm::complexity()</a>, <a class="el" href="aterm_8hh_source.html#l00026">fSig2MTerms</a>, and <a class="el" href="mterm_8cpp_source.html#l00267">gcd()</a>.</p> <p>Referenced by <a class="el" href="normalize_8cpp_source.html#l00032">normalizeAddTerm()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00219"></a>00219 { <a name="l00220"></a>00220 <span class="keywordtype">int</span> maxComplexity = 0; <a name="l00221"></a>00221 <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a> maxGCD(1); <a name="l00222"></a>00222 <a name="l00223"></a>00223 <span class="keywordflow">for</span> (SM::const_iterator p1 = <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.begin(); p1 != <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.end(); p1++) { <a name="l00224"></a>00224 <span class="keywordflow">for</span> (SM::const_iterator p2 = p1; p2 != <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.end(); p2++) { <a name="l00225"></a>00225 <span class="keywordflow">if</span> (p2 != p1) { <a name="l00226"></a>00226 <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a> g = <a class="code" href="mterm_8cpp.html#a385a9a70763e3f9d9b1c6df07a58d4a2" title="return a mterm that is the greatest common divisor of two mterms">gcd</a>(p1->second,p2->second); <a name="l00227"></a>00227 <span class="keywordflow">if</span> (g.<a class="code" href="classmterm.html#a693c15c5f4ed5f1aab26ef0910598508" title="return an evaluation of the complexity">complexity</a>()>maxComplexity) { <a name="l00228"></a>00228 maxComplexity = g.<a class="code" href="classmterm.html#a693c15c5f4ed5f1aab26ef0910598508" title="return an evaluation of the complexity">complexity</a>(); <a name="l00229"></a>00229 maxGCD = g; <a name="l00230"></a>00230 } <a name="l00231"></a>00231 } <a name="l00232"></a>00232 } <a name="l00233"></a>00233 } <a name="l00234"></a>00234 <span class="comment">//cerr << "greatestDivisor of " << *this << " is " << maxGCD << endl;</span> <a name="l00235"></a>00235 <span class="keywordflow">return</span> maxGCD; <a name="l00236"></a>00236 } </pre></div></p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dynsection"> </div> </p> <p><div class="dynheader"> Here is the caller graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> <a class="anchor" id="a793687477fd756925c4db2914d8a5820"></a><!-- doxytag: member="aterm::normalizedTree" ref="a793687477fd756925c4db2914d8a5820" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classCTree.html">Tree</a> aterm::normalizedTree </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>return the corresponding normalized expression tree </p> <p>Definition at line <a class="el" href="aterm_8cpp_source.html#l00059">59</a> of file <a class="el" href="aterm_8cpp_source.html">aterm.cpp</a>.</p> <p>References <a class="el" href="aterm_8hh_source.html#l00026">fSig2MTerms</a>, <a class="el" href="sigorderrules_8cpp_source.html#l00062">getSigOrder()</a>, <a class="el" href="mterm_8cpp_source.html#l00039">mterm::isNegative()</a>, <a class="el" href="signals_8hh_source.html#l00185">isZero()</a>, <a class="el" href="mterm_8cpp_source.html#l00391">mterm::normalizedTree()</a>, <a class="el" href="signals_8hh_source.html#l00149">sigSub()</a>, <a class="el" href="aterm_8cpp_source.html#l00033">simplifyingAdd()</a>, and <a class="el" href="tree_8hh_source.html#l00173">tree()</a>.</p> <p>Referenced by <a class="el" href="aterm_8cpp_source.html#l00241">factorize()</a>, and <a class="el" href="normalize_8cpp_source.html#l00032">normalizeAddTerm()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00060"></a>00060 { <a name="l00061"></a>00061 <span class="comment">// store positive and negative tems by order and sign</span> <a name="l00062"></a>00062 <span class="comment">// positive terms are stored in P[]</span> <a name="l00063"></a>00063 <span class="comment">// negative terms are inverted (made positive) and stored in N[]</span> <a name="l00064"></a>00064 <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="classP.html">P</a>[4], N[4]; <a name="l00065"></a>00065 <a name="l00066"></a>00066 <span class="comment">// prepare</span> <a name="l00067"></a>00067 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> order = 0; order < 4; order++) P[order] = N[order] = <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(0); <a name="l00068"></a>00068 <a name="l00069"></a>00069 <span class="comment">// sum by order and sign</span> <a name="l00070"></a>00070 <span class="keywordflow">for</span> (SM::const_iterator p = <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.begin(); p != <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.end(); p++) { <a name="l00071"></a>00071 <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 = p->second; <a name="l00072"></a>00072 <span class="keywordflow">if</span> (m.<a class="code" href="classmterm.html#ade41b1583af893a4225b2e379aa4b155" title="true if mterm has a negative coefficient">isNegative</a>()) { <a name="l00073"></a>00073 <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 = m.<a class="code" href="classmterm.html#a6aaebc7c5e6ace53d4ff3e996701a99f" title="return the normalized tree of the mterm">normalizedTree</a>(<span class="keyword">false</span>, <span class="keyword">true</span>); <a name="l00074"></a>00074 <span class="keywordtype">int</span> order = <a class="code" href="sigorderrules_8cpp.html#a20942fac53773f763795775cfdcfb086" title="retrieve the order annotation (between 0 and 3) of a signal.">getSigOrder</a>(t); <a name="l00075"></a>00075 N[order] = <a class="code" href="aterm_8cpp.html#a7b43caf994f9765584bb6d64beb322fe" title="Add two terms trying to simplify the result.">simplifyingAdd</a>(N[order],t); <a name="l00076"></a>00076 } <span class="keywordflow">else</span> { <a name="l00077"></a>00077 <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 = m.<a class="code" href="classmterm.html#a6aaebc7c5e6ace53d4ff3e996701a99f" title="return the normalized tree of the mterm">normalizedTree</a>(); <a name="l00078"></a>00078 <span class="keywordtype">int</span> order = <a class="code" href="sigorderrules_8cpp.html#a20942fac53773f763795775cfdcfb086" title="retrieve the order annotation (between 0 and 3) of a signal.">getSigOrder</a>(t); <a name="l00079"></a>00079 P[order] = <a class="code" href="aterm_8cpp.html#a7b43caf994f9765584bb6d64beb322fe" title="Add two terms trying to simplify the result.">simplifyingAdd</a>(P[order],t); <a name="l00080"></a>00080 } <a name="l00081"></a>00081 } <a name="l00082"></a>00082 <a name="l00083"></a>00083 <span class="comment">// combine sums</span> <a name="l00084"></a>00084 <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> SUM = <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(0); <a name="l00085"></a>00085 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> order = 0; order < 4; order++) { <a name="l00086"></a>00086 <span class="keywordflow">if</span> (!<a class="code" href="signals_8hh.html#a73fa3ec5ebd4e47dc0fde2d24cc08c56">isZero</a>(P[order])) { <a name="l00087"></a>00087 SUM = <a class="code" href="aterm_8cpp.html#a7b43caf994f9765584bb6d64beb322fe" title="Add two terms trying to simplify the result.">simplifyingAdd</a>(SUM,P[order]); <a name="l00088"></a>00088 } <a name="l00089"></a>00089 <span class="keywordflow">if</span> (!<a class="code" href="signals_8hh.html#a73fa3ec5ebd4e47dc0fde2d24cc08c56">isZero</a>(N[order])) { <span class="comment">// we have to substract</span> <a name="l00090"></a>00090 <span class="keywordflow">if</span> (<a class="code" href="signals_8hh.html#a73fa3ec5ebd4e47dc0fde2d24cc08c56">isZero</a>(SUM) && (order < 3)) { <a name="l00091"></a>00091 <span class="comment">// we postpone substraction</span> <a name="l00092"></a>00092 N[order+1] = <a class="code" href="aterm_8cpp.html#a7b43caf994f9765584bb6d64beb322fe" title="Add two terms trying to simplify the result.">simplifyingAdd</a>(N[order], N[order+1]); <a name="l00093"></a>00093 } <span class="keywordflow">else</span> { <a name="l00094"></a>00094 SUM = <a class="code" href="signals_8hh.html#a390c47bc104a8e072c0c75ea0f9524e6">sigSub</a>(SUM, N[order]); <a name="l00095"></a>00095 } <a name="l00096"></a>00096 } <a name="l00097"></a>00097 } <a name="l00098"></a>00098 <a name="l00099"></a>00099 assert(SUM); <a name="l00100"></a>00100 <span class="keywordflow">return</span> SUM; <a name="l00101"></a>00101 } </pre></div></p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dynsection"> </div> </p> <p><div class="dynheader"> Here is the caller graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> <a class="anchor" id="a1c9a56a4d1b506d036b0aa7759e6c29b"></a><!-- doxytag: member="aterm::operator+=" ref="a1c9a56a4d1b506d036b0aa7759e6c29b" args="(const mterm &m)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const <a class="el" href="classaterm.html">aterm</a> & aterm::operator+= </td> <td>(</td> <td class="paramtype">const <a class="el" href="classmterm.html">mterm</a> & </td> <td class="paramname"> <em>m</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>add in place an mterm </p> <p>Add in place an mterm. </p> <p>Definition at line <a class="el" href="aterm_8cpp_source.html#l00180">180</a> of file <a class="el" href="aterm_8cpp_source.html">aterm.cpp</a>.</p> <p>References <a class="el" href="aterm_8hh_source.html#l00026">fSig2MTerms</a>, and <a class="el" href="mterm_8cpp_source.html#l00380">mterm::signatureTree()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00181"></a>00181 { <a name="l00182"></a>00182 <span class="preprocessor"> #ifdef TRACE</span> <a name="l00183"></a>00183 <span class="preprocessor"></span> cerr << *<span class="keyword">this</span> << <span class="stringliteral">" aterm::+= "</span> << m << endl; <a name="l00184"></a>00184 <span class="preprocessor"> #endif</span> <a name="l00185"></a>00185 <span class="preprocessor"></span> <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> sig = m.<a class="code" href="classmterm.html#a9577faff72c619359db27cbbd00a1752" title="return a signature (a normalized tree)">signatureTree</a>(); <a name="l00186"></a>00186 <span class="preprocessor"> #ifdef TRACE</span> <a name="l00187"></a>00187 <span class="preprocessor"></span> cerr << <span class="stringliteral">"signature "</span> << *sig << endl; <a name="l00188"></a>00188 <span class="preprocessor"> #endif</span> <a name="l00189"></a>00189 <span class="preprocessor"></span> SM::const_iterator p = <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.find(sig); <a name="l00190"></a>00190 <span class="keywordflow">if</span> (p == <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.end()) { <a name="l00191"></a>00191 <span class="comment">// its a new mterm</span> <a name="l00192"></a>00192 <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.insert(make_pair(sig,m)); <a name="l00193"></a>00193 } <span class="keywordflow">else</span> { <a name="l00194"></a>00194 <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>[sig] += m; <a name="l00195"></a>00195 } <a name="l00196"></a>00196 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00197"></a>00197 } </pre></div></p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> <a class="anchor" id="a1651df562ad3e2544ecad194bccd19f0"></a><!-- doxytag: member="aterm::operator+=" ref="a1651df562ad3e2544ecad194bccd19f0" args="(Tree t)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const <a class="el" href="classaterm.html">aterm</a> & aterm::operator+= </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>t</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>add in place an additive expression tree </p> <p>Add in place an additive expression tree Go down t recursively looking for additions and substractions. </p> <p>Definition at line <a class="el" href="aterm_8cpp_source.html#l00127">127</a> of file <a class="el" href="aterm_8cpp_source.html">aterm.cpp</a>.</p> <p>References <a class="el" href="signals_8cpp_source.html#l00126">isSigBinOp()</a>, <a class="el" href="binop_8hh_source.html#l00056">kAdd</a>, and <a class="el" href="binop_8hh_source.html#l00056">kSub</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00128"></a>00128 { <a name="l00129"></a>00129 <span class="keywordtype">int</span> op; <a name="l00130"></a>00130 <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> x,y; <a name="l00131"></a>00131 <a name="l00132"></a>00132 assert(t!=0); <a name="l00133"></a>00133 <a name="l00134"></a>00134 <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a8705584c3c319be54be73dc391d25634">isSigBinOp</a>(t, &op, x, y) && (op == <a class="code" href="binop_8hh.html#abc6126af1d45847bc59afa0aa3216b04a8d20f6cca2d49a8732f535cfe28812c8">kAdd</a>)) { <a name="l00135"></a>00135 *<span class="keyword">this</span> += x; <a name="l00136"></a>00136 *<span class="keyword">this</span> += y; <a name="l00137"></a>00137 <a name="l00138"></a>00138 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a8705584c3c319be54be73dc391d25634">isSigBinOp</a>(t, &op, x, y) && (op == <a class="code" href="binop_8hh.html#abc6126af1d45847bc59afa0aa3216b04aa8aa42e35eb8248e580bf83ded4311d3">kSub</a>)) { <a name="l00139"></a>00139 *<span class="keyword">this</span> += x; <a name="l00140"></a>00140 *<span class="keyword">this</span> -= y; <a name="l00141"></a>00141 <a name="l00142"></a>00142 } <span class="keywordflow">else</span> { <a name="l00143"></a>00143 <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a> m(t); <a name="l00144"></a>00144 *<span class="keyword">this</span> += m; <a name="l00145"></a>00145 } <a name="l00146"></a>00146 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00147"></a>00147 } </pre></div></p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> <a class="anchor" id="a16f063fc8e70c8e9245ec42fe33d510e"></a><!-- doxytag: member="aterm::operator-=" ref="a16f063fc8e70c8e9245ec42fe33d510e" args="(const mterm &m)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const <a class="el" href="classaterm.html">aterm</a> & aterm::operator-= </td> <td>(</td> <td class="paramtype">const <a class="el" href="classmterm.html">mterm</a> & </td> <td class="paramname"> <em>m</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>add in place an mterm </p> <p>Substract in place an mterm. </p> <p>Definition at line <a class="el" href="aterm_8cpp_source.html#l00203">203</a> of file <a class="el" href="aterm_8cpp_source.html">aterm.cpp</a>.</p> <p>References <a class="el" href="aterm_8hh_source.html#l00026">fSig2MTerms</a>, and <a class="el" href="mterm_8cpp_source.html#l00380">mterm::signatureTree()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00204"></a>00204 { <a name="l00205"></a>00205 <span class="comment">//cerr << *this << " aterm::-= " << m << endl;</span> <a name="l00206"></a>00206 <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> sig = m.<a class="code" href="classmterm.html#a9577faff72c619359db27cbbd00a1752" title="return a signature (a normalized tree)">signatureTree</a>(); <a name="l00207"></a>00207 <span class="comment">//cerr << "signature " << *sig << endl;</span> <a name="l00208"></a>00208 SM::const_iterator p = <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.find(sig); <a name="l00209"></a>00209 <span class="keywordflow">if</span> (p == <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.end()) { <a name="l00210"></a>00210 <span class="comment">// its a new mterm</span> <a name="l00211"></a>00211 <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.insert(make_pair(sig,m*<a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a>(-1))); <a name="l00212"></a>00212 } <span class="keywordflow">else</span> { <a name="l00213"></a>00213 <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>[sig] -= m; <a name="l00214"></a>00214 } <a name="l00215"></a>00215 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00216"></a>00216 } </pre></div></p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> <a class="anchor" id="a1544a0e91ff7c3c17782d1161925b11c"></a><!-- doxytag: member="aterm::operator-=" ref="a1544a0e91ff7c3c17782d1161925b11c" args="(Tree t)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const <a class="el" href="classaterm.html">aterm</a> & aterm::operator-= </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>t</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>add in place an additive expression tree </p> <p>Substract in place an additive expression tree Go down t recursively looking for additions and substractions. </p> <p>Definition at line <a class="el" href="aterm_8cpp_source.html#l00154">154</a> of file <a class="el" href="aterm_8cpp_source.html">aterm.cpp</a>.</p> <p>References <a class="el" href="signals_8cpp_source.html#l00126">isSigBinOp()</a>, <a class="el" href="binop_8hh_source.html#l00056">kAdd</a>, and <a class="el" href="binop_8hh_source.html#l00056">kSub</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00155"></a>00155 { <a name="l00156"></a>00156 <span class="keywordtype">int</span> op; <a name="l00157"></a>00157 <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> x,y; <a name="l00158"></a>00158 <a name="l00159"></a>00159 assert(t!=0); <a name="l00160"></a>00160 <a name="l00161"></a>00161 <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a8705584c3c319be54be73dc391d25634">isSigBinOp</a>(t, &op, x, y) && (op == <a class="code" href="binop_8hh.html#abc6126af1d45847bc59afa0aa3216b04a8d20f6cca2d49a8732f535cfe28812c8">kAdd</a>)) { <a name="l00162"></a>00162 *<span class="keyword">this</span> -= x; <a name="l00163"></a>00163 *<span class="keyword">this</span> -= y; <a name="l00164"></a>00164 <a name="l00165"></a>00165 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a8705584c3c319be54be73dc391d25634">isSigBinOp</a>(t, &op, x, y) && (op == <a class="code" href="binop_8hh.html#abc6126af1d45847bc59afa0aa3216b04aa8aa42e35eb8248e580bf83ded4311d3">kSub</a>)) { <a name="l00166"></a>00166 *<span class="keyword">this</span> -= x; <a name="l00167"></a>00167 *<span class="keyword">this</span> += y; <a name="l00168"></a>00168 <a name="l00169"></a>00169 } <span class="keywordflow">else</span> { <a name="l00170"></a>00170 <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a> m(t); <a name="l00171"></a>00171 *<span class="keyword">this</span> -= m; <a name="l00172"></a>00172 } <a name="l00173"></a>00173 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00174"></a>00174 } </pre></div></p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> <a class="anchor" id="a8cb1049e8b593acb1b451dd7db86a2cc"></a><!-- doxytag: member="aterm::print" ref="a8cb1049e8b593acb1b451dd7db86a2cc" args="(ostream &dst) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ostream & aterm::print </td> <td>(</td> <td class="paramtype">ostream & </td> <td class="paramname"> <em>dst</em></td> <td> ) </td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>print a aterm m1 + m2 + m3 +... </p> <p>print an aterm in a human readable format </p> <p>Definition at line <a class="el" href="aterm_8cpp_source.html#l00107">107</a> of file <a class="el" href="aterm_8cpp_source.html">aterm.cpp</a>.</p> <p>References <a class="el" href="aterm_8hh_source.html#l00026">fSig2MTerms</a>.</p> <p>Referenced by <a class="el" href="aterm_8hh_source.html#l00045">operator<<()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00108"></a>00108 { <a name="l00109"></a>00109 <span class="keywordflow">if</span> (<a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.empty()) { <a name="l00110"></a>00110 dst << <span class="stringliteral">"AZERO"</span>; <a name="l00111"></a>00111 } <span class="keywordflow">else</span> { <a name="l00112"></a>00112 <span class="keyword">const</span> <span class="keywordtype">char</span>* sep = <span class="stringliteral">""</span>; <a name="l00113"></a>00113 <span class="keywordflow">for</span> (SM::const_iterator p = <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.begin(); p != <a class="code" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245" title="mapping between signatures and corresponding mterms">fSig2MTerms</a>.end(); p++) { <a name="l00114"></a>00114 dst << sep << p->second; <a name="l00115"></a>00115 sep = <span class="stringliteral">" + "</span>; <a name="l00116"></a>00116 } <a name="l00117"></a>00117 } <a name="l00118"></a>00118 <a name="l00119"></a>00119 <span class="keywordflow">return</span> dst; <a name="l00120"></a>00120 } </pre></div></p> <p><div class="dynheader"> Here is the caller graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> <hr/><h2>Member Data Documentation</h2> <a class="anchor" id="ae8b30f7dacfc6e2fab5541e6e5c53245"></a><!-- doxytag: member="aterm::fSig2MTerms" ref="ae8b30f7dacfc6e2fab5541e6e5c53245" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">map<<a class="el" href="classCTree.html">Tree</a>,<a class="el" href="classmterm.html">mterm</a>> <a class="el" href="classaterm.html#ae8b30f7dacfc6e2fab5541e6e5c53245">aterm::fSig2MTerms</a><code> [private]</code></td> </tr> </table> </div> <div class="memdoc"> <p>mapping between signatures and corresponding mterms </p> <p>Definition at line <a class="el" href="aterm_8hh_source.html#l00026">26</a> of file <a class="el" href="aterm_8hh_source.html">aterm.hh</a>.</p> <p>Referenced by <a class="el" href="aterm_8cpp_source.html#l00241">factorize()</a>, <a class="el" href="aterm_8cpp_source.html#l00218">greatestDivisor()</a>, <a class="el" href="aterm_8cpp_source.html#l00059">normalizedTree()</a>, <a class="el" href="aterm_8cpp_source.html#l00180">operator+=()</a>, <a class="el" href="aterm_8cpp_source.html#l00203">operator-=()</a>, and <a class="el" href="aterm_8cpp_source.html#l00107">print()</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="aterm_8hh_source.html">aterm.hh</a></li> <li><a class="el" href="aterm_8cpp_source.html">aterm.cpp</a></li> </ul> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Apr 29 00:00:17 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>