<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>PolyBoRi: nf.h 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.5.9 --> <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="namespaces.html"><span>Namespaces</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>nf.h</h1><a href="nf_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> * nf.h</span> <a name="l00003"></a>00003 <span class="comment"> * PolyBoRi</span> <a name="l00004"></a>00004 <span class="comment"> *</span> <a name="l00005"></a>00005 <span class="comment"> * Created by Michael Brickenstein on 25.04.06.</span> <a name="l00006"></a>00006 <span class="comment"> * Copyright 2006 The PolyBoRi Team. See LICENSE file.</span> <a name="l00007"></a>00007 <span class="comment"> *</span> <a name="l00008"></a>00008 <span class="comment"> */</span> <a name="l00009"></a>00009 <span class="preprocessor">#include <algorithm></span> <a name="l00010"></a>00010 <span class="preprocessor">#include <vector></span> <a name="l00011"></a>00011 <span class="preprocessor">#include <queue></span> <a name="l00012"></a>00012 <span class="preprocessor">#include "<a class="code" href="groebner__alg_8h.html">groebner_alg.h</a>"</span> <a name="l00013"></a>00013 <span class="preprocessor">#ifndef PBORI_GB_NF_H</span> <a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define PBORI_GB_NF_H</span> <a name="l00015"></a>00015 <span class="preprocessor"></span><a class="code" href="groebner__defs_8h.html#379ca4efe65763012d75de1c107932b3">BEGIN_NAMESPACE_PBORIGB</a> <a name="l00016"></a>00016 <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#4685d3ec473fbac460c10dd32e82fb56">add_up_exponents</a>(<span class="keyword">const</span> std::vector<Exponent>& vec); <a name="l00017"></a>00017 <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#6906a6e027060fb221852fa7ad2c7ca8">add_up_monomials</a>(<span class="keyword">const</span> std::vector<Monomial>& res_vec); <a name="l00018"></a>00018 <span class="keywordtype">int</span> <a class="code" href="namespacepolybori_1_1groebner.html#7971a58c264e7e92a28b936db5485375">select1</a>(<span class="keyword">const</span> GroebnerStrategy& strat, <span class="keyword">const</span> <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a>& p); <a name="l00019"></a>00019 <span class="keywordtype">int</span> <a class="code" href="namespacepolybori_1_1groebner.html#7971a58c264e7e92a28b936db5485375">select1</a>(<span class="keyword">const</span> GroebnerStrategy& strat, <span class="keyword">const</span> <a class="code" href="namespacepolybori_1_1groebner.html#d7fe96ee02dc21d490f026af4b69c8e2">Monomial</a>& m); <a name="l00020"></a>00020 <a name="l00021"></a>00021 <span class="keywordtype">int</span> <a class="code" href="namespacepolybori_1_1groebner.html#7a53d4bf58c2acf448362ba59c944842">select_no_deg_growth</a>(<span class="keyword">const</span> GroebnerStrategy& strat, <span class="keyword">const</span> <a class="code" href="namespacepolybori_1_1groebner.html#d7fe96ee02dc21d490f026af4b69c8e2">Monomial</a>& m); <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="keyword">static</span> <span class="keywordtype">int</span> select_short(<span class="keyword">const</span> GroebnerStrategy& strat, <span class="keyword">const</span> <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a>& p); <a name="l00024"></a>00024 <span class="keyword">static</span> <span class="keywordtype">int</span> select_short(<span class="keyword">const</span> GroebnerStrategy& strat, <span class="keyword">const</span> <a class="code" href="namespacepolybori_1_1groebner.html#d7fe96ee02dc21d490f026af4b69c8e2">Monomial</a>& m); <a name="l00025"></a>00025 <a name="l00026"></a>00026 <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#dd067f1aca4bffb89b6247f0bd9cd903">nf1</a>(GroebnerStrategy& strat, <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> p); <a name="l00027"></a>00027 <a name="l00028"></a>00028 <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#73be4c8f78f3c8a5687ed0208228ca2b">nf2</a>(GroebnerStrategy& strat, <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> p); <a name="l00029"></a>00029 <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#e9f538c4053fafad5685123fa3990474">nf2_short</a>(GroebnerStrategy& strat, <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> p); <a name="l00030"></a>00030 <a name="l00031"></a>00031 <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#3d218776fc28569a703662406a78c247">nf_delaying</a>(GroebnerStrategy& strat, <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> p); <a name="l00032"></a>00032 <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#f005b6ab36a282ec8eda746a15db45fa">nf_delaying_exchanging</a>(GroebnerStrategy& strat, <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> p); <a name="l00033"></a>00033 <a name="l00034"></a><a class="code" href="classpolybori_1_1groebner_1_1LMLessCompare.html">00034</a> <span class="keyword">class </span><a class="code" href="classpolybori_1_1groebner_1_1LMLessCompare.html">LMLessCompare</a>{ <a name="l00035"></a>00035 <span class="keyword">public</span>: <a name="l00036"></a><a class="code" href="classpolybori_1_1groebner_1_1LMLessCompare.html#314b9d2d4e9d63c1ff924eca3a825933">00036</a> <span class="keywordtype">bool</span> operator() (<span class="keyword">const</span> <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a>& p1, <span class="keyword">const</span> <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a>& p2){ <a name="l00037"></a>00037 <span class="keywordflow">return</span> p1.<a class="code" href="classpolybori_1_1BoolePolynomial.html#67cb2a5617e37c17683b730411964186" title="Get leading term.">lead</a>()<p2.<a class="code" href="classpolybori_1_1BoolePolynomial.html#67cb2a5617e37c17683b730411964186" title="Get leading term.">lead</a>(); <a name="l00038"></a>00038 } <a name="l00039"></a>00039 }; <a name="l00040"></a>00040 <a name="l00041"></a><a class="code" href="namespacepolybori_1_1groebner.html#bfc5c220c81554c341bb6f77461509d6">00041</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="namespacepolybori_1_1groebner.html#bfc5c220c81554c341bb6f77461509d6">SLIMGB_SIMPLEST</a>=0; <a name="l00042"></a><a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html">00042</a> <span class="keyword">template</span><<span class="keywordtype">int</span> variant> <span class="keyword">class </span><a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html">SlimgbReduction</a>{ <a name="l00043"></a>00043 <span class="keyword">private</span>: <a name="l00044"></a>00044 <a class="code" href="classpolybori_1_1groebner_1_1GroebnerStrategy.html">GroebnerStrategy</a>* strat; <a name="l00045"></a>00045 std::priority_queue<Polynomial, std::vector<Polynomial>, <a class="code" href="classpolybori_1_1groebner_1_1LMLessCompare.html">LMLessCompare</a>> to_reduce; <a name="l00046"></a>00046 <span class="keyword">public</span>: <a name="l00047"></a><a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html#1307e382b319edb3247a47ccc626a421">00047</a> std::vector<Polynomial> result; <a name="l00048"></a>00048 <a name="l00049"></a><a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html#39d87a3ec05d5412707872bf314cb07f">00049</a> <a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html#39d87a3ec05d5412707872bf314cb07f">SlimgbReduction</a>(<a class="code" href="classpolybori_1_1groebner_1_1GroebnerStrategy.html">GroebnerStrategy</a>& strat){ <a name="l00050"></a>00050 this->strat=&strat; <a name="l00051"></a>00051 } <a name="l00052"></a><a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html#b7d90fe03d6f3e63d7ff594c73252d7a">00052</a> <a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html#b7d90fe03d6f3e63d7ff594c73252d7a">SlimgbReduction</a>(){} <a name="l00053"></a>00053 <span class="keywordtype">void</span> addPolynomial(<span class="keyword">const</span> <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a>& p); <a name="l00054"></a>00054 <span class="keywordtype">void</span> reduce(); <a name="l00055"></a>00055 <span class="comment">//return zero at the end</span> <a name="l00056"></a>00056 <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> nextResult(); <a name="l00057"></a>00057 }; <a name="l00058"></a><a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html#64ca9d3c6a2bef26a1f00ff193c8e96f">00058</a> <span class="keyword">template</span> <<span class="keywordtype">int</span> variant> <span class="keywordtype">void</span> <a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html">SlimgbReduction<variant>::addPolynomial</a>(<span class="keyword">const</span> <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a>& p){ <a name="l00059"></a>00059 <span class="keywordflow">if</span> (!(p.<a class="code" href="classpolybori_1_1BoolePolynomial.html#fb4f4c542c9f279c8caa0c9e6e463f2b" title="Check whether polynomial is constant zero.">isZero</a>())){ <a name="l00060"></a>00060 to_reduce.push(p); <a name="l00061"></a>00061 } <a name="l00062"></a>00062 } <a name="l00063"></a><a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html#850a195fb303a6c07f470f252f25ab5d">00063</a> <span class="keyword">template</span> <<span class="keywordtype">int</span> variant> <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> <a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html#850a195fb303a6c07f470f252f25ab5d">SlimgbReduction<variant>::nextResult</a>(){ <a name="l00064"></a>00064 <span class="keywordflow">if</span> (<a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html#1307e382b319edb3247a47ccc626a421">result</a>.size()==0) <span class="keywordflow">return</span> <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a>(); <a name="l00065"></a>00065 <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> res=<a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html#1307e382b319edb3247a47ccc626a421">result</a>.back(); <a name="l00066"></a>00066 <a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html#1307e382b319edb3247a47ccc626a421">result</a>.pop_back(); <a name="l00067"></a>00067 <span class="keywordflow">return</span> res; <a name="l00068"></a>00068 } <a name="l00069"></a><a class="code" href="namespacepolybori_1_1groebner.html#72beba7b587209fc7888f7f3ad6d7197">00069</a> <span class="keyword">typedef</span> <a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html">SlimgbReduction<SLIMGB_SIMPLEST></a> <a class="code" href="classpolybori_1_1groebner_1_1SlimgbReduction.html">slimgb_reduction_type</a>; <a name="l00070"></a>00070 std::vector<Polynomial> <a class="code" href="namespacepolybori_1_1groebner.html#ec1f7df10eb6c5b6958955055e6f81cd">parallel_reduce</a>(std::vector<Polynomial> inp, <a class="code" href="classpolybori_1_1groebner_1_1GroebnerStrategy.html">GroebnerStrategy</a>& strat, <span class="keywordtype">int</span> average_steps, <span class="keywordtype">double</span> delay_f); <a name="l00071"></a>00071 <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#70f2803f15e0124b1b370d0dadd5be76">red_tail</a>(<span class="keyword">const</span> <a class="code" href="classpolybori_1_1groebner_1_1GroebnerStrategy.html">GroebnerStrategy</a>& strat, <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> p); <a name="l00072"></a>00072 <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#1c371d36bf843409a914cca2b1c4a8fa">red_tail_short</a>(<span class="keyword">const</span> <a class="code" href="classpolybori_1_1groebner_1_1GroebnerStrategy.html">GroebnerStrategy</a>& strat, <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> p); <a name="l00073"></a>00073 <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#60a9b609613a8d442c201ddb211e4902">nf3</a>(<span class="keyword">const</span> <a class="code" href="classpolybori_1_1groebner_1_1GroebnerStrategy.html">GroebnerStrategy</a>& strat, <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> p, <a class="code" href="classpolybori_1_1BooleMonomial.html" title="This class is just a wrapper for using variables from cudd&#39;s decicion diagram...">Monomial</a> rest_lead); <a name="l00074"></a>00074 <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#c688e86b125b9d13ba8d200771482feb">nf3_short</a>(<span class="keyword">const</span> <a class="code" href="classpolybori_1_1groebner_1_1GroebnerStrategy.html">GroebnerStrategy</a>& strat, <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> p); <a name="l00075"></a>00075 <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#29b6cbc7a6a8423aef0aa7dbcf296be0">red_tail_self_tuning</a>(<span class="keyword">const</span> <a class="code" href="classpolybori_1_1groebner_1_1GroebnerStrategy.html">GroebnerStrategy</a>& strat, <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> p); <a name="l00076"></a>00076 <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#b933d315f4cc01af99e5115b6324186b">ll_red_nf</a>(<span class="keyword">const</span> <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a>& p,<span class="keyword">const</span> <a class="code" href="classpolybori_1_1BooleSet.html">BooleSet</a>& reductors); <a name="l00077"></a>00077 <a name="l00078"></a>00078 <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#d71cccd66034d933dfc715ecfa03b080">ll_red_nf_noredsb</a>(<span class="keyword">const</span> <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a>& p,<span class="keyword">const</span> <a class="code" href="classpolybori_1_1BooleSet.html">BooleSet</a>& reductors); <a name="l00079"></a>00079 <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#e3c92ff1aa57f920ab8b482786a73a74">add_up_polynomials</a>(<span class="keyword">const</span> std::vector<Polynomial>& vec); <a name="l00080"></a>00080 <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#3f2b12fcb725a127e7813f59ed84baed">plug_1</a>(<span class="keyword">const</span> <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a>& p, <span class="keyword">const</span> <a class="code" href="classpolybori_1_1BooleSet.html">MonomialSet</a>& m_plus_ones); <a name="l00081"></a>00081 <a class="code" href="classpolybori_1_1BooleSet.html">MonomialSet</a> <a class="code" href="namespacepolybori_1_1groebner.html#0dee84a6dfbf6dca569ef1e478e6a3cd">mod_mon_set</a>(<span class="keyword">const</span> <a class="code" href="classpolybori_1_1BooleSet.html">MonomialSet</a>& as, <span class="keyword">const</span> <a class="code" href="classpolybori_1_1BooleSet.html">MonomialSet</a> &vs); <a name="l00082"></a>00082 <a class="code" href="groebner__defs_8h.html#81b45485049b7eaa5057379309e0210e">END_NAMESPACE_PBORIGB</a> <a name="l00083"></a>00083 <span class="preprocessor">#endif</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Wed Sep 9 14:30:58 2009 for PolyBoRi by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> </body> </html>