Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > aaf33964de706a538481c929c1da6a44 > files > 4653

faust-doc-0.9.10-5mdv2010.1.x86_64.rpm

<!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.cpp File 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&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;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&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>mterm.cpp File Reference</h1><code>#include &quot;<a class="el" href="mterm_8hh_source.html">mterm.hh</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="signals_8hh_source.html">signals.hh</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="ppsig_8hh_source.html">ppsig.hh</a>&quot;</code><br/>
<code>#include &lt;assert.h&gt;</code><br/>
<div class="dynheader">
Include dependency graph for mterm.cpp:</div>
<div class="dynsection">
</div>

<p><a href="mterm_8cpp_source.html">Go to the source code of this file.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef map&lt; <a class="el" href="classCTree.html">Tree</a>, int &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mterm_8cpp.html#a6e8e8e61bc8fed2501d51423078922a2">MP</a></td></tr>
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mterm_8cpp.html#a0756b2c1f2950a0099b062bde262abed">common</a> (int a, int b)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">return the "common quantity" of two numbers  <a href="#a0756b2c1f2950a0099b062bde262abed"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmterm.html">mterm</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mterm_8cpp.html#a385a9a70763e3f9d9b1c6df07a58d4a2">gcd</a> (const <a class="el" href="classmterm.html">mterm</a> &amp;m1, const <a class="el" href="classmterm.html">mterm</a> &amp;m2)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">return a mterm that is the greatest common divisor of two mterms  <a href="#a385a9a70763e3f9d9b1c6df07a58d4a2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mterm_8cpp.html#ab40b9c37818acb439b805fd70315bad2">contains</a> (int a, int b)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">We say that a "contains" b if a/b &gt; 0.  <a href="#ab40b9c37818acb439b805fd70315bad2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classCTree.html">Tree</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mterm_8cpp.html#a989a51a835beba670bf40439995d9643">buildPowTerm</a> (<a class="el" href="classCTree.html">Tree</a> f, int q)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">produce the canonical tree correspoding to a mterm  <a href="#a989a51a835beba670bf40439995d9643"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mterm_8cpp.html#aaf3bf9f31ee2676c6a38c698191e1f12">combineMulLeft</a> (<a class="el" href="classCTree.html">Tree</a> &amp;R, <a class="el" href="classCTree.html">Tree</a> A)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Combine R and A doing R = R*A or R = A.  <a href="#aaf3bf9f31ee2676c6a38c698191e1f12"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mterm_8cpp.html#a071cd18b4fc8aca551d99b5523601328">combineDivLeft</a> (<a class="el" href="classCTree.html">Tree</a> &amp;R, <a class="el" href="classCTree.html">Tree</a> A)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Combine R and A doing R = R*A or R = A.  <a href="#a071cd18b4fc8aca551d99b5523601328"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mterm_8cpp.html#a964193592967662b693d5bc1f028092f">combineMulDiv</a> (<a class="el" href="classCTree.html">Tree</a> &amp;M, <a class="el" href="classCTree.html">Tree</a> &amp;D, <a class="el" href="classCTree.html">Tree</a> f, int q)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Do M = M * f**q or D = D * f**-q.  <a href="#a964193592967662b693d5bc1f028092f"></a><br/></td></tr>
</table>
<hr/><h2>Typedef Documentation</h2>
<a class="anchor" id="a6e8e8e61bc8fed2501d51423078922a2"></a><!-- doxytag: member="mterm.cpp::MP" ref="a6e8e8e61bc8fed2501d51423078922a2" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef map&lt;<a class="el" href="classCTree.html">Tree</a>,int&gt; <a class="el" href="mterm_8cpp.html#a6e8e8e61bc8fed2501d51423078922a2">MP</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="mterm_8cpp_source.html#l00011">11</a> of file <a class="el" href="mterm_8cpp_source.html">mterm.cpp</a>.</p>

</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="a989a51a835beba670bf40439995d9643"></a><!-- doxytag: member="mterm.cpp::buildPowTerm" ref="a989a51a835beba670bf40439995d9643" args="(Tree f, int q)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classCTree.html">Tree</a> buildPowTerm </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>q</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>produce the canonical tree correspoding to a mterm </p>
<p>Build a power term of type f**q -&gt; (((f.f).f)..f) with q&gt;0 </p>

<p>Definition at line <a class="el" href="mterm_8cpp_source.html#l00330">330</a> of file <a class="el" href="mterm_8cpp_source.html">mterm.cpp</a>.</p>

<p>References <a class="el" href="signals_8hh_source.html#l00150">sigMul()</a>.</p>

<p>Referenced by <a class="el" href="mterm_8cpp_source.html#l00361">combineMulDiv()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00331"></a>00331 {
<a name="l00332"></a>00332     assert(f);
<a name="l00333"></a>00333     assert(q&gt;0);
<a name="l00334"></a>00334     <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> r = f;
<a name="l00335"></a>00335     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> c=2; c&lt;=q; c++) { r = <a class="code" href="signals_8hh.html#a333591913e073c3acd6b891b6da85298">sigMul</a>(r,f); }
<a name="l00336"></a>00336     assert(r);
<a name="l00337"></a>00337     <span class="keywordflow">return</span> r;
<a name="l00338"></a>00338 }
</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="a071cd18b4fc8aca551d99b5523601328"></a><!-- doxytag: member="mterm.cpp::combineDivLeft" ref="a071cd18b4fc8aca551d99b5523601328" args="(Tree &amp;R, Tree A)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static void combineDivLeft </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>R</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>A</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Combine R and A doing R = R*A or R = A. </p>

<p>Definition at line <a class="el" href="mterm_8cpp_source.html#l00352">352</a> of file <a class="el" href="mterm_8cpp_source.html">mterm.cpp</a>.</p>

<p>References <a class="el" href="signals_8hh_source.html#l00151">sigDiv()</a>, and <a class="el" href="tree_8hh_source.html#l00173">tree()</a>.</p>

<p>Referenced by <a class="el" href="mterm_8cpp_source.html#l00391">mterm::normalizedTree()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00353"></a>00353 {
<a name="l00354"></a>00354     <span class="keywordflow">if</span> (R &amp;&amp; A)     R = <a class="code" href="signals_8hh.html#aa355af5e231f2e25ed43fa2f3bf6c72f">sigDiv</a>(R,A);
<a name="l00355"></a>00355     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (A)     R = <a class="code" href="signals_8hh.html#aa355af5e231f2e25ed43fa2f3bf6c72f">sigDiv</a>(<a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(1.0f),A);
<a name="l00356"></a>00356 }
</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="a964193592967662b693d5bc1f028092f"></a><!-- doxytag: member="mterm.cpp::combineMulDiv" ref="a964193592967662b693d5bc1f028092f" args="(Tree &amp;M, Tree &amp;D, Tree f, int q)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static void combineMulDiv </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>M</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>D</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>q</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Do M = M * f**q or D = D * f**-q. </p>

<p>Definition at line <a class="el" href="mterm_8cpp_source.html#l00361">361</a> of file <a class="el" href="mterm_8cpp_source.html">mterm.cpp</a>.</p>

<p>References <a class="el" href="mterm_8cpp_source.html#l00330">buildPowTerm()</a>, and <a class="el" href="mterm_8cpp_source.html#l00343">combineMulLeft()</a>.</p>

<p>Referenced by <a class="el" href="mterm_8cpp_source.html#l00391">mterm::normalizedTree()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00362"></a>00362 {
<a name="l00363"></a>00363 <span class="preprocessor">    #ifdef TRACE</span>
<a name="l00364"></a>00364 <span class="preprocessor"></span>    cerr &lt;&lt; <span class="stringliteral">&quot;combineMulDiv (&quot;</span> &lt;&lt; M &lt;&lt; <span class="stringliteral">&quot;/&quot;</span>  &lt;&lt; D &lt;&lt; <span class="stringliteral">&quot;*&quot;</span> &lt;&lt; <a class="code" href="classppsig.html">ppsig</a>(f)&lt;&lt; <span class="stringliteral">&quot;**&quot;</span> &lt;&lt; q &lt;&lt; endl;
<a name="l00365"></a>00365 <span class="preprocessor">    #endif</span>
<a name="l00366"></a>00366 <span class="preprocessor"></span>    <span class="keywordflow">if</span> (f) {
<a name="l00367"></a>00367         <span class="keywordflow">if</span> (q &gt; 0) {
<a name="l00368"></a>00368             <a class="code" href="mterm_8cpp.html#aaf3bf9f31ee2676c6a38c698191e1f12" title="Combine R and A doing R = R*A or R = A.">combineMulLeft</a>(M, <a class="code" href="mterm_8cpp.html#a989a51a835beba670bf40439995d9643" title="produce the canonical tree correspoding to a mterm">buildPowTerm</a>(f,q));
<a name="l00369"></a>00369         } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (q &lt; 0) {
<a name="l00370"></a>00370             <a class="code" href="mterm_8cpp.html#aaf3bf9f31ee2676c6a38c698191e1f12" title="Combine R and A doing R = R*A or R = A.">combineMulLeft</a>(D, <a class="code" href="mterm_8cpp.html#a989a51a835beba670bf40439995d9643" title="produce the canonical tree correspoding to a mterm">buildPowTerm</a>(f,-q));
<a name="l00371"></a>00371         }
<a name="l00372"></a>00372     }
<a name="l00373"></a>00373 }   
</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="aaf3bf9f31ee2676c6a38c698191e1f12"></a><!-- doxytag: member="mterm.cpp::combineMulLeft" ref="aaf3bf9f31ee2676c6a38c698191e1f12" args="(Tree &amp;R, Tree A)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static void combineMulLeft </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>R</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>A</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Combine R and A doing R = R*A or R = A. </p>

<p>Definition at line <a class="el" href="mterm_8cpp_source.html#l00343">343</a> of file <a class="el" href="mterm_8cpp_source.html">mterm.cpp</a>.</p>

<p>References <a class="el" href="signals_8hh_source.html#l00150">sigMul()</a>.</p>

<p>Referenced by <a class="el" href="mterm_8cpp_source.html#l00361">combineMulDiv()</a>, and <a class="el" href="mterm_8cpp_source.html#l00391">mterm::normalizedTree()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00344"></a>00344 {
<a name="l00345"></a>00345     <span class="keywordflow">if</span> (R &amp;&amp; A)     R = <a class="code" href="signals_8hh.html#a333591913e073c3acd6b891b6da85298">sigMul</a>(R,A);
<a name="l00346"></a>00346     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (A)     R = A;
<a name="l00347"></a>00347 }
</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="a0756b2c1f2950a0099b062bde262abed"></a><!-- doxytag: member="mterm.cpp::common" ref="a0756b2c1f2950a0099b062bde262abed" args="(int a, int b)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static int common </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>b</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>return the "common quantity" of two numbers </p>

<p>Definition at line <a class="el" href="mterm_8cpp_source.html#l00252">252</a> of file <a class="el" href="mterm_8cpp_source.html">mterm.cpp</a>.</p>

<p>References <a class="el" href="interval_8hh_source.html#l00060">max()</a>, and <a class="el" href="interval_8hh_source.html#l00059">min()</a>.</p>

<p>Referenced by <a class="el" href="mterm_8cpp_source.html#l00267">gcd()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00253"></a>00253 {
<a name="l00254"></a>00254     <span class="keywordflow">if</span> (a &gt; 0 &amp; b &gt; 0) {
<a name="l00255"></a>00255         <span class="keywordflow">return</span> <a class="code" href="interval_8hh.html#a2f8edc4561e9744ed4233b205fa7ec32">min</a>(a,b);
<a name="l00256"></a>00256     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (a &lt; 0 &amp; b &lt; 0) {
<a name="l00257"></a>00257         <span class="keywordflow">return</span> <a class="code" href="interval_8hh.html#a1c45761573e6cbc97cfacac78d905016">max</a>(a,b);
<a name="l00258"></a>00258     } <span class="keywordflow">else</span> {
<a name="l00259"></a>00259         <span class="keywordflow">return</span> 0;
<a name="l00260"></a>00260     }
<a name="l00261"></a>00261 }
</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="ab40b9c37818acb439b805fd70315bad2"></a><!-- doxytag: member="mterm.cpp::contains" ref="ab40b9c37818acb439b805fd70315bad2" args="(int a, int b)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static bool contains </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>b</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>We say that a "contains" b if a/b &gt; 0. </p>
<p>For example 3 contains 2 and -4 contains -2, but 3 doesn't contains -2 and -3 doesn't contains 1 </p>

<p>Definition at line <a class="el" href="mterm_8cpp_source.html#l00293">293</a> of file <a class="el" href="mterm_8cpp_source.html">mterm.cpp</a>.</p>

<p>Referenced by <a class="el" href="mterm_8cpp_source.html#l00305">mterm::hasDivisor()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00294"></a>00294 {
<a name="l00295"></a>00295     <span class="keywordflow">return</span> (b == 0) || (a/b &gt; 0);
<a name="l00296"></a>00296 }
</pre></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="a385a9a70763e3f9d9b1c6df07a58d4a2"></a><!-- doxytag: member="mterm.cpp::gcd" ref="a385a9a70763e3f9d9b1c6df07a58d4a2" args="(const mterm &amp;m1, const mterm &amp;m2)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmterm.html">mterm</a> gcd </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classmterm.html">mterm</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>m1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classmterm.html">mterm</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>m2</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>return a mterm that is the greatest common divisor of two mterms </p>

<p>Definition at line <a class="el" href="mterm_8cpp_source.html#l00267">267</a> of file <a class="el" href="mterm_8cpp_source.html">mterm.cpp</a>.</p>

<p>References <a class="el" href="mterm_8cpp_source.html#l00252">common()</a>, <a class="el" href="mterm_8hh_source.html#l00024">mterm::fCoef</a>, <a class="el" href="mterm_8hh_source.html#l00025">mterm::fFactors</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#l00218">aterm::greatestDivisor()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00268"></a>00268 {
<a name="l00269"></a>00269     <span class="comment">//cerr &lt;&lt; &quot;GCD of &quot; &lt;&lt; m1 &lt;&lt; &quot; and &quot; &lt;&lt; m2 &lt;&lt; endl;</span>
<a name="l00270"></a>00270 
<a name="l00271"></a>00271     <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> c = (m1.<a class="code" href="classmterm.html#acc0c29889a33734c89b3bcd81c2b7c07" title="constant part of the term (usually 1 or -1)">fCoef</a> == m2.<a class="code" href="classmterm.html#acc0c29889a33734c89b3bcd81c2b7c07" title="constant part of the term (usually 1 or -1)">fCoef</a>) ? m1.<a class="code" href="classmterm.html#acc0c29889a33734c89b3bcd81c2b7c07" title="constant part of the term (usually 1 or -1)">fCoef</a> : <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(1);       <span class="comment">// common coefficient (real gcd not needed)</span>
<a name="l00272"></a>00272     <a class="code" href="classmterm.html" title="Implements a multiplicative term, a term of type k*x^n*y^m*.">mterm</a> R(c);
<a name="l00273"></a>00273     <span class="keywordflow">for</span> (MP::const_iterator p1 = m1.<a class="code" href="classmterm.html#a9147de42ca9a68d4b755409479cafa83" title="non constant terms and their power">fFactors</a>.begin(); p1 != m1.<a class="code" href="classmterm.html#a9147de42ca9a68d4b755409479cafa83" title="non constant terms and their power">fFactors</a>.end(); p1++) {
<a name="l00274"></a>00274         <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 = p1-&gt;first;
<a name="l00275"></a>00275         MP::const_iterator p2 = m2.<a class="code" href="classmterm.html#a9147de42ca9a68d4b755409479cafa83" title="non constant terms and their power">fFactors</a>.find(t);
<a name="l00276"></a>00276         <span class="keywordflow">if</span> (p2 != m2.<a class="code" href="classmterm.html#a9147de42ca9a68d4b755409479cafa83" title="non constant terms and their power">fFactors</a>.end()) {
<a name="l00277"></a>00277             <span class="keywordtype">int</span> v1 = p1-&gt;second;
<a name="l00278"></a>00278             <span class="keywordtype">int</span> v2 = p2-&gt;second;
<a name="l00279"></a>00279             <span class="keywordtype">int</span> c = <a class="code" href="mterm_8cpp.html#a0756b2c1f2950a0099b062bde262abed" title="return the &amp;quot;common quantity&amp;quot; of two numbers">common</a>(v1,v2);
<a name="l00280"></a>00280             <span class="keywordflow">if</span> (c != 0) {
<a name="l00281"></a>00281                 R.fFactors[t] = c;
<a name="l00282"></a>00282             }
<a name="l00283"></a>00283         }
<a name="l00284"></a>00284     }
<a name="l00285"></a>00285     <span class="comment">//cerr &lt;&lt; &quot;GCD of &quot; &lt;&lt; m1 &lt;&lt; &quot; and &quot; &lt;&lt; m2 &lt;&lt; &quot; is : &quot; &lt;&lt; R &lt;&lt; endl;</span>
<a name="l00286"></a>00286     <span class="keywordflow">return</span> R;
<a name="l00287"></a>00287 }
</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>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Apr 29 00:00:08 2010 for FAUST compiler by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>