<!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: lexbuckets.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>lexbuckets.h</h1><a href="lexbuckets_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"> * pairs.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 19.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 <functional></span> <a name="l00010"></a>00010 <span class="preprocessor">#include "<a class="code" href="groebner__defs_8h.html">groebner_defs.h</a>"</span> <a name="l00011"></a>00011 <span class="preprocessor">#include "<a class="code" href="literal__factorization_8h.html">literal_factorization.h</a>"</span> <a name="l00012"></a>00012 <span class="preprocessor">#include <boost/shared_ptr.hpp></span> <a name="l00013"></a>00013 <span class="preprocessor">#include <queue></span> <a name="l00014"></a>00014 <span class="preprocessor">#include <algorithm></span> <a name="l00015"></a>00015 <span class="preprocessor">#include <utility></span> <a name="l00016"></a>00016 <span class="preprocessor">#include <set></span> <a name="l00017"></a>00017 <span class="preprocessor">#include <vector></span> <a name="l00018"></a>00018 <span class="preprocessor">#ifndef PB_LEXBUCKETS_H</span> <a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#define PB_LEXBUCKETS_H</span> <a name="l00020"></a>00020 <span class="preprocessor"></span> <a name="l00021"></a>00021 <a class="code" href="groebner__defs_8h.html#379ca4efe65763012d75de1c107932b3">BEGIN_NAMESPACE_PBORIGB</a> <a name="l00022"></a>00022 <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> <a class="code" href="namespacepolybori_1_1groebner.html#ccc11fb7eb1e8ceb3499f8f90af0f0c6">without_prior_part</a>(<a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> p, <a class="code" href="namespacepolybori_1_1groebner.html#ef37a95e97afbd561cc4c5f84d660765">idx_type</a> tail_start); <a name="l00023"></a><a class="code" href="classpolybori_1_1groebner_1_1LexBucket.html">00023</a> <span class="keyword">class </span><a class="code" href="classpolybori_1_1groebner_1_1LexBucket.html">LexBucket</a>{ <a name="l00024"></a>00024 <span class="comment">//typedef CTypes::idx_type idx_type;</span> <a name="l00025"></a>00025 <span class="keyword">public</span>: <a name="l00026"></a><a class="code" href="classpolybori_1_1groebner_1_1LexBucket.html#126b8b78c90761e862654c0a6981ef89">00026</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> var_group_size=1; <a name="l00027"></a><a class="code" href="classpolybori_1_1groebner_1_1LexBucket.html#1c5b1aef6f12acf7b14f96ad5559dbbf">00027</a> <a class="code" href="classpolybori_1_1groebner_1_1LexBucket.html#1c5b1aef6f12acf7b14f96ad5559dbbf">LexBucket</a>(){ <a name="l00028"></a>00028 ones=<span class="keyword">false</span>; <a name="l00029"></a>00029 updateTailStart(); <a name="l00030"></a>00030 } <a name="l00031"></a>00031 <a class="code" href="classpolybori_1_1groebner_1_1LexBucket.html">LexBucket</a>& 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>& p); <a name="l00032"></a><a class="code" href="classpolybori_1_1groebner_1_1LexBucket.html#dab4bd7b380469472637a56b6a990fe2">00032</a> <a class="code" href="classpolybori_1_1groebner_1_1LexBucket.html#dab4bd7b380469472637a56b6a990fe2">LexBucket</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="l00033"></a>00033 ones=<span class="keyword">false</span>; <a name="l00034"></a>00034 <span class="keywordflow">if</span> (!(p.<a class="code" href="classpolybori_1_1BoolePolynomial.html#b171f5956d5cdbb66e719f31263a2af9" title="Check whether polynomial is zero or one.">isConstant</a>())){ <a name="l00035"></a>00035 front=p; <a name="l00036"></a>00036 updateTailStart(); <a name="l00037"></a>00037 <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> back=<a class="code" href="namespacepolybori_1_1groebner.html#ccc11fb7eb1e8ceb3499f8f90af0f0c6">without_prior_part</a>(p, tail_start); <a name="l00038"></a>00038 <span class="keywordflow">if</span> (!(back.<a class="code" href="classpolybori_1_1BoolePolynomial.html#fb4f4c542c9f279c8caa0c9e6e463f2b" title="Check whether polynomial is constant zero.">isZero</a>())){ <a name="l00039"></a>00039 <span class="keywordflow">if</span> (back.<a class="code" href="classpolybori_1_1BoolePolynomial.html#e85d40acf57ec4446514ae6ddab9c467" title="Check whether polynomial is constant one.">isOne</a>()){ <a name="l00040"></a>00040 ones=(!(ones)); <a name="l00041"></a>00041 } <span class="keywordflow">else</span>{ <a name="l00042"></a>00042 buckets.push_back(back); <a name="l00043"></a>00043 } <a name="l00044"></a>00044 } <a name="l00045"></a>00045 front-=back; <a name="l00046"></a>00046 } <span class="keywordflow">else</span> { <a name="l00047"></a>00047 updateTailStart(); <a name="l00048"></a>00048 front=0; <a name="l00049"></a>00049 <span class="keywordflow">if</span> (p.<a class="code" href="classpolybori_1_1BoolePolynomial.html#e85d40acf57ec4446514ae6ddab9c467" title="Check whether polynomial is constant one.">isOne</a>()) ones=<span class="keyword">true</span>; <a name="l00050"></a>00050 } <a name="l00051"></a>00051 } <a name="l00052"></a><a class="code" href="classpolybori_1_1groebner_1_1LexBucket.html#f0e8e06792f6881cc4d5ed7f6d4bd41d">00052</a> <span class="keywordtype">void</span> <a class="code" href="classpolybori_1_1groebner_1_1LexBucket.html#f0e8e06792f6881cc4d5ed7f6d4bd41d">clearFront</a>(){ <a name="l00053"></a>00053 front=0; <a name="l00054"></a>00054 <span class="keywordflow">while</span>((front.isZero())&& (buckets.size()>0)){ <a name="l00055"></a>00055 increaseTailStart(tail_start+var_group_size); <a name="l00056"></a>00056 } <a name="l00057"></a>00057 } <a name="l00058"></a>00058 <a class="code" href="classpolybori_1_1BooleExponent.html" title="This class is just a wrapper for using variables for storing indices as interim data...">Exponent</a> leadExp(); <a name="l00059"></a>00059 <span class="keywordtype">bool</span> isZero(); <a name="l00060"></a>00060 <span class="comment">//we assume that p has smaller/equal terms than the bucket, or the bucket is zero</span> <a name="l00061"></a>00061 <span class="keywordtype">void</span> updateTailStart(); <a name="l00062"></a>00062 <a class="code" href="namespacepolybori_1_1groebner.html#ef37a95e97afbd561cc4c5f84d660765">idx_type</a> getTailStart(); <a name="l00063"></a>00063 <span class="keywordtype">void</span> increaseTailStart(<a class="code" href="namespacepolybori_1_1groebner.html#ef37a95e97afbd561cc4c5f84d660765">idx_type</a> new_start); <a name="l00064"></a>00064 <a class="code" href="classpolybori_1_1BoolePolynomial.html" title="This class wraps the underlying decicion diagram type and defines the necessary operations...">Polynomial</a> value(); <a name="l00065"></a><a class="code" href="classpolybori_1_1groebner_1_1LexBucket.html#3de323bca45d817b8f2ce5d9c2d39cf7">00065</a> <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_1LexBucket.html#3de323bca45d817b8f2ce5d9c2d39cf7">getFront</a>(){ <a name="l00066"></a>00066 <span class="keywordflow">return</span> front; <a name="l00067"></a>00067 } <a name="l00068"></a>00068 <a name="l00069"></a><a class="code" href="classpolybori_1_1groebner_1_1LexBucket.html#42df0ef120678b587746dc02063e9398">00069</a> <span class="keywordtype">bool</span> <a class="code" href="classpolybori_1_1groebner_1_1LexBucket.html#42df0ef120678b587746dc02063e9398">isOne</a>(){ <a name="l00070"></a>00070 usualAssertions(); <a name="l00071"></a>00071 <span class="keywordflow">if</span> ((front.isZero()) && (ones) && (buckets.size()==0)) <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00072"></a>00072 <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00073"></a>00073 } <a name="l00074"></a>00074 <span class="keyword">private</span>: <a name="l00075"></a>00075 <span class="keywordtype">void</span> usualAssertions(){ <a name="l00076"></a>00076 assert((buckets.size()==0)||(!(front.isZero()))); <a name="l00077"></a>00077 } <a name="l00078"></a>00078 std::vector<Polynomial> buckets; <a name="l00079"></a>00079 <a class="code" href="namespacepolybori_1_1groebner.html#9effc853ae98fcfa4a670b3654482ed9">Polynomial</a> front; <a name="l00080"></a>00080 <a class="code" href="namespacepolybori_1_1groebner.html#ef37a95e97afbd561cc4c5f84d660765">idx_type</a> tail_start; <a name="l00081"></a>00081 <span class="keywordtype">bool</span> ones; <a name="l00082"></a>00082 <a name="l00083"></a>00083 }; <a name="l00084"></a>00084 <a name="l00085"></a>00085 <a class="code" href="groebner__defs_8h.html#81b45485049b7eaa5057379309e0210e">END_NAMESPACE_PBORIGB</a> <a name="l00086"></a>00086 <a name="l00087"></a>00087 <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>