root/doc/html/galois_8h-source.html @ 353

Revision 353, 65.3 kB (checked in by smidl, 16 years ago)

doc

RevLine 
[353]1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>mixpp: galois.h Source File</title>
4<link href="tabs.css" rel="stylesheet" type="text/css">
5<link href="doxygen.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.8 -->
8<script type="text/javascript">
9<!--
10function changeDisplayState (e){
11  var num=this.id.replace(/[^[0-9]/g,'');
12  var button=this.firstChild;
13  var sectionDiv=document.getElementById('dynsection'+num);
14  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
15    sectionDiv.style.display='block';
16    button.src='open.gif';
17  }else{
18    sectionDiv.style.display='none';
19    button.src='closed.gif';
20  }
21}
22function initDynSections(){
23  var divs=document.getElementsByTagName('div');
24  var sectionCounter=1;
25  for(var i=0;i<divs.length-1;i++){
26    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
27      var header=divs[i];
28      var section=divs[i+1];
29      var button=header.firstChild;
30      if (button!='IMG'){
31        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
32        button=document.createElement('img');
33        divs[i].insertBefore(button,divs[i].firstChild);
34      }
35      header.style.cursor='pointer';
36      header.onclick=changeDisplayState;
37      header.id='dynheader'+sectionCounter;
38      button.src='closed.gif';
39      section.id='dynsection'+sectionCounter;
40      section.style.display='none';
41      section.style.marginLeft='14px';
42      sectionCounter++;
43    }
44  }
45}
46window.onload = initDynSections;
47-->
48</script>
49<div class="navigation" id="top">
50  <div class="tabs">
51    <ul>
52      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
53      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
54      <li><a href="modules.html"><span>Modules</span></a></li>
55      <li><a href="annotated.html"><span>Classes</span></a></li>
56      <li class="current"><a href="files.html"><span>Files</span></a></li>
57    </ul>
58  </div>
59  <div class="tabs">
60    <ul>
61      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
62      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
63    </ul>
64  </div>
65<h1>galois.h</h1><a href="galois_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
66<a name="l00029"></a>00029 <span class="preprocessor">#ifndef GALOIS_H</span>
67<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define GALOIS_H</span>
68<a name="l00031"></a>00031 <span class="preprocessor"></span>
69<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;<a class="code" href="vec_8h.html" title="Templated Vector Class Definitions.">itpp/base/vec.h</a>&gt;</span>
70<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;<a class="code" href="array_8h.html" title="Definition of Array class (container).">itpp/base/array.h</a>&gt;</span>
71<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;<a class="code" href="binary_8h.html" title="Binary class definition.">itpp/base/binary.h</a>&gt;</span>
72<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;<a class="code" href="converters_8h.html" title="Definitions of converters between different vector and matrix types.">itpp/base/converters.h</a>&gt;</span>
73<a name="l00036"></a>00036
74<a name="l00037"></a>00037
75<a name="l00038"></a>00038 <span class="keyword">namespace </span>itpp
76<a name="l00039"></a>00039 {
77<a name="l00040"></a>00040
78<a name="l00073"></a><a class="code" href="classitpp_1_1GF.html">00073</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a>
79<a name="l00074"></a>00074 {
80<a name="l00075"></a>00075 <span class="keyword">public</span>:
81<a name="l00077"></a><a class="code" href="classitpp_1_1GF.html#0436dff6aebfa5093654a31e0bc6438a">00077</a>   <a class="code" href="classitpp_1_1GF.html#0436dff6aebfa5093654a31e0bc6438a" title="Constructor.">GF</a>() { m = 0; }
82<a name="l00079"></a><a class="code" href="classitpp_1_1GF.html#b024dbc1cb60922bb00aecce96d471ed">00079</a>   <a class="code" href="classitpp_1_1GF.html#b024dbc1cb60922bb00aecce96d471ed" title="Constructor.">GF</a>(<span class="keywordtype">int</span> qvalue) {
83<a name="l00080"></a>00080     m = 0;
84<a name="l00081"></a>00081     <span class="keywordflow">if</span> (qvalue == 0) <span class="comment">// qvalue==0 gives the zeroth element</span>
85<a name="l00082"></a>00082       value = -1;
86<a name="l00083"></a>00083     <span class="keywordflow">else</span> <a class="code" href="classitpp_1_1GF.html#92df68dd5d84663cf20c21d1486aed48" title="set q=2^mvalue">set_size</a>(qvalue);
87<a name="l00084"></a>00084   }
88<a name="l00086"></a><a class="code" href="classitpp_1_1GF.html#009217ddab835ae84ee843fc328747a7">00086</a>   <a class="code" href="classitpp_1_1GF.html#009217ddab835ae84ee843fc328747a7" title="Constructor.">GF</a>(<span class="keywordtype">int</span> qvalue, <span class="keywordtype">int</span> inexp) { m = 0; <span class="keyword">set</span>(qvalue, inexp); }
89<a name="l00088"></a><a class="code" href="classitpp_1_1GF.html#babae7d9d1b114864d4b00322871512b">00088</a>   <a class="code" href="classitpp_1_1GF.html#babae7d9d1b114864d4b00322871512b" title="Copy constructor.">GF</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf) { m = ingf.<a class="code" href="classitpp_1_1GF.html#ba79886bc0f27aafc7695eb3cc717cbb">m</a>; value = ingf.<a class="code" href="classitpp_1_1GF.html#5bea19be83bae4e8a8408335ffaf2459">value</a>; }
90<a name="l00089"></a>00089
91<a name="l00091"></a><a class="code" href="classitpp_1_1GF.html#998f0a59e3bcc6274bd9a7974efa331a">00091</a>   <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keywordtype">int</span> qvalue, <span class="keywordtype">int</span> inexp) {
92<a name="l00092"></a>00092     <a class="code" href="classitpp_1_1GF.html#92df68dd5d84663cf20c21d1486aed48" title="set q=2^mvalue">set_size</a>(qvalue);
93<a name="l00093"></a>00093     <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(inexp &gt;= -1 &amp;&amp; inexp &lt; qvalue - 1, <span class="stringliteral">"GF::set, out of range"</span>);
94<a name="l00094"></a>00094     value = inexp;
95<a name="l00095"></a>00095   }
96<a name="l00101"></a>00101   <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keywordtype">int</span> qvalue, <span class="keyword">const</span> bvec &amp;vectorspace);
97<a name="l00103"></a>00103   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#92df68dd5d84663cf20c21d1486aed48" title="set q=2^mvalue">set_size</a>(<span class="keywordtype">int</span> qvalue);
98<a name="l00105"></a><a class="code" href="classitpp_1_1GF.html#3202541d083d2927dd8ab3f07b18fb59">00105</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF.html#3202541d083d2927dd8ab3f07b18fb59" title="Return q.">get_size</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> ((m != 0) ? q[m] : 0); }
99<a name="l00111"></a>00111   bvec <a class="code" href="classitpp_1_1GF.html#f9264d13f184870d06cb25aaf6c105b9" title="Returns the vector space representation of GF(q).">get_vectorspace</a>() <span class="keyword">const</span>;
100<a name="l00113"></a>00113   <span class="keywordtype">int</span>  <a class="code" href="classitpp_1_1GF.html#87beac57ebd7f597cd409b04af9d5920" title="Returns the alpha exponent.">get_value</a>() <span class="keyword">const</span>;
101<a name="l00115"></a>00115   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF.html#5a5ee69ed611dd6cada367cc241258f1" title="Equality check.">operator==</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf) <span class="keyword">const</span>;
102<a name="l00117"></a>00117   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF.html#126d10787539dff093bbc04a2456ecca" title="Not-equality check.">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf) <span class="keyword">const</span>;
103<a name="l00118"></a>00118
104<a name="l00120"></a>00120   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#6baaf62e11dd55e38a5917eaccda8002" title="GF(q) equals ingf.">operator=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf);
105<a name="l00122"></a>00122   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#6baaf62e11dd55e38a5917eaccda8002" title="GF(q) equals ingf.">operator=</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> inexp);
106<a name="l00124"></a>00124   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#e52540b90d82cc61f87ab440793919ad" title="sum of two GF(q)">operator+=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf);
107<a name="l00126"></a>00126   <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> <a class="code" href="classitpp_1_1GF.html#57c153da205a2b8362f03cbeaac7d2f5" title="sum of two GF(q)">operator+</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf) <span class="keyword">const</span>;
108<a name="l00128"></a>00128   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#77fd7d835894198e7f1d4e6f2df72545" title="Difference of two GF(q), same as sum for q=2^m.">operator-=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf);
109<a name="l00130"></a>00130   <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> <a class="code" href="classitpp_1_1GF.html#2d8c65c93ecd2e0fb66ec2db0e48d34c" title="Difference of two GF(q), same as sum for q=2^m.">operator-</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf) <span class="keyword">const</span>;
110<a name="l00132"></a>00132   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#92e4e4a8aef619814741f771d1e4fdfc" title="product of two GF(q)">operator*=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf);
111<a name="l00134"></a>00134   <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> <a class="code" href="classitpp_1_1GF.html#e6b155ed86bc5eb7bf5593a11fb41483" title="product of two GF(q)">operator*</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf) <span class="keyword">const</span>;
112<a name="l00136"></a>00136   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#b789a0bc8f1bd4130b87d01500c1606f" title="division of two GF(q)">operator/=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf);
113<a name="l00138"></a>00138   <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> <a class="code" href="classitpp_1_1GF.html#15d6722131ec097cc5051ab9ba3590cc" title="product of two GF(q)">operator/</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf) <span class="keyword">const</span>;
114<a name="l00140"></a>00140   <span class="keyword">friend</span> std::ostream &amp;<a class="code" href="classitpp_1_1GF.html#80fbd553165f964a5c4ffcf3c30c9388" title="Output stream for GF(q).">operator&lt;&lt;</a>(std::ostream &amp;os, <span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf);
115<a name="l00141"></a>00141 <span class="keyword">protected</span>:
116<a name="l00142"></a>00142 <span class="keyword">private</span>:
117<a name="l00143"></a>00143   <span class="keywordtype">char</span> m;
118<a name="l00144"></a>00144   <span class="keywordtype">int</span> value;
119<a name="l00145"></a>00145   <span class="keyword">static</span> <a class="code" href="classitpp_1_1Array.html" title="General array class.">Array&lt;Array&lt;int&gt;</a> &gt; alphapow, logalpha;
120<a name="l00146"></a>00146   <span class="keyword">static</span> ivec q;
121<a name="l00147"></a>00147 };
122<a name="l00148"></a>00148
123<a name="l00149"></a>00149 <span class="keyword">class </span>GFX;
124<a name="l00150"></a>00150
125<a name="l00152"></a>00152 GFX  <a class="code" href="group__fixed.html#g8bb80689611f7b6b0e36f5507d990af7" title="Fix * cfixmat.">operator*</a>(<span class="keyword">const</span> GF &amp;ingf, <span class="keyword">const</span> GFX &amp;ingfx);
126<a name="l00154"></a>00154 GFX  <a class="code" href="group__fixed.html#g8bb80689611f7b6b0e36f5507d990af7" title="Fix * cfixmat.">operator*</a>(<span class="keyword">const</span> GFX &amp;ingfx, <span class="keyword">const</span> GF &amp;ingf);
127<a name="l00156"></a>00156 GFX  <a class="code" href="group__fixed.html#ge9cc89e3b09f5b52ba4ae21d4b95aa96" title="cfixmat / Fix using quantization mode TRN ">operator/</a>(<span class="keyword">const</span> GFX &amp;ingfx, <span class="keyword">const</span> GF &amp;ingf);
128<a name="l00157"></a>00157
129<a name="l00161"></a><a class="code" href="classitpp_1_1GFX.html">00161</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a>
130<a name="l00162"></a>00162 {
131<a name="l00163"></a>00163 <span class="keyword">public</span>:
132<a name="l00165"></a>00165   <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX</a>();
133<a name="l00167"></a>00167   <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX</a>(<span class="keywordtype">int</span> qvalue);
134<a name="l00169"></a>00169   <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX</a>(<span class="keywordtype">int</span> qvalue, <span class="keywordtype">int</span> indegree);
135<a name="l00171"></a>00171   <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX</a>(<span class="keywordtype">int</span> qvalue, <span class="keyword">const</span> ivec &amp;invalues);
136<a name="l00173"></a>00173   <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX</a>(<span class="keywordtype">int</span> qvalue, <span class="keywordtype">char</span> *invalues);
137<a name="l00175"></a>00175   <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX</a>(<span class="keywordtype">int</span> qvalue, std::string invalues);
138<a name="l00177"></a>00177   <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx);
139<a name="l00179"></a>00179   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GFX.html#20b04988d216bbce3afde24e9272689b" title="Return q.">get_size</a>() <span class="keyword">const</span>;
140<a name="l00181"></a>00181   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GFX.html#026e7d2821548c432482f1c9027e6d60" title="Return degree of GF(q)[x].">get_degree</a>() <span class="keyword">const</span>;
141<a name="l00185"></a>00185   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#2216dce06324c4a29aa257ead1e4e861" title="Resize the polynomial to the given indegree. If the new polynomial is bigger, then...">set_degree</a>(<span class="keywordtype">int</span> indegree);
142<a name="l00187"></a>00187   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GFX.html#f7c49fa14c2f4c71454b51038fbbaa11" title="Return true degree of GF(q)[x].">get_true_degree</a>() <span class="keyword">const</span>;
143<a name="l00189"></a>00189   <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keywordtype">int</span> qvalue, <span class="keyword">const</span> <span class="keywordtype">char</span> *invalues);
144<a name="l00191"></a>00191   <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keywordtype">int</span> qvalue, <span class="keyword">const</span> std::string invalues);
145<a name="l00193"></a>00193   <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keywordtype">int</span> qvalue, <span class="keyword">const</span> ivec &amp;invalues);
146<a name="l00195"></a>00195   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#eb86e2d074f5a27a813a6979126d42f7" title="Set all coefficients to zero.">clear</a>();
147<a name="l00197"></a><a class="code" href="classitpp_1_1GFX.html#ad45023097f196e0758409792cc37e6d">00197</a>   <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> <a class="code" href="classitpp_1_1GFX.html#ad45023097f196e0758409792cc37e6d" title="Acces to individual element in the GF(q)[x] polynomial.">operator[]</a>(<span class="keywordtype">int</span> index)<span class="keyword"> const </span>{
148<a name="l00198"></a>00198     <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(index&lt;=degree, <span class="stringliteral">"GFX::op[], out of range"</span>);
149<a name="l00199"></a>00199     <span class="keywordflow">return</span> coeffs(index);
150<a name="l00200"></a>00200   }
151<a name="l00202"></a><a class="code" href="classitpp_1_1GFX.html#a321d62e13ff9bfae6bccd95bf711e57">00202</a>   <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;<a class="code" href="classitpp_1_1GFX.html#a321d62e13ff9bfae6bccd95bf711e57" title="Acces to individual element in the GF(q)[x] polynomial.">operator[]</a>(<span class="keywordtype">int</span> index) {
152<a name="l00203"></a>00203     <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(index&lt;=degree, <span class="stringliteral">"GFX::op[], out of range"</span>);
153<a name="l00204"></a>00204     <span class="keywordflow">return</span> coeffs(index);
154<a name="l00205"></a>00205   }
155<a name="l00207"></a>00207   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#30a703110a5a63c982e86c871b886f7b" title="Copy.">operator=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx);
156<a name="l00209"></a>00209   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#26b19e595008cd0c2ac35bed85441c47" title="sum of two GF(q)[x]">operator+=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx);
157<a name="l00211"></a>00211   <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> <a class="code" href="classitpp_1_1GFX.html#36bb9fd4b61039d49617996a51bcca34" title="sum of two GF(q)[x]">operator+</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx) <span class="keyword">const</span>;
158<a name="l00213"></a>00213   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#3b9c20d3a4a322b259b2320e77c8ba57" title="Difference of two GF(q), same as sum for q=2^m.">operator-=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx);
159<a name="l00215"></a>00215   <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> <a class="code" href="classitpp_1_1GFX.html#141347d3224a3c260d0af3b916550266" title="Difference of two GF(q), same as sum for q=2^m.">operator-</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx) <span class="keyword">const</span>;
160<a name="l00217"></a>00217   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#9b9445b6261b3fcf265eb9bbf7b710c5" title="product of two GF(q)[x]">operator*=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx);
161<a name="l00219"></a>00219   <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> <a class="code" href="classitpp_1_1GFX.html#df95c34b8c477b37eba7815880329dc5" title="product of two GF(q)[x]">operator*</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx) <span class="keyword">const</span>;
162<a name="l00221"></a>00221   <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> <a class="code" href="classitpp_1_1GFX.html#d94ad13cdec073d320b7bb8e0066ebbb" title="Evaluate polynom at alpha^inexp.">operator()</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf);
163<a name="l00223"></a>00223   <span class="keyword">friend</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a>  <a class="code" href="classitpp_1_1GFX.html#df95c34b8c477b37eba7815880329dc5" title="product of two GF(q)[x]">operator*</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf, <span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx);
164<a name="l00225"></a>00225   <span class="keyword">friend</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a>  <a class="code" href="classitpp_1_1GFX.html#df95c34b8c477b37eba7815880329dc5" title="product of two GF(q)[x]">operator*</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx, <span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf);
165<a name="l00227"></a>00227   <span class="keyword">friend</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a>  <a class="code" href="classitpp_1_1GFX.html#a19b8233ff486aeef5d45208a4f3bae9" title="Divide a GF(q)[x] with a GF element.">operator/</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx, <span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf);
166<a name="l00228"></a>00228
167<a name="l00230"></a>00230   <span class="keyword">friend</span> std::ostream &amp;<a class="code" href="classitpp_1_1GFX.html#7e5a9a71751a9629d101dbbf00bc88ae" title="Output stream.">operator&lt;&lt;</a>(std::ostream &amp;os, <span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx);
168<a name="l00231"></a>00231 <span class="keyword">protected</span>:
169<a name="l00232"></a>00232 <span class="keyword">private</span>:
170<a name="l00233"></a>00233   <span class="keywordtype">int</span> degree, q;
171<a name="l00234"></a>00234   <a class="code" href="classitpp_1_1Array.html">Array&lt;GF&gt;</a> coeffs;
172<a name="l00235"></a>00235 };
173<a name="l00236"></a>00236
174<a name="l00237"></a>00237 <span class="comment">//-------------- Help Functions ------------------</span>
175<a name="l00244"></a>00244 <span class="comment"></span>GFX divgfx(<span class="keyword">const</span> GFX &amp;c, <span class="keyword">const</span> GFX &amp;g);
176<a name="l00245"></a>00245
177<a name="l00250"></a>00250 GFX modgfx(<span class="keyword">const</span> GFX &amp;a, <span class="keyword">const</span> GFX &amp;b);
178<a name="l00251"></a>00251
179<a name="l00252"></a>00252
180<a name="l00253"></a>00253 <span class="comment">// --------------- Inlines ------------------------</span>
181<a name="l00254"></a>00254 <span class="comment">// --------------- class GF -----------------------</span>
182<a name="l00255"></a>00255
183<a name="l00256"></a><a class="code" href="classitpp_1_1GF.html#5e2187d93e23ec314f5932eb367be2a0">00256</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#998f0a59e3bcc6274bd9a7974efa331a" title="GF(q) equals alpha ^ inexp.">GF::set</a>(<span class="keywordtype">int</span> qvalue, <span class="keyword">const</span> bvec &amp;vectorspace)
184<a name="l00257"></a>00257 {
185<a name="l00258"></a>00258   <a class="code" href="classitpp_1_1GF.html#92df68dd5d84663cf20c21d1486aed48" title="set q=2^mvalue">set_size</a>(qvalue);
186<a name="l00259"></a>00259   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(vectorspace.length() == m, <span class="stringliteral">"GF::set, out of range"</span>);
187<a name="l00260"></a>00260   value = logalpha(m)(<a class="code" href="group__convertfunc.html#g698adf78bc0f9d36fd5987bc87d543fa" title="Convert a bvec to decimal int with the first bit as MSB if msb_first == true.">bin2dec</a>(vectorspace));
188<a name="l00261"></a>00261 }
189<a name="l00262"></a>00262
190<a name="l00263"></a><a class="code" href="classitpp_1_1GF.html#f9264d13f184870d06cb25aaf6c105b9">00263</a> <span class="keyword">inline</span> bvec <a class="code" href="classitpp_1_1GF.html#f9264d13f184870d06cb25aaf6c105b9" title="Returns the vector space representation of GF(q).">GF::get_vectorspace</a>()<span class="keyword"> const</span>
191<a name="l00264"></a>00264 <span class="keyword"></span>{
192<a name="l00265"></a>00265   bvec temp(m);
193<a name="l00266"></a>00266   <span class="keywordflow">if</span> (value == -1)
194<a name="l00267"></a>00267     temp = <a class="code" href="group__convertfunc.html#g83db366182e10eb823bcd5cb0149adf3" title="Convert a decimal int index to bvec with the first bit as MSB if msb_first == true...">dec2bin</a>(m, 0);
195<a name="l00268"></a>00268   <span class="keywordflow">else</span>
196<a name="l00269"></a>00269     temp = <a class="code" href="group__convertfunc.html#g83db366182e10eb823bcd5cb0149adf3" title="Convert a decimal int index to bvec with the first bit as MSB if msb_first == true...">dec2bin</a>(m, alphapow(m)(value));
197<a name="l00270"></a>00270   <span class="keywordflow">return</span> temp;
198<a name="l00271"></a>00271 }
199<a name="l00272"></a>00272
200<a name="l00273"></a><a class="code" href="classitpp_1_1GF.html#87beac57ebd7f597cd409b04af9d5920">00273</a> <span class="keyword">inline</span> <span class="keywordtype">int</span>  <a class="code" href="classitpp_1_1GF.html#87beac57ebd7f597cd409b04af9d5920" title="Returns the alpha exponent.">GF::get_value</a>()<span class="keyword"> const</span>
201<a name="l00274"></a>00274 <span class="keyword"></span>{
202<a name="l00275"></a>00275   <span class="keywordflow">return</span> value;
203<a name="l00276"></a>00276 }
204<a name="l00277"></a>00277
205<a name="l00278"></a><a class="code" href="classitpp_1_1GF.html#5a5ee69ed611dd6cada367cc241258f1">00278</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF.html#5a5ee69ed611dd6cada367cc241258f1" title="Equality check.">GF::operator==</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf)<span class="keyword"> const</span>
206<a name="l00279"></a>00279 <span class="keyword"></span>{
207<a name="l00280"></a>00280   <span class="keywordflow">if</span> (value == -1 &amp;&amp; ingf.<a class="code" href="classitpp_1_1GF.html#5bea19be83bae4e8a8408335ffaf2459">value</a> == -1)
208<a name="l00281"></a>00281     <span class="keywordflow">return</span> <span class="keyword">true</span>;
209<a name="l00282"></a>00282   <span class="keywordflow">if</span> (m == ingf.<a class="code" href="classitpp_1_1GF.html#ba79886bc0f27aafc7695eb3cc717cbb">m</a> &amp;&amp; value == ingf.<a class="code" href="classitpp_1_1GF.html#5bea19be83bae4e8a8408335ffaf2459">value</a>)
210<a name="l00283"></a>00283     <span class="keywordflow">return</span> <span class="keyword">true</span>;
211<a name="l00284"></a>00284   <span class="keywordflow">else</span>
212<a name="l00285"></a>00285     <span class="keywordflow">return</span> <span class="keyword">false</span>;
213<a name="l00286"></a>00286 }
214<a name="l00287"></a>00287
215<a name="l00288"></a><a class="code" href="classitpp_1_1GF.html#126d10787539dff093bbc04a2456ecca">00288</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF.html#126d10787539dff093bbc04a2456ecca" title="Not-equality check.">GF::operator!=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf)<span class="keyword"> const</span>
216<a name="l00289"></a>00289 <span class="keyword"></span>{
217<a name="l00290"></a>00290   <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> tmp(*<span class="keyword">this</span>);
218<a name="l00291"></a>00291   <span class="keywordflow">return</span> !(tmp == ingf);
219<a name="l00292"></a>00292 }
220<a name="l00293"></a>00293
221<a name="l00294"></a><a class="code" href="classitpp_1_1GF.html#6baaf62e11dd55e38a5917eaccda8002">00294</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#6baaf62e11dd55e38a5917eaccda8002" title="GF(q) equals ingf.">GF::operator=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf)
222<a name="l00295"></a>00295 {
223<a name="l00296"></a>00296   m = ingf.<a class="code" href="classitpp_1_1GF.html#ba79886bc0f27aafc7695eb3cc717cbb">m</a>;
224<a name="l00297"></a>00297   value = ingf.<a class="code" href="classitpp_1_1GF.html#5bea19be83bae4e8a8408335ffaf2459">value</a>;
225<a name="l00298"></a>00298 }
226<a name="l00299"></a>00299
227<a name="l00300"></a><a class="code" href="classitpp_1_1GF.html#8de4f28df9388592904f9cafc3ed13ed">00300</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#6baaf62e11dd55e38a5917eaccda8002" title="GF(q) equals ingf.">GF::operator=</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> inexp)
228<a name="l00301"></a>00301 {
229<a name="l00302"></a>00302   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(m &gt; 0 &amp;&amp; inexp &gt;= -1 &amp;&amp; inexp &lt; (q[m] - 1), <span class="stringliteral">"GF::op=, out of range"</span>);
230<a name="l00303"></a>00303   value = inexp;
231<a name="l00304"></a>00304 }
232<a name="l00305"></a>00305
233<a name="l00306"></a><a class="code" href="classitpp_1_1GF.html#e52540b90d82cc61f87ab440793919ad">00306</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#e52540b90d82cc61f87ab440793919ad" title="sum of two GF(q)">GF::operator+=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf)
234<a name="l00307"></a>00307 {
235<a name="l00308"></a>00308   <span class="keywordflow">if</span> (value == -1) {
236<a name="l00309"></a>00309     value = ingf.<a class="code" href="classitpp_1_1GF.html#5bea19be83bae4e8a8408335ffaf2459">value</a>;
237<a name="l00310"></a>00310     m = ingf.<a class="code" href="classitpp_1_1GF.html#ba79886bc0f27aafc7695eb3cc717cbb">m</a>;
238<a name="l00311"></a>00311   }
239<a name="l00312"></a>00312   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (ingf.<a class="code" href="classitpp_1_1GF.html#5bea19be83bae4e8a8408335ffaf2459">value</a> != -1) {
240<a name="l00313"></a>00313     <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(ingf.<a class="code" href="classitpp_1_1GF.html#ba79886bc0f27aafc7695eb3cc717cbb">m</a> == m, <span class="stringliteral">"GF::op+=, not same field"</span>);
241<a name="l00314"></a>00314     value = logalpha(m)(alphapow(m)(value) ^ alphapow(m)(ingf.<a class="code" href="classitpp_1_1GF.html#5bea19be83bae4e8a8408335ffaf2459">value</a>));
242<a name="l00315"></a>00315   }
243<a name="l00316"></a>00316 }
244<a name="l00317"></a>00317
245<a name="l00318"></a><a class="code" href="classitpp_1_1GF.html#57c153da205a2b8362f03cbeaac7d2f5">00318</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> <a class="code" href="classitpp_1_1GF.html#57c153da205a2b8362f03cbeaac7d2f5" title="sum of two GF(q)">GF::operator+</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf)<span class="keyword"> const</span>
246<a name="l00319"></a>00319 <span class="keyword"></span>{
247<a name="l00320"></a>00320   <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> tmp(*<span class="keyword">this</span>);
248<a name="l00321"></a>00321   tmp += ingf;
249<a name="l00322"></a>00322   <span class="keywordflow">return</span> tmp;
250<a name="l00323"></a>00323 }
251<a name="l00324"></a>00324
252<a name="l00325"></a><a class="code" href="classitpp_1_1GF.html#77fd7d835894198e7f1d4e6f2df72545">00325</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#77fd7d835894198e7f1d4e6f2df72545" title="Difference of two GF(q), same as sum for q=2^m.">GF::operator-=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf)
253<a name="l00326"></a>00326 {
254<a name="l00327"></a>00327   (*this) += ingf;
255<a name="l00328"></a>00328 }
256<a name="l00329"></a>00329
257<a name="l00330"></a><a class="code" href="classitpp_1_1GF.html#2d8c65c93ecd2e0fb66ec2db0e48d34c">00330</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> <a class="code" href="classitpp_1_1GF.html#2d8c65c93ecd2e0fb66ec2db0e48d34c" title="Difference of two GF(q), same as sum for q=2^m.">GF::operator-</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf)<span class="keyword"> const</span>
258<a name="l00331"></a>00331 <span class="keyword"></span>{
259<a name="l00332"></a>00332   <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> tmp(*<span class="keyword">this</span>);
260<a name="l00333"></a>00333   tmp -= ingf;
261<a name="l00334"></a>00334   <span class="keywordflow">return</span> tmp;
262<a name="l00335"></a>00335 }
263<a name="l00336"></a>00336
264<a name="l00337"></a><a class="code" href="classitpp_1_1GF.html#92e4e4a8aef619814741f771d1e4fdfc">00337</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#92e4e4a8aef619814741f771d1e4fdfc" title="product of two GF(q)">GF::operator*=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf)
265<a name="l00338"></a>00338 {
266<a name="l00339"></a>00339   <span class="keywordflow">if</span> (value == -1 || ingf.<a class="code" href="classitpp_1_1GF.html#5bea19be83bae4e8a8408335ffaf2459">value</a> == -1)
267<a name="l00340"></a>00340     value = -1;
268<a name="l00341"></a>00341   <span class="keywordflow">else</span> {
269<a name="l00342"></a>00342     <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(ingf.<a class="code" href="classitpp_1_1GF.html#ba79886bc0f27aafc7695eb3cc717cbb">m</a> == m, <span class="stringliteral">"GF::op+=, not same field"</span>);
270<a name="l00343"></a>00343     value = (value + ingf.<a class="code" href="classitpp_1_1GF.html#5bea19be83bae4e8a8408335ffaf2459">value</a>) % (q[m] - 1);
271<a name="l00344"></a>00344   }
272<a name="l00345"></a>00345 }
273<a name="l00346"></a>00346
274<a name="l00347"></a><a class="code" href="classitpp_1_1GF.html#e6b155ed86bc5eb7bf5593a11fb41483">00347</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> <a class="code" href="classitpp_1_1GF.html#e6b155ed86bc5eb7bf5593a11fb41483" title="product of two GF(q)">GF::operator*</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf)<span class="keyword"> const</span>
275<a name="l00348"></a>00348 <span class="keyword"></span>{
276<a name="l00349"></a>00349   <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> tmp(*<span class="keyword">this</span>);
277<a name="l00350"></a>00350   tmp *= ingf;
278<a name="l00351"></a>00351   <span class="keywordflow">return</span> tmp;
279<a name="l00352"></a>00352 }
280<a name="l00353"></a>00353
281<a name="l00354"></a><a class="code" href="classitpp_1_1GF.html#b789a0bc8f1bd4130b87d01500c1606f">00354</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF.html#b789a0bc8f1bd4130b87d01500c1606f" title="division of two GF(q)">GF::operator/=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf)
282<a name="l00355"></a>00355 {
283<a name="l00356"></a>00356   <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(ingf.<a class="code" href="classitpp_1_1GF.html#5bea19be83bae4e8a8408335ffaf2459">value</a> != -1, <span class="stringliteral">"GF::operator/: division by zero element"</span>); <span class="comment">// no division by the zeroth element</span>
284<a name="l00357"></a>00357   <span class="keywordflow">if</span> (value == -1)
285<a name="l00358"></a>00358     value = -1;
286<a name="l00359"></a>00359   <span class="keywordflow">else</span> {
287<a name="l00360"></a>00360     <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(ingf.<a class="code" href="classitpp_1_1GF.html#ba79886bc0f27aafc7695eb3cc717cbb">m</a> == m, <span class="stringliteral">"GF::op+=, not same field"</span>);
288<a name="l00361"></a>00361     value = (value - ingf.<a class="code" href="classitpp_1_1GF.html#5bea19be83bae4e8a8408335ffaf2459">value</a> + q[m] - 1) % (q[m] - 1);
289<a name="l00362"></a>00362   }
290<a name="l00363"></a>00363 }
291<a name="l00364"></a>00364
292<a name="l00365"></a><a class="code" href="classitpp_1_1GF.html#15d6722131ec097cc5051ab9ba3590cc">00365</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> <a class="code" href="classitpp_1_1GF.html#15d6722131ec097cc5051ab9ba3590cc" title="product of two GF(q)">GF::operator/</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf)<span class="keyword"> const</span>
293<a name="l00366"></a>00366 <span class="keyword"></span>{
294<a name="l00367"></a>00367   <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> tmp(*<span class="keyword">this</span>);
295<a name="l00368"></a>00368   tmp /= ingf;
296<a name="l00369"></a>00369   <span class="keywordflow">return</span> tmp;
297<a name="l00370"></a>00370 }
298<a name="l00371"></a>00371
299<a name="l00372"></a>00372 <span class="comment">// ------------------ class GFX --------------------</span>
300<a name="l00373"></a><a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a">00373</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX::GFX</a>()
301<a name="l00374"></a>00374 {
302<a name="l00375"></a>00375   degree = -1;
303<a name="l00376"></a>00376   q = 0;
304<a name="l00377"></a>00377 }
305<a name="l00378"></a>00378
306<a name="l00379"></a><a class="code" href="classitpp_1_1GFX.html#5d9c90e5659ad379db519573a87296dd">00379</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX::GFX</a>(<span class="keywordtype">int</span> qvalue)
307<a name="l00380"></a>00380 {
308<a name="l00381"></a>00381   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(qvalue &gt;= 0, <span class="stringliteral">"GFX::GFX, out of range"</span>);
309<a name="l00382"></a>00382   q = qvalue;
310<a name="l00383"></a>00383 }
311<a name="l00384"></a>00384
312<a name="l00385"></a><a class="code" href="classitpp_1_1GFX.html#9ff4dc76b4be004093065301f73b9b7a">00385</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#552d36be9e73166549b951dc6844e267" title="Set the GF(q)[x] polynomial.">GFX::set</a>(<span class="keywordtype">int</span> qvalue, <span class="keyword">const</span> ivec &amp;invalues)
313<a name="l00386"></a>00386 {
314<a name="l00387"></a>00387   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(qvalue &gt; 0, <span class="stringliteral">"GFX::set, out of range"</span>);
315<a name="l00388"></a>00388   degree = invalues.size() - 1;
316<a name="l00389"></a>00389   coeffs.<a class="code" href="classitpp_1_1Array.html#dbf76c71f29014a4d53f254e83f3ff1c" title="Resizing an Array&amp;lt;T&amp;gt;.">set_size</a>(degree + 1, <span class="keyword">false</span>);
317<a name="l00390"></a>00390   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0;i &lt; degree + 1;i++)
318<a name="l00391"></a>00391     coeffs(i).set(qvalue, invalues(i));
319<a name="l00392"></a>00392   q = qvalue;
320<a name="l00393"></a>00393 }
321<a name="l00394"></a>00394
322<a name="l00395"></a><a class="code" href="classitpp_1_1GFX.html#552d36be9e73166549b951dc6844e267">00395</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#552d36be9e73166549b951dc6844e267" title="Set the GF(q)[x] polynomial.">GFX::set</a>(<span class="keywordtype">int</span> qvalue, <span class="keyword">const</span> <span class="keywordtype">char</span> *invalues)
323<a name="l00396"></a>00396 {
324<a name="l00397"></a>00397   <span class="keyword">set</span>(qvalue, ivec(invalues));
325<a name="l00398"></a>00398 }
326<a name="l00399"></a>00399
327<a name="l00400"></a><a class="code" href="classitpp_1_1GFX.html#e1d85ae328e447883f63a19f5067c2ad">00400</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#552d36be9e73166549b951dc6844e267" title="Set the GF(q)[x] polynomial.">GFX::set</a>(<span class="keywordtype">int</span> qvalue, <span class="keyword">const</span> std::string invalues)
328<a name="l00401"></a>00401 {
329<a name="l00402"></a>00402   <span class="keyword">set</span>(qvalue, invalues.c_str());
330<a name="l00403"></a>00403 }
331<a name="l00404"></a>00404
332<a name="l00405"></a><a class="code" href="classitpp_1_1GFX.html#92d24d827cac8fe92ce7f1287b9e3128">00405</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX::GFX</a>(<span class="keywordtype">int</span> qvalue, <span class="keywordtype">int</span> indegree)
333<a name="l00406"></a>00406 {
334<a name="l00407"></a>00407   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(qvalue &gt; 0 &amp;&amp; indegree &gt;= 0, <span class="stringliteral">"GFX::GFX, out of range"</span>);
335<a name="l00408"></a>00408   q = qvalue;
336<a name="l00409"></a>00409   coeffs.<a class="code" href="classitpp_1_1Array.html#dbf76c71f29014a4d53f254e83f3ff1c" title="Resizing an Array&amp;lt;T&amp;gt;.">set_size</a>(indegree + 1, <span class="keyword">false</span>);
337<a name="l00410"></a>00410   degree = indegree;
338<a name="l00411"></a>00411   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0;i &lt; degree + 1;i++)
339<a name="l00412"></a>00412     coeffs(i).set(q, -1);
340<a name="l00413"></a>00413 }
341<a name="l00414"></a><a class="code" href="classitpp_1_1GFX.html#83a867c640e05741f117f060130fcfc5">00414</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX::GFX</a>(<span class="keywordtype">int</span> qvalue, <span class="keyword">const</span> ivec &amp;invalues)
342<a name="l00415"></a>00415 {
343<a name="l00416"></a>00416   <span class="keyword">set</span>(qvalue, invalues);
344<a name="l00417"></a>00417 }
345<a name="l00418"></a>00418
346<a name="l00419"></a><a class="code" href="classitpp_1_1GFX.html#5122f2a383543549df2bb8b9d57b3c00">00419</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX::GFX</a>(<span class="keywordtype">int</span> qvalue, <span class="keywordtype">char</span> *invalues)
347<a name="l00420"></a>00420 {
348<a name="l00421"></a>00421   <span class="keyword">set</span>(qvalue, invalues);
349<a name="l00422"></a>00422 }
350<a name="l00423"></a>00423
351<a name="l00424"></a><a class="code" href="classitpp_1_1GFX.html#bd94a28eb35d7d87578579411f1bfdc8">00424</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX::GFX</a>(<span class="keywordtype">int</span> qvalue, std::string invalues)
352<a name="l00425"></a>00425 {
353<a name="l00426"></a>00426   <span class="keyword">set</span>(qvalue, invalues.c_str());
354<a name="l00427"></a>00427 }
355<a name="l00428"></a>00428
356<a name="l00429"></a><a class="code" href="classitpp_1_1GFX.html#6065d3563557772c2480d05c9324f951">00429</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GFX.html#39afc4f1b77a1530e29366587407244a" title="Constructor.">GFX::GFX</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx)
357<a name="l00430"></a>00430 {
358<a name="l00431"></a>00431   degree = ingfx.<a class="code" href="classitpp_1_1GFX.html#947724f8e48cdbabe4538b04e7f15535">degree</a>;
359<a name="l00432"></a>00432   coeffs = ingfx.<a class="code" href="classitpp_1_1GFX.html#c60ab50e07512fd1e38b0f2cabe888da">coeffs</a>;
360<a name="l00433"></a>00433   q = ingfx.<a class="code" href="classitpp_1_1GFX.html#249b7e1f3cb2a9df1a2152e0a5630318">q</a>;
361<a name="l00434"></a>00434 }
362<a name="l00435"></a>00435
363<a name="l00436"></a><a class="code" href="classitpp_1_1GFX.html#20b04988d216bbce3afde24e9272689b">00436</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GFX.html#20b04988d216bbce3afde24e9272689b" title="Return q.">GFX::get_size</a>()<span class="keyword"> const</span>
364<a name="l00437"></a>00437 <span class="keyword"></span>{
365<a name="l00438"></a>00438   <span class="keywordflow">return</span> q;
366<a name="l00439"></a>00439 }
367<a name="l00440"></a>00440
368<a name="l00441"></a><a class="code" href="classitpp_1_1GFX.html#026e7d2821548c432482f1c9027e6d60">00441</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GFX.html#026e7d2821548c432482f1c9027e6d60" title="Return degree of GF(q)[x].">GFX::get_degree</a>()<span class="keyword"> const</span>
369<a name="l00442"></a>00442 <span class="keyword"></span>{
370<a name="l00443"></a>00443   <span class="keywordflow">return</span> degree;
371<a name="l00444"></a>00444 }
372<a name="l00445"></a>00445
373<a name="l00446"></a><a class="code" href="classitpp_1_1GFX.html#2216dce06324c4a29aa257ead1e4e861">00446</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#2216dce06324c4a29aa257ead1e4e861" title="Resize the polynomial to the given indegree. If the new polynomial is bigger, then...">GFX::set_degree</a>(<span class="keywordtype">int</span> indegree)
374<a name="l00447"></a>00447 {
375<a name="l00448"></a>00448   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(indegree &gt;= -1, <span class="stringliteral">"GFX::set_degree, out of range"</span>);
376<a name="l00449"></a>00449   coeffs.<a class="code" href="classitpp_1_1Array.html#dbf76c71f29014a4d53f254e83f3ff1c" title="Resizing an Array&amp;lt;T&amp;gt;.">set_size</a>(indegree + 1);
377<a name="l00450"></a>00450   degree = indegree;
378<a name="l00451"></a>00451 }
379<a name="l00452"></a>00452
380<a name="l00453"></a><a class="code" href="classitpp_1_1GFX.html#f7c49fa14c2f4c71454b51038fbbaa11">00453</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GFX.html#f7c49fa14c2f4c71454b51038fbbaa11" title="Return true degree of GF(q)[x].">GFX::get_true_degree</a>()<span class="keyword"> const</span>
381<a name="l00454"></a>00454 <span class="keyword"></span>{
382<a name="l00455"></a>00455   <span class="keywordtype">int</span> i = degree;
383<a name="l00456"></a>00456   <span class="keywordflow">while</span> (coeffs(i).get_value() == -1) {
384<a name="l00457"></a>00457     i--;
385<a name="l00458"></a>00458     <span class="keywordflow">if</span> (i == -1)
386<a name="l00459"></a>00459       <span class="keywordflow">break</span>;
387<a name="l00460"></a>00460   }
388<a name="l00461"></a>00461   <span class="keywordflow">return</span> i;
389<a name="l00462"></a>00462 }
390<a name="l00463"></a>00463
391<a name="l00464"></a><a class="code" href="classitpp_1_1GFX.html#eb86e2d074f5a27a813a6979126d42f7">00464</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#eb86e2d074f5a27a813a6979126d42f7" title="Set all coefficients to zero.">GFX::clear</a>()
392<a name="l00465"></a>00465 {
393<a name="l00466"></a>00466   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(degree &gt;= 0 &amp;&amp; q &gt; 0, <span class="stringliteral">"GFX::clear, not set"</span>);
394<a name="l00467"></a>00467   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0;i &lt; degree + 1;i++)
395<a name="l00468"></a>00468     coeffs(i).set(q, -1);
396<a name="l00469"></a>00469 }
397<a name="l00470"></a>00470
398<a name="l00471"></a><a class="code" href="classitpp_1_1GFX.html#30a703110a5a63c982e86c871b886f7b">00471</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#30a703110a5a63c982e86c871b886f7b" title="Copy.">GFX::operator=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx)
399<a name="l00472"></a>00472 {
400<a name="l00473"></a>00473   degree = ingfx.<a class="code" href="classitpp_1_1GFX.html#947724f8e48cdbabe4538b04e7f15535">degree</a>;
401<a name="l00474"></a>00474   coeffs = ingfx.<a class="code" href="classitpp_1_1GFX.html#c60ab50e07512fd1e38b0f2cabe888da">coeffs</a>;
402<a name="l00475"></a>00475   q = ingfx.<a class="code" href="classitpp_1_1GFX.html#249b7e1f3cb2a9df1a2152e0a5630318">q</a>;
403<a name="l00476"></a>00476 }
404<a name="l00477"></a>00477
405<a name="l00478"></a><a class="code" href="classitpp_1_1GFX.html#26b19e595008cd0c2ac35bed85441c47">00478</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#26b19e595008cd0c2ac35bed85441c47" title="sum of two GF(q)[x]">GFX::operator+=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx)
406<a name="l00479"></a>00479 {
407<a name="l00480"></a>00480   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(q == ingfx.<a class="code" href="classitpp_1_1GFX.html#249b7e1f3cb2a9df1a2152e0a5630318">q</a>, <span class="stringliteral">"GFX::op+=, not same field"</span>);
408<a name="l00481"></a>00481   <span class="keywordflow">if</span> (ingfx.<a class="code" href="classitpp_1_1GFX.html#947724f8e48cdbabe4538b04e7f15535">degree</a> &gt; degree) {
409<a name="l00482"></a>00482     coeffs.<a class="code" href="classitpp_1_1Array.html#dbf76c71f29014a4d53f254e83f3ff1c" title="Resizing an Array&amp;lt;T&amp;gt;.">set_size</a>(ingfx.<a class="code" href="classitpp_1_1GFX.html#947724f8e48cdbabe4538b04e7f15535">degree</a> + 1, <span class="keyword">true</span>);
410<a name="l00483"></a>00483     <span class="comment">// set new coefficients to the zeroth element</span>
411<a name="l00484"></a>00484     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = degree + 1; j &lt; coeffs.<a class="code" href="classitpp_1_1Array.html#ce6bb3089de6f3ff86806d78f35505a4" title="Returns the number of data elements in the array object.">size</a>(); j++) { coeffs(j).set(q, -1); }
412<a name="l00485"></a>00485     degree = ingfx.<a class="code" href="classitpp_1_1GFX.html#947724f8e48cdbabe4538b04e7f15535">degree</a>;
413<a name="l00486"></a>00486   }
414<a name="l00487"></a>00487   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0;i &lt; ingfx.<a class="code" href="classitpp_1_1GFX.html#947724f8e48cdbabe4538b04e7f15535">degree</a> + 1;i++) { coeffs(i) += ingfx.<a class="code" href="classitpp_1_1GFX.html#c60ab50e07512fd1e38b0f2cabe888da">coeffs</a>(i); }
415<a name="l00488"></a>00488 }
416<a name="l00489"></a>00489
417<a name="l00490"></a><a class="code" href="classitpp_1_1GFX.html#36bb9fd4b61039d49617996a51bcca34">00490</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> <a class="code" href="classitpp_1_1GFX.html#36bb9fd4b61039d49617996a51bcca34" title="sum of two GF(q)[x]">GFX::operator+</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx)<span class="keyword"> const</span>
418<a name="l00491"></a>00491 <span class="keyword"></span>{
419<a name="l00492"></a>00492   <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> tmp(*<span class="keyword">this</span>);
420<a name="l00493"></a>00493   tmp += ingfx;
421<a name="l00494"></a>00494   <span class="keywordflow">return</span> tmp;
422<a name="l00495"></a>00495 }
423<a name="l00496"></a>00496
424<a name="l00497"></a><a class="code" href="classitpp_1_1GFX.html#3b9c20d3a4a322b259b2320e77c8ba57">00497</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#3b9c20d3a4a322b259b2320e77c8ba57" title="Difference of two GF(q), same as sum for q=2^m.">GFX::operator-=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx)
425<a name="l00498"></a>00498 {
426<a name="l00499"></a>00499   (*this) += ingfx;
427<a name="l00500"></a>00500 }
428<a name="l00501"></a>00501
429<a name="l00502"></a><a class="code" href="classitpp_1_1GFX.html#141347d3224a3c260d0af3b916550266">00502</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> <a class="code" href="classitpp_1_1GFX.html#141347d3224a3c260d0af3b916550266" title="Difference of two GF(q), same as sum for q=2^m.">GFX::operator-</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx)<span class="keyword"> const</span>
430<a name="l00503"></a>00503 <span class="keyword"></span>{
431<a name="l00504"></a>00504   <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> tmp(*<span class="keyword">this</span>);
432<a name="l00505"></a>00505   tmp -= ingfx;
433<a name="l00506"></a>00506   <span class="keywordflow">return</span> tmp;
434<a name="l00507"></a>00507 }
435<a name="l00508"></a>00508
436<a name="l00509"></a><a class="code" href="classitpp_1_1GFX.html#9b9445b6261b3fcf265eb9bbf7b710c5">00509</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GFX.html#9b9445b6261b3fcf265eb9bbf7b710c5" title="product of two GF(q)[x]">GFX::operator*=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx)
437<a name="l00510"></a>00510 {
438<a name="l00511"></a>00511   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(q == ingfx.<a class="code" href="classitpp_1_1GFX.html#249b7e1f3cb2a9df1a2152e0a5630318">q</a>, <span class="stringliteral">"GFX::op*=, Not same field"</span>);
439<a name="l00512"></a>00512   <span class="keywordtype">int</span> i, j;
440<a name="l00513"></a>00513   <a class="code" href="classitpp_1_1Array.html">Array&lt;GF&gt;</a> tempcoeffs = coeffs;
441<a name="l00514"></a>00514   coeffs.<a class="code" href="classitpp_1_1Array.html#dbf76c71f29014a4d53f254e83f3ff1c" title="Resizing an Array&amp;lt;T&amp;gt;.">set_size</a>(degree + ingfx.<a class="code" href="classitpp_1_1GFX.html#947724f8e48cdbabe4538b04e7f15535">degree</a> + 1, <span class="keyword">false</span>);
442<a name="l00515"></a>00515   <span class="keywordflow">for</span> (j = 0; j &lt; coeffs.<a class="code" href="classitpp_1_1Array.html#ce6bb3089de6f3ff86806d78f35505a4" title="Returns the number of data elements in the array object.">size</a>(); j++)
443<a name="l00516"></a>00516     coeffs(j).set(q, -1); <span class="comment">// set coefficients to the zeroth element (log(0)=-Inf=-1)</span>
444<a name="l00517"></a>00517   <span class="keywordflow">for</span> (i = 0;i &lt; degree + 1;i++)
445<a name="l00518"></a>00518     <span class="keywordflow">for</span> (j = 0;j &lt; ingfx.<a class="code" href="classitpp_1_1GFX.html#947724f8e48cdbabe4538b04e7f15535">degree</a> + 1;j++)
446<a name="l00519"></a>00519       coeffs(i + j) += tempcoeffs(i) * ingfx.<a class="code" href="classitpp_1_1GFX.html#c60ab50e07512fd1e38b0f2cabe888da">coeffs</a>(j);
447<a name="l00520"></a>00520   degree = coeffs.<a class="code" href="classitpp_1_1Array.html#ce6bb3089de6f3ff86806d78f35505a4" title="Returns the number of data elements in the array object.">size</a>() - 1;
448<a name="l00521"></a>00521 }
449<a name="l00522"></a>00522
450<a name="l00523"></a><a class="code" href="classitpp_1_1GFX.html#df95c34b8c477b37eba7815880329dc5">00523</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> <a class="code" href="classitpp_1_1GFX.html#df95c34b8c477b37eba7815880329dc5" title="product of two GF(q)[x]">GFX::operator*</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx)<span class="keyword"> const</span>
451<a name="l00524"></a>00524 <span class="keyword"></span>{
452<a name="l00525"></a>00525   <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> tmp(*<span class="keyword">this</span>);
453<a name="l00526"></a>00526   tmp *= ingfx;
454<a name="l00527"></a>00527   <span class="keywordflow">return</span> tmp;
455<a name="l00528"></a>00528 }
456<a name="l00529"></a>00529
457<a name="l00530"></a>00530 <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> <a class="code" href="group__fixed.html#g8bb80689611f7b6b0e36f5507d990af7" title="Fix * cfixmat.">operator*</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf, <span class="keyword">const</span> <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> &amp;ingfx)
458<a name="l00531"></a>00531 {
459<a name="l00532"></a>00532   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(ingf.<a class="code" href="classitpp_1_1GF.html#3202541d083d2927dd8ab3f07b18fb59" title="Return q.">get_size</a>() == ingfx.<a class="code" href="classitpp_1_1GFX.html#249b7e1f3cb2a9df1a2152e0a5630318">q</a>, <span class="stringliteral">"GFX::op*, Not same field"</span>);
460<a name="l00533"></a>00533   <a class="code" href="classitpp_1_1GFX.html" title="Polynomials over GF(q)[x], where q=2^m, m=1,...,16.">GFX</a> temp(ingfx);
461<a name="l00534"></a>00534   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0;i &lt; ingfx.<a class="code" href="classitpp_1_1GFX.html#947724f8e48cdbabe4538b04e7f15535">degree</a> + 1;i++)
462<a name="l00535"></a>00535     temp.coeffs(i) *= ingf;
463<a name="l00536"></a>00536   <span class="keywordflow">return</span> temp;
464<a name="l00537"></a>00537 }
465<a name="l00538"></a>00538
466<a name="l00539"></a>00539 <span class="keyword">inline</span> GFX  <a class="code" href="group__fixed.html#g8bb80689611f7b6b0e36f5507d990af7" title="Fix * cfixmat.">operator*</a>(<span class="keyword">const</span> GFX &amp;ingfx, <span class="keyword">const</span> GF &amp;ingf)
467<a name="l00540"></a>00540 {
468<a name="l00541"></a>00541   <span class="keywordflow">return</span> ingf*ingfx;
469<a name="l00542"></a>00542 }
470<a name="l00543"></a>00543
471<a name="l00544"></a>00544 <span class="keyword">inline</span> GFX  <a class="code" href="group__fixed.html#ge9cc89e3b09f5b52ba4ae21d4b95aa96" title="cfixmat / Fix using quantization mode TRN ">operator/</a>(<span class="keyword">const</span> GFX &amp;ingfx, <span class="keyword">const</span> GF &amp;ingf)
472<a name="l00545"></a>00545 {
473<a name="l00546"></a>00546   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(ingf.get_size() == ingfx.q, <span class="stringliteral">"GFX::op/, Not same field"</span>);
474<a name="l00547"></a>00547   GFX temp(ingfx);
475<a name="l00548"></a>00548   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0;i &lt; ingfx.degree + 1;i++)
476<a name="l00549"></a>00549     temp.coeffs(i) /= ingf;
477<a name="l00550"></a>00550   <span class="keywordflow">return</span> temp;
478<a name="l00551"></a>00551 }
479<a name="l00552"></a>00552
480<a name="l00553"></a><a class="code" href="classitpp_1_1GFX.html#d94ad13cdec073d320b7bb8e0066ebbb">00553</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> <a class="code" href="classitpp_1_1GFX.html#d94ad13cdec073d320b7bb8e0066ebbb" title="Evaluate polynom at alpha^inexp.">GFX::operator()</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> &amp;ingf)
481<a name="l00554"></a>00554 {
482<a name="l00555"></a>00555   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(q == ingf.<a class="code" href="classitpp_1_1GF.html#3202541d083d2927dd8ab3f07b18fb59" title="Return q.">get_size</a>(), <span class="stringliteral">"GFX::op(), Not same field"</span>);
483<a name="l00556"></a>00556   <a class="code" href="classitpp_1_1GF.html" title="Galois Field GF(q).">GF</a> temp(coeffs(0)), ingfpower(ingf);
484<a name="l00557"></a>00557   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 1; i &lt; degree + 1; i++) {
485<a name="l00558"></a>00558     temp += coeffs(i) * ingfpower;
486<a name="l00559"></a>00559     ingfpower *= ingf;
487<a name="l00560"></a>00560   }
488<a name="l00561"></a>00561   <span class="keywordflow">return</span> temp;
489<a name="l00562"></a>00562 }
490<a name="l00563"></a>00563
491<a name="l00564"></a>00564 } <span class="comment">// namespace itpp</span>
492<a name="l00565"></a>00565
493<a name="l00566"></a>00566 <span class="preprocessor">#endif // #ifndef GALOIS_H</span>
494</pre></div></div>
495<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:11 2009 for mixpp by&nbsp;
496<a href="http://www.doxygen.org/index.html">
497<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
498</body>
499</html>
Note: See TracBrowser for help on using the browser.