[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: gf2mat.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 | <!-- |
---|
| 10 | function 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 | } |
---|
| 22 | function 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 | } |
---|
| 46 | window.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 Page</span></a></li> |
---|
| 53 | <li><a href="pages.html"><span>Related 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 List</span></a></li> |
---|
| 62 | <li><a href="globals.html"><span>File Members</span></a></li> |
---|
| 63 | </ul> |
---|
| 64 | </div> |
---|
| 65 | <h1>gf2mat.h</h1><a href="gf2mat_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 |
---|
| 66 | <a name="l00042"></a>00042 <span class="preprocessor">#ifndef GF2MAT_H</span> |
---|
| 67 | <a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#define GF2MAT_H</span> |
---|
| 68 | <a name="l00044"></a>00044 <span class="preprocessor"></span> |
---|
| 69 | <a name="l00045"></a>00045 <span class="preprocessor">#include <<a class="code" href="vec_8h.html" title="Templated Vector Class Definitions.">itpp/base/vec.h</a>></span> |
---|
| 70 | <a name="l00046"></a>00046 <span class="preprocessor">#include <<a class="code" href="mat_8h.html" title="Matrix Class Definitions.">itpp/base/mat.h</a>></span> |
---|
| 71 | <a name="l00047"></a>00047 <span class="preprocessor">#include <<a class="code" href="svec_8h.html" title="Sparse Vector Class definitions.">itpp/base/svec.h</a>></span> |
---|
| 72 | <a name="l00048"></a>00048 <span class="preprocessor">#include <<a class="code" href="smat_8h.html" title="Sparse Matrix Class Definitions.">itpp/base/smat.h</a>></span> |
---|
| 73 | <a name="l00049"></a>00049 <span class="preprocessor">#include <<a class="code" href="itfile_8h.html" title="Definition of classes for the IT++ file format.">itpp/base/itfile.h</a>></span> |
---|
| 74 | <a name="l00050"></a>00050 |
---|
| 75 | <a name="l00051"></a>00051 |
---|
| 76 | <a name="l00052"></a>00052 <span class="keyword">namespace </span>itpp |
---|
| 77 | <a name="l00053"></a>00053 { |
---|
| 78 | <a name="l00054"></a>00054 |
---|
| 79 | <a name="l00055"></a>00055 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 80 | <a name="l00056"></a>00056 <span class="comment">// Sparse GF(2) matrix class</span> |
---|
| 81 | <a name="l00057"></a>00057 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 82 | <a name="l00058"></a>00058 |
---|
| 83 | <a name="l00060"></a>00060 <span class="keyword">typedef</span> Sparse_Vec<bin> GF2vec_sparse; |
---|
| 84 | <a name="l00061"></a>00061 |
---|
| 85 | <a name="l00063"></a>00063 <span class="keyword">typedef</span> Sparse_Mat<bin> GF2mat_sparse; |
---|
| 86 | <a name="l00064"></a>00064 |
---|
| 87 | <a name="l00065"></a>00065 |
---|
| 88 | <a name="l00066"></a>00066 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 89 | <a name="l00067"></a>00067 <span class="comment">// Alist parameterization of sparse GF(2) matrix class</span> |
---|
| 90 | <a name="l00068"></a>00068 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 91 | <a name="l00069"></a>00069 |
---|
| 92 | <a name="l00084"></a><a class="code" href="classitpp_1_1GF2mat__sparse__alist.html">00084</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1GF2mat__sparse__alist.html" title="Parameterized &quot;alist&quot; representation of sparse GF(2) matrix.">GF2mat_sparse_alist</a> |
---|
| 93 | <a name="l00085"></a>00085 { |
---|
| 94 | <a name="l00086"></a>00086 <span class="keyword">public</span>: |
---|
| 95 | <a name="l00088"></a><a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#c058d66758b5076f711421bef945061e">00088</a> <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#c058d66758b5076f711421bef945061e" title="Default constructor.">GF2mat_sparse_alist</a>() : <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#ff9879ed9038a9f433a4ba75132a256e" title="Flag indicating that &quot;alist&quot; matrix data are properly set.">data_ok</a>(false) {} |
---|
| 96 | <a name="l00090"></a>00090 <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#c058d66758b5076f711421bef945061e" title="Default constructor.">GF2mat_sparse_alist</a>(<span class="keyword">const</span> std::string &fname); |
---|
| 97 | <a name="l00091"></a>00091 |
---|
| 98 | <a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#676b89278f1fbed07232bb8e06bb8786" title="Read alist data from a file named fname.">read</a>(<span class="keyword">const</span> std::string &fname); |
---|
| 99 | <a name="l00095"></a>00095 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#4f246f48dd50505b24571f4c96da131a" title="Write alist data to a file named fname.">write</a>(<span class="keyword">const</span> std::string &fname) <span class="keyword">const</span>; |
---|
| 100 | <a name="l00096"></a>00096 |
---|
| 101 | <a name="l00103"></a>00103 <a class="code" href="classitpp_1_1Sparse__Mat.html">GF2mat_sparse</a> <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#c72be60c1521e9041f28d9fb366440ac" title="Convert &quot;alist&quot; representation to GF2mat_sparse.">to_sparse</a>(<span class="keywordtype">bool</span> transpose = <span class="keyword">false</span>) <span class="keyword">const</span>; |
---|
| 102 | <a name="l00104"></a>00104 |
---|
| 103 | <a name="l00112"></a>00112 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#a7372759f1bb26b018f8a347407b53c1" title="Import &quot;alist&quot; representation from GF2mat_sparse.">from_sparse</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Sparse__Mat.html">GF2mat_sparse</a> &mat, <span class="keywordtype">bool</span> transpose = <span class="keyword">false</span>); |
---|
| 104 | <a name="l00113"></a>00113 |
---|
| 105 | <a name="l00114"></a>00114 <span class="keyword">protected</span>: |
---|
| 106 | <a name="l00116"></a><a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#ff9879ed9038a9f433a4ba75132a256e">00116</a> <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#ff9879ed9038a9f433a4ba75132a256e" title="Flag indicating that &quot;alist&quot; matrix data are properly set.">data_ok</a>; |
---|
| 107 | <a name="l00118"></a><a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#271af063051df8084f6352de7f43d64d">00118</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#271af063051df8084f6352de7f43d64d" title="Size of the matrix: M rows x N columns.">M</a>; |
---|
| 108 | <a name="l00120"></a><a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#8566797678b1b65e65fd2f89c5d56ce5">00120</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#8566797678b1b65e65fd2f89c5d56ce5" title="Size of the matrix: M rows x N columns.">N</a>; |
---|
| 109 | <a name="l00122"></a><a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#28c56d18a7b72de1c3708d125660aef6">00122</a> imat <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#28c56d18a7b72de1c3708d125660aef6" title="List of integer coordinates in the m direction with non-zero entries.">mlist</a>; |
---|
| 110 | <a name="l00124"></a><a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#7d1a20ca4167394364dfe08d4a171373">00124</a> imat <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#7d1a20ca4167394364dfe08d4a171373" title="List of integer coordinates in the n direction with non-zero entries.">nlist</a>; |
---|
| 111 | <a name="l00126"></a><a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#e852dd3e42999a7e6f21442f5dde2684">00126</a> ivec <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#e852dd3e42999a7e6f21442f5dde2684" title="Weight of each row m.">num_mlist</a>; |
---|
| 112 | <a name="l00128"></a><a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#9384d21436e6a0115b26106a132c3024">00128</a> ivec <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#9384d21436e6a0115b26106a132c3024" title="Weight of each column n.">num_nlist</a>; |
---|
| 113 | <a name="l00130"></a><a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#02b6ed3e761959c93b443fec2c0867b1">00130</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#02b6ed3e761959c93b443fec2c0867b1" title="Maximum weight of rows.">max_num_m</a>; |
---|
| 114 | <a name="l00132"></a><a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#22fcdedc34ed8da22e524a08d96f01bf">00132</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF2mat__sparse__alist.html#22fcdedc34ed8da22e524a08d96f01bf" title="Maximum weight of columns.">max_num_n</a>; |
---|
| 115 | <a name="l00133"></a>00133 }; |
---|
| 116 | <a name="l00134"></a>00134 |
---|
| 117 | <a name="l00135"></a>00135 |
---|
| 118 | <a name="l00136"></a>00136 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 119 | <a name="l00137"></a>00137 <span class="comment">// Dense GF(2) matrix class</span> |
---|
| 120 | <a name="l00138"></a>00138 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 121 | <a name="l00139"></a>00139 |
---|
| 122 | <a name="l00157"></a><a class="code" href="classitpp_1_1GF2mat.html">00157</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> |
---|
| 123 | <a name="l00158"></a>00158 { |
---|
| 124 | <a name="l00159"></a>00159 <span class="keyword">public</span>: |
---|
| 125 | <a name="l00160"></a>00160 |
---|
| 126 | <a name="l00161"></a>00161 <span class="comment">// ----------- Constructors -----------</span> |
---|
| 127 | <a name="l00162"></a>00162 |
---|
| 128 | <a name="l00164"></a>00164 <a class="code" href="classitpp_1_1GF2mat.html#dc147212007fc4602868840158b9e1d8" title="Default constructor (gives an empty 1 x 1 matrix).">GF2mat</a>(); |
---|
| 129 | <a name="l00165"></a>00165 |
---|
| 130 | <a name="l00167"></a>00167 <a class="code" href="classitpp_1_1GF2mat.html#dc147212007fc4602868840158b9e1d8" title="Default constructor (gives an empty 1 x 1 matrix).">GF2mat</a>(<span class="keywordtype">int</span> m, <span class="keywordtype">int</span> n); |
---|
| 131 | <a name="l00168"></a>00168 |
---|
| 132 | <a name="l00170"></a>00170 <a class="code" href="classitpp_1_1GF2mat.html#dc147212007fc4602868840158b9e1d8" title="Default constructor (gives an empty 1 x 1 matrix).">GF2mat</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Sparse__Mat.html">GF2mat_sparse</a> &X); |
---|
| 133 | <a name="l00171"></a>00171 |
---|
| 134 | <a name="l00176"></a>00176 <a class="code" href="classitpp_1_1GF2mat.html#dc147212007fc4602868840158b9e1d8" title="Default constructor (gives an empty 1 x 1 matrix).">GF2mat</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Sparse__Mat.html">GF2mat_sparse</a> &X, <span class="keywordtype">int</span> m1, <span class="keywordtype">int</span> n1, <span class="keywordtype">int</span> m2, <span class="keywordtype">int</span> n2); |
---|
| 135 | <a name="l00177"></a>00177 |
---|
| 136 | <a name="l00186"></a>00186 <a class="code" href="classitpp_1_1GF2mat.html#dc147212007fc4602868840158b9e1d8" title="Default constructor (gives an empty 1 x 1 matrix).">GF2mat</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Sparse__Mat.html">GF2mat_sparse</a> &X, <span class="keyword">const</span> ivec &columns); |
---|
| 137 | <a name="l00187"></a>00187 |
---|
| 138 | <a name="l00195"></a>00195 <a class="code" href="classitpp_1_1GF2mat.html#dc147212007fc4602868840158b9e1d8" title="Default constructor (gives an empty 1 x 1 matrix).">GF2mat</a>(<span class="keyword">const</span> bvec &x, <span class="keywordtype">bool</span> is_column = <span class="keyword">true</span>); |
---|
| 139 | <a name="l00196"></a>00196 |
---|
| 140 | <a name="l00198"></a>00198 <a class="code" href="classitpp_1_1GF2mat.html#dc147212007fc4602868840158b9e1d8" title="Default constructor (gives an empty 1 x 1 matrix).">GF2mat</a>(<span class="keyword">const</span> <a class="code" href="mat_8h.html#f90acd1af41bf2d1d8a4bb23662fff69" title="bin matrix">bmat</a> &X); |
---|
| 141 | <a name="l00199"></a>00199 |
---|
| 142 | <a name="l00201"></a>00201 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat.html#d22d6d0dd4b26ba18c7c18b4ab37cf76" title="Set size of GF(2) matrix. If copy = true, keep data before resizing.">set_size</a>(<span class="keywordtype">int</span> m, <span class="keywordtype">int</span> n, <span class="keywordtype">bool</span> copy = <span class="keyword">false</span>); |
---|
| 143 | <a name="l00202"></a>00202 |
---|
| 144 | <a name="l00204"></a>00204 <a class="code" href="classitpp_1_1Sparse__Mat.html">GF2mat_sparse</a> <a class="code" href="classitpp_1_1GF2mat.html#3db5a5d93e6359a1b0214fad87851aa4" title="Create a sparse GF(2) matrix from a dense GF(2) matrix.">sparsify</a>() <span class="keyword">const</span>; |
---|
| 145 | <a name="l00205"></a>00205 |
---|
| 146 | <a name="l00207"></a>00207 bvec <a class="code" href="classitpp_1_1GF2mat.html#9e26adbe8604c441a4308195311c74e6" title="Create a bvec from a GF(2) matrix (must have one column or one row).">bvecify</a>() <span class="keyword">const</span>; |
---|
| 147 | <a name="l00208"></a>00208 |
---|
| 148 | <a name="l00209"></a>00209 <span class="comment">// ----------- Elementwise manipulation and simple functions -------------</span> |
---|
| 149 | <a name="l00210"></a>00210 |
---|
| 150 | <a name="l00212"></a>00212 <span class="keyword">inline</span> <a class="code" href="classitpp_1_1bin.html" title="Binary arithmetic (boolean) class.">bin</a> <span class="keyword">get</span>(<span class="keywordtype">int</span> i, <span class="keywordtype">int</span> j) <span class="keyword">const</span>; |
---|
| 151 | <a name="l00213"></a>00213 |
---|
| 152 | <a name="l00215"></a><a class="code" href="classitpp_1_1GF2mat.html#5f4cde098e5caa457bfa6ca5fc9f3859">00215</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1bin.html" title="Binary arithmetic (boolean) class.">bin</a> <a class="code" href="classitpp_1_1GF2mat.html#5f4cde098e5caa457bfa6ca5fc9f3859" title="Getting element.">operator()</a>(<span class="keywordtype">int</span> i, <span class="keywordtype">int</span> j)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="keyword">get</span>(i, j); }; |
---|
| 153 | <a name="l00216"></a>00216 |
---|
| 154 | <a name="l00218"></a>00218 <span class="keyword">inline</span> <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keywordtype">int</span> i, <span class="keywordtype">int</span> j, <a class="code" href="classitpp_1_1bin.html" title="Binary arithmetic (boolean) class.">bin</a> s); |
---|
| 155 | <a name="l00219"></a>00219 |
---|
| 156 | <a name="l00221"></a>00221 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat.html#29311e8786dcfee8133ddb7c4acd86a9" title="Add s (0 or 1) to element (i,j).">addto_element</a>(<span class="keywordtype">int</span> i, <span class="keywordtype">int</span> j, <a class="code" href="classitpp_1_1bin.html" title="Binary arithmetic (boolean) class.">bin</a> s); |
---|
| 157 | <a name="l00222"></a>00222 |
---|
| 158 | <a name="l00224"></a>00224 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat.html#2f5a17948e1b936e3a4930b9496e8706" title="Set column j to a binary vector x.">set_col</a>(<span class="keywordtype">int</span> j, bvec x); |
---|
| 159 | <a name="l00225"></a>00225 |
---|
| 160 | <a name="l00227"></a>00227 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat.html#d350cbeb23f2e50210ad111e845a67f8" title="Set row i to a binary vector x.">set_row</a>(<span class="keywordtype">int</span> i, bvec x); |
---|
| 161 | <a name="l00228"></a>00228 |
---|
| 162 | <a name="l00230"></a>00230 <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1GF2mat.html#3d83ff2b339911888be0dcca933fcb93" title="Check whether the matrix is identical to zero.">is_zero</a>() <span class="keyword">const</span>; |
---|
| 163 | <a name="l00231"></a>00231 |
---|
| 164 | <a name="l00233"></a>00233 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat.html#e64fb0a60d9aab8c6b551a51fd017538" title="Swap rows i and j.">swap_rows</a>(<span class="keywordtype">int</span> i, <span class="keywordtype">int</span> j); |
---|
| 165 | <a name="l00234"></a>00234 |
---|
| 166 | <a name="l00236"></a>00236 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat.html#7bf2d0c5dfb4ecd2fb607d7d75043704" title="Swap columns i and j.">swap_cols</a>(<span class="keywordtype">int</span> i, <span class="keywordtype">int</span> j); |
---|
| 167 | <a name="l00237"></a>00237 |
---|
| 168 | <a name="l00244"></a>00244 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat.html#1af4a92b0a1a83f7a555ff51589288d3" title="Multiply from left with permutation matrix (permute rows).">permute_rows</a>(ivec &perm, <span class="keywordtype">bool</span> I); |
---|
| 169 | <a name="l00245"></a>00245 |
---|
| 170 | <a name="l00253"></a>00253 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat.html#f2745cfe38e48b46a7361d15c8b80fb2" title="Multiply a matrix from right with a permutation matrix (i.e., permute the columns)...">permute_cols</a>(ivec &perm, <span class="keywordtype">bool</span> I); |
---|
| 171 | <a name="l00254"></a>00254 |
---|
| 172 | <a name="l00256"></a>00256 <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> <a class="code" href="classitpp_1_1GF2mat.html#0a4a28c21ee063263ff4383f7e14abfc" title="Transpose.">transpose</a>() <span class="keyword">const</span>; |
---|
| 173 | <a name="l00257"></a>00257 |
---|
| 174 | <a name="l00259"></a>00259 <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> <a class="code" href="classitpp_1_1GF2mat.html#3a7620019de152de4313841e84ae765b" title="Submatrix from (m1,n1) to (m2,n2).">get_submatrix</a>(<span class="keywordtype">int</span> m1, <span class="keywordtype">int</span> n1, <span class="keywordtype">int</span> m2, <span class="keywordtype">int</span> n2) <span class="keyword">const</span>; |
---|
| 175 | <a name="l00260"></a>00260 |
---|
| 176 | <a name="l00262"></a>00262 <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> <a class="code" href="classitpp_1_1GF2mat.html#60383414c1f4f5403e2d05cc37a5853f" title="Concatenate horizontally (append X on the right side of matrix).">concatenate_horizontal</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &X) <span class="keyword">const</span>; |
---|
| 177 | <a name="l00263"></a>00263 |
---|
| 178 | <a name="l00265"></a>00265 <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> <a class="code" href="classitpp_1_1GF2mat.html#6b9040e2ff3e2e3cce6222dd13a34ad2" title="Concatenate vertically (append X underneath).">concatenate_vertical</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &X) <span class="keyword">const</span>; |
---|
| 179 | <a name="l00266"></a>00266 |
---|
| 180 | <a name="l00268"></a>00268 bvec <a class="code" href="classitpp_1_1GF2mat.html#e661183c92a92fdf6933504c29cd24c3" title="Get row.">get_row</a>(<span class="keywordtype">int</span> i) <span class="keyword">const</span>; |
---|
| 181 | <a name="l00269"></a>00269 |
---|
| 182 | <a name="l00271"></a>00271 bvec <a class="code" href="classitpp_1_1GF2mat.html#d7ee5bcfe1501b6c04eec25eb188966c" title="Get column.">get_col</a>(<span class="keywordtype">int</span> j) <span class="keyword">const</span>; |
---|
| 183 | <a name="l00272"></a>00272 |
---|
| 184 | <a name="l00274"></a>00274 <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1GF2mat.html#b6a8989c8e32688fe36443deb2c1625a" title="Compute the matrix density (fraction of elements equal to &quot;1&quot;).">density</a>() <span class="keyword">const</span>; |
---|
| 185 | <a name="l00275"></a>00275 |
---|
| 186 | <a name="l00277"></a><a class="code" href="classitpp_1_1GF2mat.html#f72dd843c1cfe6641e6234b444131ed3">00277</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF2mat.html#f72dd843c1cfe6641e6234b444131ed3" title="Get number of rows.">rows</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nrows; } |
---|
| 187 | <a name="l00278"></a>00278 |
---|
| 188 | <a name="l00280"></a><a class="code" href="classitpp_1_1GF2mat.html#e2f8c9b68b5436626ea7a386ffd5b61f">00280</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF2mat.html#e2f8c9b68b5436626ea7a386ffd5b61f" title="Get number of columns.">cols</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> ncols; } |
---|
| 189 | <a name="l00281"></a>00281 |
---|
| 190 | <a name="l00289"></a>00289 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat.html#3c73516894e748568b0821bdff3509e6" title="Add (or equivalently, subtract) rows.">add_rows</a>(<span class="keywordtype">int</span> i, <span class="keywordtype">int</span> j); |
---|
| 191 | <a name="l00290"></a>00290 |
---|
| 192 | <a name="l00291"></a>00291 <span class="comment">// ---------- Linear algebra --------------</span> |
---|
| 193 | <a name="l00292"></a>00292 |
---|
| 194 | <a name="l00298"></a>00298 <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> <a class="code" href="classitpp_1_1GF2mat.html#b713053039a9fbd5523014439e0bbab8" title="Inversion.">inverse</a>() <span class="keyword">const</span>; |
---|
| 195 | <a name="l00299"></a>00299 |
---|
| 196 | <a name="l00301"></a>00301 <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF2mat.html#a434aa8694ea49e8e4eaec454e45ff03" title="Returns the number of linearly independent rows.">row_rank</a>() <span class="keyword">const</span>; |
---|
| 197 | <a name="l00302"></a>00302 |
---|
| 198 | <a name="l00319"></a>00319 <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF2mat.html#26c7064112141cc025f200403bda15a7" title="TXP factorization.">T_fact</a>(<a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &T, <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &U, ivec &P) <span class="keyword">const</span>; |
---|
| 199 | <a name="l00320"></a>00320 |
---|
| 200 | <a name="l00342"></a>00342 <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1GF2mat.html#a861b9708967670e25d2165cf827c9dd" title="TXP factorization update, when bit is flipped.">T_fact_update_bitflip</a>(<a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &T, <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &U, |
---|
| 201 | <a name="l00343"></a>00343 ivec &P, <span class="keywordtype">int</span> <a class="code" href="group__matrix__functions.html#g6adab7c28deb3fec407684458f0b719d" title="Specialisation of rank() function.">rank</a>, <span class="keywordtype">int</span> r, <span class="keywordtype">int</span> c) <span class="keyword">const</span>; |
---|
| 202 | <a name="l00344"></a>00344 |
---|
| 203 | <a name="l00366"></a>00366 <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1GF2mat.html#43be340ead050d90106836ffe250638b" title="TXP factorization update, when column is added.">T_fact_update_addcol</a>(<a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &T, <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &U, |
---|
| 204 | <a name="l00367"></a>00367 ivec &P, bvec newcol) <span class="keyword">const</span>; |
---|
| 205 | <a name="l00368"></a>00368 |
---|
| 206 | <a name="l00369"></a>00369 <span class="comment">// ----- Operators -----------</span> |
---|
| 207 | <a name="l00370"></a>00370 |
---|
| 208 | <a name="l00372"></a>00372 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat.html#2d9ccdb65f49279de9532da57e1f2dd1" title="Assignment operator.">operator=</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &X); |
---|
| 209 | <a name="l00373"></a>00373 |
---|
| 210 | <a name="l00375"></a>00375 <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1GF2mat.html#3c071d473d617585dfabfadc0252c39c" title="Check if equal.">operator==</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &X) <span class="keyword">const</span>; |
---|
| 211 | <a name="l00376"></a>00376 |
---|
| 212 | <a name="l00377"></a>00377 <span class="comment">// ----- Friends ------</span> |
---|
| 213 | <a name="l00378"></a>00378 |
---|
| 214 | <a name="l00380"></a>00380 <span class="keyword">friend</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> <a class="code" href="classitpp_1_1GF2mat.html#c272d2dad7a03fcb4f648a1f04e99c8c" title="Multiplication operator.">operator*</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &X, <span class="keyword">const</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &Y); |
---|
| 215 | <a name="l00381"></a>00381 |
---|
| 216 | <a name="l00383"></a>00383 <span class="keyword">friend</span> bvec <a class="code" href="classitpp_1_1GF2mat.html#c272d2dad7a03fcb4f648a1f04e99c8c" title="Multiplication operator.">operator*</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &X, <span class="keyword">const</span> bvec &y); |
---|
| 217 | <a name="l00384"></a>00384 |
---|
| 218 | <a name="l00389"></a>00389 <span class="keyword">friend</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> <a class="code" href="classitpp_1_1GF2mat.html#f1f13cf996e90cbabbd46e5790b08287" title="Addition operator.">operator+</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &X, <span class="keyword">const</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &Y); |
---|
| 219 | <a name="l00390"></a>00390 |
---|
| 220 | <a name="l00392"></a>00392 <span class="keyword">friend</span> std::ostream &<a class="code" href="classitpp_1_1GF2mat.html#189b6e6faee514b7aecaed8894b978ee" title="Output stream operator (plain text).">operator<<</a>(std::ostream &os, <span class="keyword">const</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &X); |
---|
| 221 | <a name="l00393"></a>00393 |
---|
| 222 | <a name="l00395"></a>00395 <span class="keyword">friend</span> <a class="code" href="classitpp_1_1it__file.html" title="The IT++ file format reading and writing class.">it_file</a> &<a class="code" href="classitpp_1_1GF2mat.html#189b6e6faee514b7aecaed8894b978ee" title="Output stream operator (plain text).">operator<<</a>(<a class="code" href="classitpp_1_1it__file.html" title="The IT++ file format reading and writing class.">it_file</a> &f, <span class="keyword">const</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &X); |
---|
| 223 | <a name="l00396"></a>00396 |
---|
| 224 | <a name="l00398"></a>00398 <span class="keyword">friend</span> <a class="code" href="classitpp_1_1it__ifile.html" title="The IT++ file format reading class.">it_ifile</a> &<a class="code" href="classitpp_1_1GF2mat.html#a46348071ba4d3116d473e188ef804a1" title="Read the matrix from file.">operator>></a>(<a class="code" href="classitpp_1_1it__ifile.html" title="The IT++ file format reading class.">it_ifile</a> &f, <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &X); |
---|
| 225 | <a name="l00399"></a>00399 |
---|
| 226 | <a name="l00401"></a>00401 <span class="keyword">friend</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> <a class="code" href="classitpp_1_1GF2mat.html#375df4bc73ef802e3face6661d088963" title="Multiplication X*Y&#39; where X and Y are GF(2) matrices.">mult_trans</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &X, <span class="keyword">const</span> <a class="code" href="classitpp_1_1GF2mat.html" title="Class for dense GF(2) matrices.">GF2mat</a> &Y); |
---|
| 227 | <a name="l00402"></a>00402 |
---|
| 228 | <a name="l00403"></a>00403 <span class="keyword">private</span>: |
---|
| 229 | <a name="l00404"></a>00404 <span class="keywordtype">int</span> nrows, ncols; <span class="comment">// number of rows and columns of matrix</span> |
---|
| 230 | <a name="l00405"></a>00405 <span class="keywordtype">int</span> nwords; <span class="comment">// number of bytes used</span> |
---|
| 231 | <a name="l00406"></a>00406 <a class="code" href="classitpp_1_1Mat.html">Mat<unsigned char></a> data; <span class="comment">// data structure</span> |
---|
| 232 | <a name="l00407"></a>00407 |
---|
| 233 | <a name="l00408"></a>00408 <span class="comment">// This value is used to perform division by bit shift and is equal to</span> |
---|
| 234 | <a name="l00409"></a>00409 <span class="comment">// log2(8)</span> |
---|
| 235 | <a name="l00410"></a>00410 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> shift_divisor = 3; |
---|
| 236 | <a name="l00411"></a>00411 |
---|
| 237 | <a name="l00412"></a>00412 <span class="comment">// This value is used as a mask when computing the bit position of the</span> |
---|
| 238 | <a name="l00413"></a>00413 <span class="comment">// division remainder</span> |
---|
| 239 | <a name="l00414"></a>00414 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> rem_mask = (1 << shift_divisor) - 1; |
---|
| 240 | <a name="l00415"></a>00415 }; |
---|
| 241 | <a name="l00416"></a>00416 |
---|
| 242 | <a name="l00417"></a>00417 |
---|
| 243 | <a name="l00418"></a>00418 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 244 | <a name="l00419"></a>00419 <span class="comment">// GF2mat related functions</span> |
---|
| 245 | <a name="l00420"></a>00420 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 246 | <a name="l00421"></a>00421 |
---|
| 247 | <a name="l00426"></a>00426 it_file &<a class="code" href="group__fixed.html#g46e967850e616363aeabd2cda5bcc159" title="Set output mode.">operator<<</a>(it_file &f, <span class="keyword">const</span> GF2mat &X); |
---|
| 248 | <a name="l00427"></a>00427 |
---|
| 249 | <a name="l00432"></a>00432 it_ifile &<a class="code" href="group__fixed.html#gbd223815e04b623a044d98fd366f3a0f" title="Input bit representation and, optionally, the shift.">operator>></a>(it_ifile &f, GF2mat &X); |
---|
| 250 | <a name="l00433"></a>00433 |
---|
| 251 | <a name="l00438"></a>00438 GF2mat <a class="code" href="group__fixed.html#g8bb80689611f7b6b0e36f5507d990af7" title="Fix * cfixmat.">operator*</a>(<span class="keyword">const</span> GF2mat &X, <span class="keyword">const</span> GF2mat &Y); |
---|
| 252 | <a name="l00439"></a>00439 |
---|
| 253 | <a name="l00444"></a>00444 bvec <a class="code" href="group__fixed.html#g8bb80689611f7b6b0e36f5507d990af7" title="Fix * cfixmat.">operator*</a>(<span class="keyword">const</span> GF2mat &X, <span class="keyword">const</span> bvec &y); |
---|
| 254 | <a name="l00445"></a>00445 |
---|
| 255 | <a name="l00450"></a>00450 GF2mat <a class="code" href="group__fixed.html#g683d6c037357e472e84756fe1b1faae8" title="Fix + cfixmat.">operator+</a>(<span class="keyword">const</span> GF2mat &X, <span class="keyword">const</span> GF2mat &Y); |
---|
| 256 | <a name="l00451"></a>00451 |
---|
| 257 | <a name="l00456"></a>00456 std::ostream &<a class="code" href="group__fixed.html#g46e967850e616363aeabd2cda5bcc159" title="Set output mode.">operator<<</a>(std::ostream &os, <span class="keyword">const</span> GF2mat &X); |
---|
| 258 | <a name="l00457"></a>00457 |
---|
| 259 | <a name="l00462"></a>00462 GF2mat gf2dense_eye(<span class="keywordtype">int</span> m); |
---|
| 260 | <a name="l00463"></a>00463 |
---|
| 261 | <a name="l00468"></a>00468 GF2mat mult_trans(<span class="keyword">const</span> GF2mat &X, <span class="keyword">const</span> GF2mat &Y); |
---|
| 262 | <a name="l00469"></a>00469 |
---|
| 263 | <a name="l00470"></a>00470 |
---|
| 264 | <a name="l00471"></a>00471 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 265 | <a name="l00472"></a>00472 <span class="comment">// Inline implementations</span> |
---|
| 266 | <a name="l00473"></a>00473 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 267 | <a name="l00474"></a>00474 |
---|
| 268 | <a name="l00475"></a><a class="code" href="classitpp_1_1GF2mat.html#29311e8786dcfee8133ddb7c4acd86a9">00475</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat.html#29311e8786dcfee8133ddb7c4acd86a9" title="Add s (0 or 1) to element (i,j).">GF2mat::addto_element</a>(<span class="keywordtype">int</span> i, <span class="keywordtype">int</span> j, <a class="code" href="classitpp_1_1bin.html" title="Binary arithmetic (boolean) class.">bin</a> s) |
---|
| 269 | <a name="l00476"></a>00476 { |
---|
| 270 | <a name="l00477"></a>00477 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(i >= 0 && i < nrows, <span class="stringliteral">"GF2mat::addto_element()"</span>); |
---|
| 271 | <a name="l00478"></a>00478 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(j >= 0 && j < ncols, <span class="stringliteral">"GF2mat::addto_element()"</span>); |
---|
| 272 | <a name="l00479"></a>00479 <span class="keywordflow">if</span> (s == 1) |
---|
| 273 | <a name="l00480"></a>00480 data(i, (j >> shift_divisor)) ^= (1 << (j & rem_mask)); |
---|
| 274 | <a name="l00481"></a>00481 } |
---|
| 275 | <a name="l00482"></a>00482 |
---|
| 276 | <a name="l00483"></a><a class="code" href="classitpp_1_1GF2mat.html#4a7985b6813c77ae73c369c3c15c0176">00483</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1bin.html" title="Binary arithmetic (boolean) class.">bin</a> <a class="code" href="classitpp_1_1GF2mat.html#4a7985b6813c77ae73c369c3c15c0176" title="Getting element.">GF2mat::get</a>(<span class="keywordtype">int</span> i, <span class="keywordtype">int</span> j)<span class="keyword"> const</span> |
---|
| 277 | <a name="l00484"></a>00484 <span class="keyword"></span>{ |
---|
| 278 | <a name="l00485"></a>00485 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(i >= 0 && i < nrows, <span class="stringliteral">"GF2mat::get_element()"</span>); |
---|
| 279 | <a name="l00486"></a>00486 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(j >= 0 && j < ncols, <span class="stringliteral">"GF2mat::get_element()"</span>); |
---|
| 280 | <a name="l00487"></a>00487 <span class="keywordflow">return</span> (data(i, (j >> shift_divisor)) >> (j & rem_mask)) & 1; |
---|
| 281 | <a name="l00488"></a>00488 } |
---|
| 282 | <a name="l00489"></a>00489 |
---|
| 283 | <a name="l00490"></a><a class="code" href="classitpp_1_1GF2mat.html#b5fdf9499d92066ba1ae7324f23da2f7">00490</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1GF2mat.html#b5fdf9499d92066ba1ae7324f23da2f7" title="Set element i,j to s (0 or 1).">GF2mat::set</a>(<span class="keywordtype">int</span> i, <span class="keywordtype">int</span> j, <a class="code" href="classitpp_1_1bin.html" title="Binary arithmetic (boolean) class.">bin</a> s) |
---|
| 284 | <a name="l00491"></a>00491 { |
---|
| 285 | <a name="l00492"></a>00492 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(i >= 0 && i < nrows, <span class="stringliteral">"GF2mat::set_element()"</span>); |
---|
| 286 | <a name="l00493"></a>00493 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(j >= 0 && j < ncols, <span class="stringliteral">"GF2mat::set_element()"</span>); |
---|
| 287 | <a name="l00494"></a>00494 <span class="keywordflow">if</span> (s == 1) <span class="comment">// set bit to one</span> |
---|
| 288 | <a name="l00495"></a>00495 data(i, (j >> shift_divisor)) |= (1 << (j & rem_mask)); |
---|
| 289 | <a name="l00496"></a>00496 <span class="keywordflow">else</span> <span class="comment">// set bit to zero</span> |
---|
| 290 | <a name="l00497"></a>00497 data(i, (j >> shift_divisor)) &= (~(1 << (j & rem_mask))); |
---|
| 291 | <a name="l00498"></a>00498 } |
---|
| 292 | <a name="l00499"></a>00499 |
---|
| 293 | <a name="l00500"></a>00500 } <span class="comment">// namespace itpp</span> |
---|
| 294 | <a name="l00501"></a>00501 |
---|
| 295 | <a name="l00502"></a>00502 <span class="preprocessor">#endif // #ifndef GF2MAT_H</span> |
---|
| 296 | </pre></div></div> |
---|
| 297 | <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:11 2009 for mixpp by |
---|
| 298 | <a href="http://www.doxygen.org/index.html"> |
---|
| 299 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> |
---|
| 300 | </body> |
---|
| 301 | </html> |
---|