root/doc/html/transforms_8h-source.html @ 354

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

doc

Line 
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: transforms.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>transforms.h</h1><a href="transforms_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
66<a name="l00030"></a>00030 <span class="preprocessor">#ifndef TRANSFORMS_H</span>
67<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define TRANSFORMS_H</span>
68<a name="l00032"></a>00032 <span class="preprocessor"></span>
69<a name="l00033"></a>00033 <span class="preprocessor">#ifndef _MSC_VER</span>
70<a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#  include &lt;itpp/config.h&gt;</span>
71<a name="l00035"></a>00035 <span class="preprocessor">#else</span>
72<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#  include &lt;itpp/config_msvc.h&gt;</span>
73<a name="l00037"></a>00037 <span class="preprocessor">#endif</span>
74<a name="l00038"></a>00038 <span class="preprocessor"></span>
75<a name="l00039"></a>00039 <span class="preprocessor">#include &lt;<a class="code" href="vec_8h.html" title="Templated Vector Class Definitions.">itpp/base/vec.h</a>&gt;</span>
76<a name="l00040"></a>00040 <span class="preprocessor">#include &lt;<a class="code" href="mat_8h.html" title="Matrix Class Definitions.">itpp/base/mat.h</a>&gt;</span>
77<a name="l00041"></a>00041 <span class="preprocessor">#include &lt;<a class="code" href="matfunc_8h.html" title="Various functions on vectors and matrices - header file.">itpp/base/matfunc.h</a>&gt;</span>
78<a name="l00042"></a>00042
79<a name="l00043"></a>00043
80<a name="l00044"></a>00044 <span class="keyword">namespace </span>itpp
81<a name="l00045"></a>00045 {
82<a name="l00046"></a>00046
83<a name="l00087"></a>00087
84<a name="l00088"></a>00088
85<a name="l00089"></a>00089
86<a name="l00091"></a>00091 <span class="keywordtype">void</span> <a class="code" href="group__fft.html#g47b556fc383bceb3cc562045acfa9f00" title="Fast Fourier Transform, with zero-padding up to size N.">fft</a>(<span class="keyword">const</span> cvec &amp;in, cvec &amp;out);
87<a name="l00093"></a>00093 cvec <a class="code" href="group__fft.html#g47b556fc383bceb3cc562045acfa9f00" title="Fast Fourier Transform, with zero-padding up to size N.">fft</a>(<span class="keyword">const</span> cvec &amp;in);
88<a name="l00095"></a>00095 cvec <a class="code" href="group__fft.html#g47b556fc383bceb3cc562045acfa9f00" title="Fast Fourier Transform, with zero-padding up to size N.">fft</a>(<span class="keyword">const</span> cvec &amp;in, <span class="keyword">const</span> <span class="keywordtype">int</span> N);
89<a name="l00097"></a>00097 <span class="keywordtype">void</span> <a class="code" href="group__fft.html#gda0d68d66e55693b98d6f5a374943593" title="Inverse Fast Fourier Transform, with zero-padding up to size N.">ifft</a>(<span class="keyword">const</span> cvec &amp;in, cvec &amp;out);
90<a name="l00099"></a>00099 cvec <a class="code" href="group__fft.html#gda0d68d66e55693b98d6f5a374943593" title="Inverse Fast Fourier Transform, with zero-padding up to size N.">ifft</a>(<span class="keyword">const</span> cvec &amp;in);
91<a name="l00101"></a>00101 cvec <a class="code" href="group__fft.html#gda0d68d66e55693b98d6f5a374943593" title="Inverse Fast Fourier Transform, with zero-padding up to size N.">ifft</a>(<span class="keyword">const</span> cvec &amp;in, <span class="keyword">const</span> <span class="keywordtype">int</span> N);
92<a name="l00102"></a>00102
93<a name="l00104"></a>00104 <span class="keywordtype">void</span> <a class="code" href="group__fft.html#g907314f1fcae54228f62d9de06382fd8" title="Real Fast Fourier Transform, with zero-padding up to size N.">fft_real</a>(<span class="keyword">const</span> vec&amp; in, cvec &amp;out);
94<a name="l00106"></a>00106 cvec <a class="code" href="group__fft.html#g907314f1fcae54228f62d9de06382fd8" title="Real Fast Fourier Transform, with zero-padding up to size N.">fft_real</a>(<span class="keyword">const</span> vec&amp; in);
95<a name="l00108"></a>00108 cvec <a class="code" href="group__fft.html#g907314f1fcae54228f62d9de06382fd8" title="Real Fast Fourier Transform, with zero-padding up to size N.">fft_real</a>(<span class="keyword">const</span> vec &amp;in, <span class="keyword">const</span> <span class="keywordtype">int</span> N);
96<a name="l00110"></a>00110 <span class="keywordtype">void</span> <a class="code" href="group__fft.html#g032f33ed9bd8e7b794c6ee2eb3456f68" title="Inverse Real Fast Fourier Transform, with zero-padding up to size N.">ifft_real</a>(<span class="keyword">const</span> cvec &amp;in, vec &amp;out);
97<a name="l00112"></a>00112 vec <a class="code" href="group__fft.html#g032f33ed9bd8e7b794c6ee2eb3456f68" title="Inverse Real Fast Fourier Transform, with zero-padding up to size N.">ifft_real</a>(<span class="keyword">const</span> cvec &amp;in);
98<a name="l00114"></a>00114 vec <a class="code" href="group__fft.html#g032f33ed9bd8e7b794c6ee2eb3456f68" title="Inverse Real Fast Fourier Transform, with zero-padding up to size N.">ifft_real</a>(<span class="keyword">const</span> cvec &amp;in, <span class="keyword">const</span> <span class="keywordtype">int</span> N);
99<a name="l00116"></a>00116
100<a name="l00117"></a>00117
101<a name="l00159"></a>00159
102<a name="l00160"></a>00160
103<a name="l00161"></a>00161
104<a name="l00163"></a>00163 <span class="keywordtype">void</span> <a class="code" href="group__dct.html#g00edf4680dd48a395f1e068996d70dbd" title="Discrete Cosine Transform (DCT).">dct</a>(<span class="keyword">const</span> vec &amp;in, vec &amp;out);
105<a name="l00165"></a>00165 vec <a class="code" href="group__dct.html#g00edf4680dd48a395f1e068996d70dbd" title="Discrete Cosine Transform (DCT).">dct</a>(<span class="keyword">const</span> vec &amp;in);
106<a name="l00167"></a>00167 <span class="keywordtype">void</span> <a class="code" href="group__dct.html#g941866a19b82318fa8ca2124fdbaa53c" title="Inverse Discrete Cosine Transform (IDCT).">idct</a>(<span class="keyword">const</span> vec &amp;in, vec &amp;out);
107<a name="l00169"></a>00169 vec <a class="code" href="group__dct.html#g941866a19b82318fa8ca2124fdbaa53c" title="Inverse Discrete Cosine Transform (IDCT).">idct</a>(<span class="keyword">const</span> vec &amp;in);
108<a name="l00171"></a>00171
109<a name="l00172"></a>00172
110<a name="l00175"></a>00175
111<a name="l00177"></a>00177 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; Vec&lt;T&gt; <a class="code" href="group__fht.html#g5b4a032c5a4a9f9257837b30670819d0" title="Fast Hadamard Transform.">dht</a>(<span class="keyword">const</span> Vec&lt;T&gt; &amp;v);
112<a name="l00179"></a>00179 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; <span class="keywordtype">void</span> <a class="code" href="group__fht.html#g5b4a032c5a4a9f9257837b30670819d0" title="Fast Hadamard Transform.">dht</a>(<span class="keyword">const</span> Vec&lt;T&gt; &amp;vin, Vec&lt;T&gt; &amp;vout);
113<a name="l00181"></a>00181 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; <span class="keywordtype">void</span> <a class="code" href="group__fht.html#g3313b1adce6c85bfaf097a2f096656e2" title="Fast Hadamard Transform - memory efficient. Stores the result in v.">self_dht</a>(Vec&lt;T&gt; &amp;v);
114<a name="l00182"></a>00182
115<a name="l00184"></a>00184 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; Vec&lt;T&gt; <a class="code" href="group__fht.html#gc5230d121c88abf9a6e7cb274ad1d96f" title="Fast Walsh Hadamard Transform.">dwht</a>(<span class="keyword">const</span> Vec&lt;T&gt; &amp;v);
116<a name="l00186"></a>00186 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; <span class="keywordtype">void</span> <a class="code" href="group__fht.html#gc5230d121c88abf9a6e7cb274ad1d96f" title="Fast Walsh Hadamard Transform.">dwht</a>(<span class="keyword">const</span> Vec&lt;T&gt; &amp;vin, Vec&lt;T&gt; &amp;vout);
117<a name="l00188"></a>00188 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; <span class="keywordtype">void</span> <a class="code" href="group__fht.html#ge57eb770500e2e9f8ebca20546670a4d" title="Fast Walsh Hadamard Transform - memory efficient (result in v).">self_dwht</a>(Vec&lt;T&gt; &amp;v);
118<a name="l00189"></a>00189
119<a name="l00191"></a>00191 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; Mat&lt;T&gt; <a class="code" href="group__fht.html#g1f0aff290f44fb18211840c97ab392cd" title="Fast 2D Hadamard Transform.">dht2</a>(<span class="keyword">const</span> Mat&lt;T&gt; &amp;m);
120<a name="l00193"></a>00193 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; Mat&lt;T&gt; <a class="code" href="group__fht.html#g002b2897a60f4ad7bccc33f8342a7d4a" title="Fast 2D Walsh Hadamard Transform.">dwht2</a>(<span class="keyword">const</span> Mat&lt;T&gt; &amp;m);
121<a name="l00195"></a>00195
122<a name="l00196"></a>00196 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
123<a name="l00197"></a><a class="code" href="group__fht.html#g41656c44667b6cddbdabcaf9304e633f">00197</a> <a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> <a class="code" href="group__fht.html#g5b4a032c5a4a9f9257837b30670819d0" title="Fast Hadamard Transform.">dht</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> &amp;v)
124<a name="l00198"></a>00198 {
125<a name="l00199"></a>00199   <a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> ret(v.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>());
126<a name="l00200"></a>00200   <a class="code" href="group__fht.html#g5b4a032c5a4a9f9257837b30670819d0" title="Fast Hadamard Transform.">dht</a>(v, ret);
127<a name="l00201"></a>00201   <span class="keywordflow">return</span> ret;
128<a name="l00202"></a>00202 }
129<a name="l00203"></a>00203
130<a name="l00205"></a>00205 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
131<a name="l00206"></a>00206 <span class="keywordtype">void</span> bitrv(Vec&lt;T&gt; &amp;out)
132<a name="l00207"></a>00207 {
133<a name="l00208"></a>00208   <span class="keywordtype">int</span> N = out.size();
134<a name="l00209"></a>00209   <span class="keywordtype">int</span> j = 0;
135<a name="l00210"></a>00210   <span class="keywordtype">int</span> N1 = N - 1;
136<a name="l00211"></a>00211   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; N1; ++i) {
137<a name="l00212"></a>00212     <span class="keywordflow">if</span> (i &lt; j) {
138<a name="l00213"></a>00213       T temp = out[j];
139<a name="l00214"></a>00214       out[j] = out[i];
140<a name="l00215"></a>00215       out[i] = temp;
141<a name="l00216"></a>00216     }
142<a name="l00217"></a>00217     <span class="keywordtype">int</span> K = N / 2;
143<a name="l00218"></a>00218     <span class="keywordflow">while</span> (K &lt;= j) {
144<a name="l00219"></a>00219       j -= K;
145<a name="l00220"></a>00220       K /= 2;
146<a name="l00221"></a>00221     }
147<a name="l00222"></a>00222     j += K;
148<a name="l00223"></a>00223   }
149<a name="l00224"></a>00224 }
150<a name="l00225"></a>00225
151<a name="l00226"></a>00226 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
152<a name="l00227"></a><a class="code" href="group__fht.html#g5b4a032c5a4a9f9257837b30670819d0">00227</a> <span class="keywordtype">void</span> <a class="code" href="group__fht.html#g5b4a032c5a4a9f9257837b30670819d0" title="Fast Hadamard Transform.">dht</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> &amp;vin, <a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> &amp;vout)
153<a name="l00228"></a>00228 {
154<a name="l00229"></a>00229   <span class="keywordtype">int</span> N = vin.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>();
155<a name="l00230"></a>00230   <span class="keywordtype">int</span> m = <a class="code" href="group__logexpfunc.html#g4a774bd5418520f574eddf730333dada" title="Calculate the number of bits needed to represent a numer of levels saved in a vector...">levels2bits</a>(N);
156<a name="l00231"></a>00231   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>((1 &lt;&lt; m) == N, <span class="stringliteral">"dht(): The vector size must be a power of two"</span>);
157<a name="l00232"></a>00232
158<a name="l00233"></a>00233   vout.<a class="code" href="classitpp_1_1Vec.html#a4b02b7819e540bb3853c15e6480ada6" title="Set length of vector. if copy = true then keeping the old values.">set_size</a>(N);
159<a name="l00234"></a>00234
160<a name="l00235"></a>00235   <span class="comment">// This step is separated because it copies vin to vout</span>
161<a name="l00236"></a>00236   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> ib = 0; ib &lt; N; ib += 2) {
162<a name="l00237"></a>00237     vout(ib) = vin(ib) + vin(ib + 1);
163<a name="l00238"></a>00238     vout(ib + 1) = vin(ib) - vin(ib + 1);
164<a name="l00239"></a>00239   }
165<a name="l00240"></a>00240   N /= 2;
166<a name="l00241"></a>00241
167<a name="l00242"></a>00242   <span class="keywordtype">int</span> l = 2;
168<a name="l00243"></a>00243   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 1; i &lt; m; ++i) {
169<a name="l00244"></a>00244     N /= 2;
170<a name="l00245"></a>00245     <span class="keywordtype">int</span> ib = 0;
171<a name="l00246"></a>00246     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 0; k &lt; N; ++k) {
172<a name="l00247"></a>00247       <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; l; ++j) {
173<a name="l00248"></a>00248         T t = vout(ib + j);
174<a name="l00249"></a>00249         vout(ib + j) += vout(ib + j + l);
175<a name="l00250"></a>00250         vout(ib + j + l) = t - vout(ib + j + l);
176<a name="l00251"></a>00251       }
177<a name="l00252"></a>00252       ib += 2 * l;
178<a name="l00253"></a>00253     }
179<a name="l00254"></a>00254     l *= 2;
180<a name="l00255"></a>00255   }
181<a name="l00256"></a>00256
182<a name="l00257"></a>00257   vout /= <span class="keyword">static_cast&lt;</span>T<span class="keyword">&gt;</span>(<a class="code" href="group__miscfunc.html#g20af7c97287e8275db8c2b0f650310ac" title="Square root of the elements.">std::sqrt</a>(static_cast&lt;double&gt;(vin.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>())));
183<a name="l00258"></a>00258 }
184<a name="l00259"></a>00259
185<a name="l00260"></a>00260 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
186<a name="l00261"></a><a class="code" href="group__fht.html#g3313b1adce6c85bfaf097a2f096656e2">00261</a> <span class="keywordtype">void</span> <a class="code" href="group__fht.html#g3313b1adce6c85bfaf097a2f096656e2" title="Fast Hadamard Transform - memory efficient. Stores the result in v.">self_dht</a>(<a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> &amp;v)
187<a name="l00262"></a>00262 {
188<a name="l00263"></a>00263   <span class="keywordtype">int</span> N = v.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>();
189<a name="l00264"></a>00264   <span class="keywordtype">int</span> m = <a class="code" href="group__logexpfunc.html#g4a774bd5418520f574eddf730333dada" title="Calculate the number of bits needed to represent a numer of levels saved in a vector...">levels2bits</a>(N);
190<a name="l00265"></a>00265   <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>((1 &lt;&lt; m) == N, <span class="stringliteral">"self_dht(): The vector size must be a power "</span>
191<a name="l00266"></a>00266                   <span class="stringliteral">"of two"</span>);
192<a name="l00267"></a>00267
193<a name="l00268"></a>00268   <span class="keywordtype">int</span> l = 1;
194<a name="l00269"></a>00269   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; m; ++i) {
195<a name="l00270"></a>00270     N /= 2;
196<a name="l00271"></a>00271     <span class="keywordtype">int</span> ib = 0;
197<a name="l00272"></a>00272     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 0; k &lt; N; ++k) {
198<a name="l00273"></a>00273       <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; l; ++j) {
199<a name="l00274"></a>00274         T t = v(ib + j);
200<a name="l00275"></a>00275         v(ib + j) += v(ib + j + l);
201<a name="l00276"></a>00276         v(ib + j + l) = t - v(ib + j + l);
202<a name="l00277"></a>00277       }
203<a name="l00278"></a>00278       ib += 2 * l;
204<a name="l00279"></a>00279     }
205<a name="l00280"></a>00280     l *= 2;
206<a name="l00281"></a>00281   }
207<a name="l00282"></a>00282
208<a name="l00283"></a>00283   v /= <span class="keyword">static_cast&lt;</span>T<span class="keyword">&gt;</span>(<a class="code" href="group__miscfunc.html#g20af7c97287e8275db8c2b0f650310ac" title="Square root of the elements.">std::sqrt</a>(static_cast&lt;double&gt;(v.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>())));
209<a name="l00284"></a>00284 }
210<a name="l00285"></a>00285
211<a name="l00286"></a>00286 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
212<a name="l00287"></a><a class="code" href="group__fht.html#g2dc7b4c3f529236a758e5321f3e7d047">00287</a> <a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> <a class="code" href="group__fht.html#gc5230d121c88abf9a6e7cb274ad1d96f" title="Fast Walsh Hadamard Transform.">dwht</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> &amp;v)
213<a name="l00288"></a>00288 {
214<a name="l00289"></a>00289   <a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> ret(v.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>());
215<a name="l00290"></a>00290   <a class="code" href="group__fht.html#gc5230d121c88abf9a6e7cb274ad1d96f" title="Fast Walsh Hadamard Transform.">dwht</a>(v, ret);
216<a name="l00291"></a>00291   <span class="keywordflow">return</span> ret;
217<a name="l00292"></a>00292 }
218<a name="l00293"></a>00293
219<a name="l00294"></a>00294 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
220<a name="l00295"></a><a class="code" href="group__fht.html#gc5230d121c88abf9a6e7cb274ad1d96f">00295</a> <span class="keywordtype">void</span> <a class="code" href="group__fht.html#gc5230d121c88abf9a6e7cb274ad1d96f" title="Fast Walsh Hadamard Transform.">dwht</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> &amp;vin, <a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> &amp;vout)
221<a name="l00296"></a>00296 {
222<a name="l00297"></a>00297   <a class="code" href="group__fht.html#g5b4a032c5a4a9f9257837b30670819d0" title="Fast Hadamard Transform.">dht</a>(vin, vout);
223<a name="l00298"></a>00298   bitrv(vout);
224<a name="l00299"></a>00299 }
225<a name="l00300"></a>00300
226<a name="l00301"></a>00301
227<a name="l00302"></a>00302 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
228<a name="l00303"></a><a class="code" href="group__fht.html#ge57eb770500e2e9f8ebca20546670a4d">00303</a> <span class="keywordtype">void</span> <a class="code" href="group__fht.html#ge57eb770500e2e9f8ebca20546670a4d" title="Fast Walsh Hadamard Transform - memory efficient (result in v).">self_dwht</a>(<a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> &amp;v)
229<a name="l00304"></a>00304 {
230<a name="l00305"></a>00305   <a class="code" href="group__fht.html#g3313b1adce6c85bfaf097a2f096656e2" title="Fast Hadamard Transform - memory efficient. Stores the result in v.">self_dht</a>(v);
231<a name="l00306"></a>00306   bitrv(v);
232<a name="l00307"></a>00307 }
233<a name="l00308"></a>00308
234<a name="l00309"></a>00309 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
235<a name="l00310"></a><a class="code" href="group__fht.html#g1f0aff290f44fb18211840c97ab392cd">00310</a> <a class="code" href="classitpp_1_1Mat.html">Mat&lt;T&gt;</a> <a class="code" href="group__fht.html#g1f0aff290f44fb18211840c97ab392cd" title="Fast 2D Hadamard Transform.">dht2</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Mat.html">Mat&lt;T&gt;</a> &amp;m)
236<a name="l00311"></a>00311 {
237<a name="l00312"></a>00312   <a class="code" href="classitpp_1_1Mat.html">Mat&lt;T&gt;</a> ret(m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(), m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>());
238<a name="l00313"></a>00313   <a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> v;
239<a name="l00314"></a>00314
240<a name="l00315"></a>00315   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(); ++i) {
241<a name="l00316"></a>00316     v = m.<a class="code" href="classitpp_1_1Mat.html#9e840908b256dd1353845356b9ffacb2" title="Get row r.">get_row</a>(i);
242<a name="l00317"></a>00317     <a class="code" href="group__fht.html#g3313b1adce6c85bfaf097a2f096656e2" title="Fast Hadamard Transform - memory efficient. Stores the result in v.">self_dht</a>(v);
243<a name="l00318"></a>00318     ret.set_row(i, v);
244<a name="l00319"></a>00319   }
245<a name="l00320"></a>00320   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>(); ++i) {
246<a name="l00321"></a>00321     v = ret.<a class="code" href="classitpp_1_1Mat.html#095a4e54f39932b62633f7f4f252ab46" title="Get column c.">get_col</a>(i);
247<a name="l00322"></a>00322     <a class="code" href="group__fht.html#g3313b1adce6c85bfaf097a2f096656e2" title="Fast Hadamard Transform - memory efficient. Stores the result in v.">self_dht</a>(v);
248<a name="l00323"></a>00323     ret.set_col(i, v);
249<a name="l00324"></a>00324   }
250<a name="l00325"></a>00325
251<a name="l00326"></a>00326   <span class="keywordflow">return</span> <a class="code" href="group__matrix__functions.html#g22c587fbc615e295f2b881c2e5025006" title="Transposition of the matrix m returning the transposed matrix in out.">transpose</a>(ret);
252<a name="l00327"></a>00327 }
253<a name="l00328"></a>00328
254<a name="l00329"></a>00329 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
255<a name="l00330"></a><a class="code" href="group__fht.html#g002b2897a60f4ad7bccc33f8342a7d4a">00330</a> <a class="code" href="classitpp_1_1Mat.html">Mat&lt;T&gt;</a> <a class="code" href="group__fht.html#g002b2897a60f4ad7bccc33f8342a7d4a" title="Fast 2D Walsh Hadamard Transform.">dwht2</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Mat.html">Mat&lt;T&gt;</a> &amp;m)
256<a name="l00331"></a>00331 {
257<a name="l00332"></a>00332   <a class="code" href="classitpp_1_1Mat.html">Mat&lt;T&gt;</a> ret(m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(), m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>());
258<a name="l00333"></a>00333   <a class="code" href="classitpp_1_1Vec.html">Vec&lt;T&gt;</a> v;
259<a name="l00334"></a>00334
260<a name="l00335"></a>00335   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(); ++i) {
261<a name="l00336"></a>00336     v = m.<a class="code" href="classitpp_1_1Mat.html#9e840908b256dd1353845356b9ffacb2" title="Get row r.">get_row</a>(i);
262<a name="l00337"></a>00337     <a class="code" href="group__fht.html#ge57eb770500e2e9f8ebca20546670a4d" title="Fast Walsh Hadamard Transform - memory efficient (result in v).">self_dwht</a>(v);
263<a name="l00338"></a>00338     ret.set_row(i, v);
264<a name="l00339"></a>00339   }
265<a name="l00340"></a>00340   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>(); ++i) {
266<a name="l00341"></a>00341     v = ret.<a class="code" href="classitpp_1_1Mat.html#095a4e54f39932b62633f7f4f252ab46" title="Get column c.">get_col</a>(i);
267<a name="l00342"></a>00342     <a class="code" href="group__fht.html#ge57eb770500e2e9f8ebca20546670a4d" title="Fast Walsh Hadamard Transform - memory efficient (result in v).">self_dwht</a>(v);
268<a name="l00343"></a>00343     ret.set_col(i, v);
269<a name="l00344"></a>00344   }
270<a name="l00345"></a>00345
271<a name="l00346"></a>00346   <span class="keywordflow">return</span> <a class="code" href="group__matrix__functions.html#g22c587fbc615e295f2b881c2e5025006" title="Transposition of the matrix m returning the transposed matrix in out.">transpose</a>(ret);
272<a name="l00347"></a>00347 }
273<a name="l00348"></a>00348
274<a name="l00350"></a>00350
275<a name="l00351"></a>00351 <span class="comment">// ----------------------------------------------------------------------</span>
276<a name="l00352"></a>00352 <span class="comment">// Instantiations</span>
277<a name="l00353"></a>00353 <span class="comment">// ----------------------------------------------------------------------</span>
278<a name="l00354"></a>00354
279<a name="l00355"></a>00355 <span class="preprocessor">#ifdef HAVE_EXTERN_TEMPLATE</span>
280<a name="l00356"></a>00356 <span class="preprocessor"></span>
281<a name="l00357"></a>00357 <span class="keyword">extern</span> <span class="keyword">template</span> vec <a class="code" href="group__fht.html#g5b4a032c5a4a9f9257837b30670819d0" title="Fast Hadamard Transform.">dht</a>(<span class="keyword">const</span> vec &amp;v);
282<a name="l00358"></a>00358 <span class="keyword">extern</span> <span class="keyword">template</span> cvec <a class="code" href="group__fht.html#g5b4a032c5a4a9f9257837b30670819d0" title="Fast Hadamard Transform.">dht</a>(<span class="keyword">const</span> cvec &amp;v);
283<a name="l00359"></a>00359 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keywordtype">void</span> <a class="code" href="group__fht.html#g5b4a032c5a4a9f9257837b30670819d0" title="Fast Hadamard Transform.">dht</a>(<span class="keyword">const</span> vec &amp;vin, vec &amp;vout);
284<a name="l00360"></a>00360 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keywordtype">void</span> <a class="code" href="group__fht.html#g5b4a032c5a4a9f9257837b30670819d0" title="Fast Hadamard Transform.">dht</a>(<span class="keyword">const</span> cvec &amp;vin, cvec &amp;vout);
285<a name="l00361"></a>00361
286<a name="l00362"></a>00362 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keywordtype">void</span> <a class="code" href="group__fht.html#g3313b1adce6c85bfaf097a2f096656e2" title="Fast Hadamard Transform - memory efficient. Stores the result in v.">self_dht</a>(vec &amp;v);
287<a name="l00363"></a>00363 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keywordtype">void</span> <a class="code" href="group__fht.html#g3313b1adce6c85bfaf097a2f096656e2" title="Fast Hadamard Transform - memory efficient. Stores the result in v.">self_dht</a>(cvec &amp;v);
288<a name="l00364"></a>00364
289<a name="l00365"></a>00365 <span class="keyword">extern</span> <span class="keyword">template</span> vec <a class="code" href="group__fht.html#gc5230d121c88abf9a6e7cb274ad1d96f" title="Fast Walsh Hadamard Transform.">dwht</a>(<span class="keyword">const</span> vec &amp;v);
290<a name="l00366"></a>00366 <span class="keyword">extern</span> <span class="keyword">template</span> cvec <a class="code" href="group__fht.html#gc5230d121c88abf9a6e7cb274ad1d96f" title="Fast Walsh Hadamard Transform.">dwht</a>(<span class="keyword">const</span> cvec &amp;v);
291<a name="l00367"></a>00367 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keywordtype">void</span> <a class="code" href="group__fht.html#gc5230d121c88abf9a6e7cb274ad1d96f" title="Fast Walsh Hadamard Transform.">dwht</a>(<span class="keyword">const</span> vec &amp;vin, vec &amp;vout);
292<a name="l00368"></a>00368 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keywordtype">void</span> <a class="code" href="group__fht.html#gc5230d121c88abf9a6e7cb274ad1d96f" title="Fast Walsh Hadamard Transform.">dwht</a>(<span class="keyword">const</span> cvec &amp;vin, cvec &amp;vout);
293<a name="l00369"></a>00369
294<a name="l00370"></a>00370 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keywordtype">void</span> <a class="code" href="group__fht.html#ge57eb770500e2e9f8ebca20546670a4d" title="Fast Walsh Hadamard Transform - memory efficient (result in v).">self_dwht</a>(vec &amp;v);
295<a name="l00371"></a>00371 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keywordtype">void</span> <a class="code" href="group__fht.html#ge57eb770500e2e9f8ebca20546670a4d" title="Fast Walsh Hadamard Transform - memory efficient (result in v).">self_dwht</a>(cvec &amp;v);
296<a name="l00372"></a>00372
297<a name="l00373"></a>00373 <span class="keyword">extern</span> <span class="keyword">template</span> mat  <a class="code" href="group__fht.html#g1f0aff290f44fb18211840c97ab392cd" title="Fast 2D Hadamard Transform.">dht2</a>(<span class="keyword">const</span> mat &amp;m);
298<a name="l00374"></a>00374 <span class="keyword">extern</span> <span class="keyword">template</span> cmat <a class="code" href="group__fht.html#g1f0aff290f44fb18211840c97ab392cd" title="Fast 2D Hadamard Transform.">dht2</a>(<span class="keyword">const</span> cmat &amp;m);
299<a name="l00375"></a>00375
300<a name="l00376"></a>00376 <span class="keyword">extern</span> <span class="keyword">template</span> mat  <a class="code" href="group__fht.html#g002b2897a60f4ad7bccc33f8342a7d4a" title="Fast 2D Walsh Hadamard Transform.">dwht2</a>(<span class="keyword">const</span> mat &amp;m);
301<a name="l00377"></a>00377 <span class="keyword">extern</span> <span class="keyword">template</span> cmat <a class="code" href="group__fht.html#g002b2897a60f4ad7bccc33f8342a7d4a" title="Fast 2D Walsh Hadamard Transform.">dwht2</a>(<span class="keyword">const</span> cmat &amp;m);
302<a name="l00378"></a>00378
303<a name="l00379"></a>00379 <span class="preprocessor">#endif // HAVE_EXTERN_TEMPLATE</span>
304<a name="l00380"></a>00380 <span class="preprocessor"></span>
305<a name="l00382"></a>00382
306<a name="l00383"></a>00383 } <span class="comment">// namespace itpp</span>
307<a name="l00384"></a>00384
308<a name="l00385"></a>00385 <span class="preprocessor">#endif // #ifndef TRANSFORMS_H</span>
309</pre></div></div>
310<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:13 2009 for mixpp by&nbsp;
311<a href="http://www.doxygen.org/index.html">
312<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
313</body>
314</html>
Note: See TracBrowser for help on using the browser.