[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: modulator.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>modulator.h</h1><a href="modulator_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 MODULATOR_H</span> |
---|
| 67 | <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define MODULATOR_H</span> |
---|
| 68 | <a name="l00031"></a>00031 <span class="preprocessor"></span> |
---|
| 69 | <a name="l00032"></a>00032 <span class="preprocessor">#include <<a class="code" href="mat_8h.html" title="Matrix Class Definitions.">itpp/base/mat.h</a>></span> |
---|
| 70 | <a name="l00033"></a>00033 <span class="preprocessor">#include <<a class="code" href="elem__math_8h.html" title="Elementary mathematical functions - header file.">itpp/base/math/elem_math.h</a>></span> |
---|
| 71 | <a name="l00034"></a>00034 <span class="preprocessor">#include <<a class="code" href="log__exp_8h.html" title="Logarithmic and exponenential functions - header file.">itpp/base/math/log_exp.h</a>></span> |
---|
| 72 | <a name="l00035"></a>00035 <span class="preprocessor">#include <<a class="code" href="converters_8h.html" title="Definitions of converters between different vector and matrix types.">itpp/base/converters.h</a>></span> |
---|
| 73 | <a name="l00036"></a>00036 <span class="preprocessor">#include <<a class="code" href="min__max_8h.html" title="Minimum and maximum functions on vectors and matrices.">itpp/base/math/min_max.h</a>></span> |
---|
| 74 | <a name="l00037"></a>00037 |
---|
| 75 | <a name="l00038"></a>00038 |
---|
| 76 | <a name="l00039"></a>00039 <span class="keyword">namespace </span>itpp |
---|
| 77 | <a name="l00040"></a>00040 { |
---|
| 78 | <a name="l00041"></a>00041 |
---|
| 79 | <a name="l00046"></a><a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7">00046</a> <span class="keyword">enum</span> <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> { |
---|
| 80 | <a name="l00047"></a><a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2">00047</a> <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>, |
---|
| 81 | <a name="l00048"></a><a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa736e6054ea31bed86e14010b23c579e76">00048</a> <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa736e6054ea31bed86e14010b23c579e76" title="Approximate faster method.">APPROX</a> |
---|
| 82 | <a name="l00049"></a>00049 }; |
---|
| 83 | <a name="l00050"></a>00050 |
---|
| 84 | <a name="l00073"></a>00073 <span class="keyword">template</span> <<span class="keyword">typename</span> T> |
---|
| 85 | <a name="l00074"></a><a class="code" href="classitpp_1_1Modulator.html">00074</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1Modulator.html" title="General modulator for 1D or 2D signal constellations.">Modulator</a> |
---|
| 86 | <a name="l00075"></a>00075 { |
---|
| 87 | <a name="l00076"></a>00076 <span class="keyword">public</span>: |
---|
| 88 | <a name="l00078"></a>00078 <a class="code" href="classitpp_1_1Modulator.html#a3306fe1944bb997c9584a7238ec3d53" title="Default constructor.">Modulator</a>(); |
---|
| 89 | <a name="l00080"></a>00080 <a class="code" href="classitpp_1_1Modulator.html#a3306fe1944bb997c9584a7238ec3d53" title="Default constructor.">Modulator</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& <a class="code" href="classitpp_1_1Modulator.html#3069840e9e7a44180615fb772cf9ae42" title="Corresponding modulation symbols (size: M).">symbols</a>, <span class="keyword">const</span> ivec& <a class="code" href="classitpp_1_1Modulator.html#3ca26614189cb7a66da369bf0c4b9070" title="Bit to symbol mapping in decimal form (size: M).">bits2symbols</a>); |
---|
| 90 | <a name="l00082"></a><a class="code" href="classitpp_1_1Modulator.html#ce8f01d9637358c1dbfd1a605fdaf091">00082</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1Modulator.html#ce8f01d9637358c1dbfd1a605fdaf091" title="Destructor.">~Modulator</a>() {} |
---|
| 91 | <a name="l00083"></a>00083 |
---|
| 92 | <a name="l00085"></a>00085 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& symbols, <span class="keyword">const</span> ivec& bits2symbols); |
---|
| 93 | <a name="l00086"></a>00086 |
---|
| 94 | <a name="l00088"></a><a class="code" href="classitpp_1_1Modulator.html#6e7cfa06570e2a1de515be5222a53a83">00088</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Modulator.html#6e7cfa06570e2a1de515be5222a53a83" title="Returns number of bits per symbol.">bits_per_symbol</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>; } |
---|
| 95 | <a name="l00090"></a><a class="code" href="classitpp_1_1Modulator.html#28b1c28bf8f4596e4d5149f1f3c8cd76">00090</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> <a class="code" href="classitpp_1_1Modulator.html#28b1c28bf8f4596e4d5149f1f3c8cd76" title="Get the symbol values used in the modulator.">get_symbols</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> symbols; } |
---|
| 96 | <a name="l00108"></a><a class="code" href="classitpp_1_1Modulator.html#a8186f0e837fd3d440a6acb7a0225d35">00108</a> <span class="keyword">virtual</span> ivec <a class="code" href="classitpp_1_1Modulator.html#a8186f0e837fd3d440a6acb7a0225d35" title="Get the bitmap, which maps input bits into symbols.">get_bits2symbols</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> bits2symbols; } |
---|
| 97 | <a name="l00109"></a>00109 |
---|
| 98 | <a name="l00111"></a>00111 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#4f7bde9d3bfa9e39c06017534e3f6647" title="Modulation of symbols.">modulate</a>(<span class="keyword">const</span> ivec& symbolnumbers, <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& output) <span class="keyword">const</span>; |
---|
| 99 | <a name="l00113"></a>00113 <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> <a class="code" href="classitpp_1_1Modulator.html#4f7bde9d3bfa9e39c06017534e3f6647" title="Modulation of symbols.">modulate</a>(<span class="keyword">const</span> ivec& symbolnumbers) <span class="keyword">const</span>; |
---|
| 100 | <a name="l00114"></a>00114 |
---|
| 101 | <a name="l00116"></a>00116 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#845b5fbf4dad59edd3772627250623a1" title="Demodulation of symbols.">demodulate</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& signal, ivec& output) <span class="keyword">const</span>; |
---|
| 102 | <a name="l00118"></a>00118 <span class="keyword">virtual</span> ivec <a class="code" href="classitpp_1_1Modulator.html#845b5fbf4dad59edd3772627250623a1" title="Demodulation of symbols.">demodulate</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& signal) <span class="keyword">const</span>; |
---|
| 103 | <a name="l00119"></a>00119 |
---|
| 104 | <a name="l00121"></a>00121 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#53826bf7e0ec83b99592235b0c2f6235" title="Modulation of bits.">modulate_bits</a>(<span class="keyword">const</span> bvec& bits, <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& output) <span class="keyword">const</span>; |
---|
| 105 | <a name="l00123"></a>00123 <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> <a class="code" href="classitpp_1_1Modulator.html#53826bf7e0ec83b99592235b0c2f6235" title="Modulation of bits.">modulate_bits</a>(<span class="keyword">const</span> bvec& bits) <span class="keyword">const</span>; |
---|
| 106 | <a name="l00124"></a>00124 |
---|
| 107 | <a name="l00126"></a>00126 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#4d03bbe8bd467898f149d5f134f6f120" title="Hard demodulation of bits.">demodulate_bits</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& signal, bvec& bits) <span class="keyword">const</span>; |
---|
| 108 | <a name="l00128"></a>00128 <span class="keyword">virtual</span> bvec <a class="code" href="classitpp_1_1Modulator.html#4d03bbe8bd467898f149d5f134f6f120" title="Hard demodulation of bits.">demodulate_bits</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& signal) <span class="keyword">const</span>; |
---|
| 109 | <a name="l00129"></a>00129 |
---|
| 110 | <a name="l00169"></a>00169 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#9beffaf8f69378f9c20a85f3023bd9af" title="Soft demodulator for AWGN channels.">demodulate_soft_bits</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& rx_symbols, <span class="keywordtype">double</span> N0, |
---|
| 111 | <a name="l00170"></a>00170 vec& soft_bits, |
---|
| 112 | <a name="l00171"></a>00171 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 113 | <a name="l00173"></a>00173 <span class="keyword">virtual</span> vec <a class="code" href="classitpp_1_1Modulator.html#9beffaf8f69378f9c20a85f3023bd9af" title="Soft demodulator for AWGN channels.">demodulate_soft_bits</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& rx_symbols, <span class="keywordtype">double</span> N0, |
---|
| 114 | <a name="l00174"></a>00174 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 115 | <a name="l00175"></a>00175 |
---|
| 116 | <a name="l00214"></a>00214 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#9beffaf8f69378f9c20a85f3023bd9af" title="Soft demodulator for AWGN channels.">demodulate_soft_bits</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& rx_symbols, |
---|
| 117 | <a name="l00215"></a>00215 <span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& channel, |
---|
| 118 | <a name="l00216"></a>00216 <span class="keywordtype">double</span> N0, vec& soft_bits, |
---|
| 119 | <a name="l00217"></a>00217 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 120 | <a name="l00219"></a>00219 <span class="keyword">virtual</span> vec <a class="code" href="classitpp_1_1Modulator.html#9beffaf8f69378f9c20a85f3023bd9af" title="Soft demodulator for AWGN channels.">demodulate_soft_bits</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& rx_symbols, |
---|
| 121 | <a name="l00220"></a>00220 <span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& channel, |
---|
| 122 | <a name="l00221"></a>00221 <span class="keywordtype">double</span> N0, |
---|
| 123 | <a name="l00222"></a>00222 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 124 | <a name="l00223"></a>00223 |
---|
| 125 | <a name="l00224"></a>00224 <span class="keyword">protected</span>: |
---|
| 126 | <a name="l00226"></a><a class="code" href="classitpp_1_1Modulator.html#552cd7add3e998eca485d0ea39808e0d">00226</a> <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1Modulator.html#552cd7add3e998eca485d0ea39808e0d" title="Setup indicator.">setup_done</a>; |
---|
| 127 | <a name="l00228"></a><a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6">00228</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>; |
---|
| 128 | <a name="l00230"></a><a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b">00230</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>; |
---|
| 129 | <a name="l00232"></a><a class="code" href="classitpp_1_1Modulator.html#1b1a9a706c0736c51966703bea58cf48">00232</a> <a class="code" href="mat_8h.html#f90acd1af41bf2d1d8a4bb23662fff69" title="bin matrix">bmat</a> <a class="code" href="classitpp_1_1Modulator.html#1b1a9a706c0736c51966703bea58cf48" title="Bit to symbol mapping table (size: M x k).">bitmap</a>; |
---|
| 130 | <a name="l00234"></a><a class="code" href="classitpp_1_1Modulator.html#3ca26614189cb7a66da369bf0c4b9070">00234</a> ivec bits2symbols; |
---|
| 131 | <a name="l00236"></a><a class="code" href="classitpp_1_1Modulator.html#3069840e9e7a44180615fb772cf9ae42">00236</a> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> symbols; |
---|
| 132 | <a name="l00239"></a><a class="code" href="classitpp_1_1Modulator.html#c19c8fe07e95e4eb80e832a633b7c422">00239</a> imat <a class="code" href="classitpp_1_1Modulator.html#c19c8fe07e95e4eb80e832a633b7c422" title="Matrix where row k contains the constellation points with &#39;0&#39; in bit position...">S0</a>; |
---|
| 133 | <a name="l00242"></a><a class="code" href="classitpp_1_1Modulator.html#9d4c223ffd96fdc5b26ba5c44956998b">00242</a> imat <a class="code" href="classitpp_1_1Modulator.html#9d4c223ffd96fdc5b26ba5c44956998b" title="Matrix where row k contains the constellation points with &#39;1&#39; in bit position...">S1</a>; |
---|
| 134 | <a name="l00243"></a>00243 |
---|
| 135 | <a name="l00245"></a>00245 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#bb3e654a3fb6d127ee8d266677689233" title="This function calculates the soft bit mapping matrices S0 and S1.">calculate_softbit_matrices</a>(); |
---|
| 136 | <a name="l00246"></a>00246 }; |
---|
| 137 | <a name="l00247"></a>00247 |
---|
| 138 | <a name="l00248"></a>00248 |
---|
| 139 | <a name="l00249"></a>00249 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 140 | <a name="l00250"></a>00250 <span class="comment">// Type definitions of Modulator_1D and Modulator_2D</span> |
---|
| 141 | <a name="l00251"></a>00251 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 142 | <a name="l00252"></a>00252 |
---|
| 143 | <a name="l00257"></a><a class="code" href="classitpp_1_1Modulator.html#d47d1377dffb2aed9f21f8f976e80a0a">00257</a> <span class="keyword">typedef</span> <a class="code" href="classitpp_1_1Modulator.html">Modulator<double></a> <a class="code" href="classitpp_1_1Modulator.html">Modulator_1D</a>; |
---|
| 144 | <a name="l00258"></a>00258 |
---|
| 145 | <a name="l00263"></a><a class="code" href="classitpp_1_1Modulator.html#97dc4e87ae4fa63c4e7dbbeac0ab00b0">00263</a> <span class="keyword">typedef</span> <a class="code" href="classitpp_1_1Modulator.html" title="General modulator for 1D or 2D signal constellations.">Modulator<std::complex<double></a> > <a class="code" href="classitpp_1_1Modulator.html">Modulator_2D</a>; |
---|
| 146 | <a name="l00264"></a>00264 |
---|
| 147 | <a name="l00265"></a>00265 |
---|
| 148 | <a name="l00266"></a>00266 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 149 | <a name="l00267"></a>00267 <span class="comment">// Implementation of templated Modulator members</span> |
---|
| 150 | <a name="l00268"></a>00268 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 151 | <a name="l00269"></a>00269 |
---|
| 152 | <a name="l00270"></a>00270 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 153 | <a name="l00271"></a><a class="code" href="classitpp_1_1Modulator.html#a3306fe1944bb997c9584a7238ec3d53">00271</a> <a class="code" href="classitpp_1_1Modulator.html#a3306fe1944bb997c9584a7238ec3d53" title="Default constructor.">Modulator<T>::Modulator</a>() : |
---|
| 154 | <a name="l00272"></a>00272 setup_done(false), k(0), M(0), bitmap(<span class="stringliteral">""</span>), bits2symbols(<span class="stringliteral">""</span>), symbols(<span class="stringliteral">""</span>), |
---|
| 155 | <a name="l00273"></a>00273 S0(<span class="stringliteral">""</span>), S1(<span class="stringliteral">""</span>) {} |
---|
| 156 | <a name="l00274"></a>00274 |
---|
| 157 | <a name="l00275"></a>00275 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 158 | <a name="l00276"></a><a class="code" href="classitpp_1_1Modulator.html#0f04d4e434d5f5b4d427ef153d724c33">00276</a> <a class="code" href="classitpp_1_1Modulator.html#a3306fe1944bb997c9584a7238ec3d53" title="Default constructor.">Modulator<T>::Modulator</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> &symbols, <span class="keyword">const</span> ivec &bits2symbols) |
---|
| 159 | <a name="l00277"></a>00277 { |
---|
| 160 | <a name="l00278"></a>00278 <span class="keyword">set</span>(symbols, bits2symbols); |
---|
| 161 | <a name="l00279"></a>00279 } |
---|
| 162 | <a name="l00280"></a>00280 |
---|
| 163 | <a name="l00281"></a>00281 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 164 | <a name="l00282"></a><a class="code" href="classitpp_1_1Modulator.html#b9722a6826869c6d6e15a9835d76239b">00282</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#b9722a6826869c6d6e15a9835d76239b" title="Set the constellation to use in the modulator.">Modulator<T>::set</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> &in_symbols, <span class="keyword">const</span> ivec &in_bits2symbols) |
---|
| 165 | <a name="l00283"></a>00283 { |
---|
| 166 | <a name="l00284"></a>00284 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(in_symbols.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>() == in_bits2symbols.size(), |
---|
| 167 | <a name="l00285"></a>00285 <span class="stringliteral">"Modulator<T>::set(): Number of symbols and bits2symbols does not match"</span>); |
---|
| 168 | <a name="l00286"></a>00286 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(<a class="code" href="group__miscfunc.html#g7fa3ce6e66b7a5cfd8a19afbaade3e07" title="Return true if x is an even integer.">is_even</a>(in_symbols.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>()) && (in_symbols.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>() > 0), |
---|
| 169 | <a name="l00287"></a>00287 <span class="stringliteral">"Modulator<T>::set(): Number of symbols needs to be even and non-zero"</span>); |
---|
| 170 | <a name="l00288"></a>00288 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>((<a class="code" href="group__protocol.html#g3e4e78a5230c444344a135c661163ef2" title="ADD DOCUMENTATION HERE.">max</a>(in_bits2symbols) == in_bits2symbols.size() - 1) |
---|
| 171 | <a name="l00289"></a>00289 && (<a class="code" href="group__protocol.html#g27dde5be5aac902c0de838b4b872cd2f" title="ADD DOCUMENTATION HERE.">min</a>(in_bits2symbols) == 0), <span class="stringliteral">"Modulator<T>::set(): Improper bits2symbol vector"</span>); |
---|
| 172 | <a name="l00290"></a>00290 <a class="code" href="classitpp_1_1Modulator.html#3069840e9e7a44180615fb772cf9ae42" title="Corresponding modulation symbols (size: M).">symbols</a> = in_symbols; |
---|
| 173 | <a name="l00291"></a>00291 <a class="code" href="classitpp_1_1Modulator.html#3ca26614189cb7a66da369bf0c4b9070" title="Bit to symbol mapping in decimal form (size: M).">bits2symbols</a> = in_bits2symbols; |
---|
| 174 | <a name="l00292"></a>00292 <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a> = <a class="code" href="classitpp_1_1Modulator.html#3ca26614189cb7a66da369bf0c4b9070" title="Bit to symbol mapping in decimal form (size: M).">bits2symbols</a>.size(); |
---|
| 175 | <a name="l00293"></a>00293 <a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a> = <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>(<a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>); |
---|
| 176 | <a name="l00294"></a>00294 <a class="code" href="classitpp_1_1Modulator.html#1b1a9a706c0736c51966703bea58cf48" title="Bit to symbol mapping table (size: M x k).">bitmap</a>.set_size(<a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>, <a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>); |
---|
| 177 | <a name="l00295"></a>00295 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> m = 0; m < <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>; m++) { |
---|
| 178 | <a name="l00296"></a>00296 <a class="code" href="classitpp_1_1Modulator.html#1b1a9a706c0736c51966703bea58cf48" title="Bit to symbol mapping table (size: M x k).">bitmap</a>.set_row(<a class="code" href="classitpp_1_1Modulator.html#3ca26614189cb7a66da369bf0c4b9070" title="Bit to symbol mapping in decimal form (size: M).">bits2symbols</a>(m), <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>(<a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>, m)); |
---|
| 179 | <a name="l00297"></a>00297 } |
---|
| 180 | <a name="l00298"></a>00298 <a class="code" href="classitpp_1_1Modulator.html#bb3e654a3fb6d127ee8d266677689233" title="This function calculates the soft bit mapping matrices S0 and S1.">calculate_softbit_matrices</a>(); |
---|
| 181 | <a name="l00299"></a>00299 <a class="code" href="classitpp_1_1Modulator.html#552cd7add3e998eca485d0ea39808e0d" title="Setup indicator.">setup_done</a> = <span class="keyword">true</span>; |
---|
| 182 | <a name="l00300"></a>00300 } |
---|
| 183 | <a name="l00301"></a>00301 |
---|
| 184 | <a name="l00302"></a>00302 |
---|
| 185 | <a name="l00303"></a>00303 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 186 | <a name="l00304"></a><a class="code" href="classitpp_1_1Modulator.html#4f7bde9d3bfa9e39c06017534e3f6647">00304</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#4f7bde9d3bfa9e39c06017534e3f6647" title="Modulation of symbols.">Modulator<T>::modulate</a>(<span class="keyword">const</span> ivec &symbolnumbers, <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& output)<span class="keyword"> const</span> |
---|
| 187 | <a name="l00305"></a>00305 <span class="keyword"></span>{ |
---|
| 188 | <a name="l00306"></a>00306 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(<a class="code" href="classitpp_1_1Modulator.html#552cd7add3e998eca485d0ea39808e0d" title="Setup indicator.">setup_done</a>, <span class="stringliteral">"Modulator<T>::modulate(): Modulator not ready."</span>); |
---|
| 189 | <a name="l00307"></a>00307 output.<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>(symbolnumbers.length()); |
---|
| 190 | <a name="l00308"></a>00308 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < symbolnumbers.length(); i++) |
---|
| 191 | <a name="l00309"></a>00309 output(i) = <a class="code" href="classitpp_1_1Modulator.html#3069840e9e7a44180615fb772cf9ae42" title="Corresponding modulation symbols (size: M).">symbols</a>(symbolnumbers(i)); |
---|
| 192 | <a name="l00310"></a>00310 } |
---|
| 193 | <a name="l00311"></a>00311 |
---|
| 194 | <a name="l00312"></a>00312 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 195 | <a name="l00313"></a><a class="code" href="classitpp_1_1Modulator.html#e0cb2673987e110920b519c139cdebe1">00313</a> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> <a class="code" href="classitpp_1_1Modulator.html#4f7bde9d3bfa9e39c06017534e3f6647" title="Modulation of symbols.">Modulator<T>::modulate</a>(<span class="keyword">const</span> ivec &symbolnumbers)<span class="keyword"> const</span> |
---|
| 196 | <a name="l00314"></a>00314 <span class="keyword"></span>{ |
---|
| 197 | <a name="l00315"></a>00315 <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> output(symbolnumbers.length()); |
---|
| 198 | <a name="l00316"></a>00316 <a class="code" href="classitpp_1_1Modulator.html#4f7bde9d3bfa9e39c06017534e3f6647" title="Modulation of symbols.">modulate</a>(symbolnumbers, output); |
---|
| 199 | <a name="l00317"></a>00317 <span class="keywordflow">return</span> output; |
---|
| 200 | <a name="l00318"></a>00318 } |
---|
| 201 | <a name="l00319"></a>00319 |
---|
| 202 | <a name="l00320"></a>00320 |
---|
| 203 | <a name="l00321"></a>00321 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 204 | <a name="l00322"></a><a class="code" href="classitpp_1_1Modulator.html#845b5fbf4dad59edd3772627250623a1">00322</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#845b5fbf4dad59edd3772627250623a1" title="Demodulation of symbols.">Modulator<T>::demodulate</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> &signal, ivec& output)<span class="keyword"> const</span> |
---|
| 205 | <a name="l00323"></a>00323 <span class="keyword"></span>{ |
---|
| 206 | <a name="l00324"></a>00324 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(<a class="code" href="classitpp_1_1Modulator.html#552cd7add3e998eca485d0ea39808e0d" title="Setup indicator.">setup_done</a>, <span class="stringliteral">"Modulator<T>::demodulate(): Modulator not ready."</span>); |
---|
| 207 | <a name="l00325"></a>00325 <span class="keywordtype">double</span> dist, mindist; |
---|
| 208 | <a name="l00326"></a>00326 <span class="keywordtype">int</span> closest; |
---|
| 209 | <a name="l00327"></a>00327 output.set_size(signal.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>()); |
---|
| 210 | <a name="l00328"></a>00328 |
---|
| 211 | <a name="l00329"></a>00329 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < signal.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>(); i++) { |
---|
| 212 | <a name="l00330"></a>00330 mindist = <a class="code" href="group__fixed.html#ge0a38d51b2bf99a0ba07f2f8885e6adc" title="Absolute value.">std::abs</a>(<a class="code" href="classitpp_1_1Modulator.html#3069840e9e7a44180615fb772cf9ae42" title="Corresponding modulation symbols (size: M).">symbols</a>(0) - signal(i)); |
---|
| 213 | <a name="l00331"></a>00331 closest = 0; |
---|
| 214 | <a name="l00332"></a>00332 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 1; j < <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>; j++) { |
---|
| 215 | <a name="l00333"></a>00333 dist = <a class="code" href="group__fixed.html#ge0a38d51b2bf99a0ba07f2f8885e6adc" title="Absolute value.">std::abs</a>(<a class="code" href="classitpp_1_1Modulator.html#3069840e9e7a44180615fb772cf9ae42" title="Corresponding modulation symbols (size: M).">symbols</a>(j) - signal(i)); |
---|
| 216 | <a name="l00334"></a>00334 <span class="keywordflow">if</span> (dist < mindist) { |
---|
| 217 | <a name="l00335"></a>00335 mindist = dist; |
---|
| 218 | <a name="l00336"></a>00336 closest = j; |
---|
| 219 | <a name="l00337"></a>00337 } |
---|
| 220 | <a name="l00338"></a>00338 } |
---|
| 221 | <a name="l00339"></a>00339 output(i) = closest; |
---|
| 222 | <a name="l00340"></a>00340 } |
---|
| 223 | <a name="l00341"></a>00341 } |
---|
| 224 | <a name="l00342"></a>00342 |
---|
| 225 | <a name="l00343"></a>00343 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 226 | <a name="l00344"></a><a class="code" href="classitpp_1_1Modulator.html#7f2c15efa18d1cb46b8c97723c11ec9d">00344</a> ivec <a class="code" href="classitpp_1_1Modulator.html#845b5fbf4dad59edd3772627250623a1" title="Demodulation of symbols.">Modulator<T>::demodulate</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& signal)<span class="keyword"> const</span> |
---|
| 227 | <a name="l00345"></a>00345 <span class="keyword"></span>{ |
---|
| 228 | <a name="l00346"></a>00346 ivec output(signal.<a class="code" href="classitpp_1_1Vec.html#44478ea086eda22a180102e77e352325" title="The size of the vector.">length</a>()); |
---|
| 229 | <a name="l00347"></a>00347 <a class="code" href="classitpp_1_1Modulator.html#845b5fbf4dad59edd3772627250623a1" title="Demodulation of symbols.">demodulate</a>(signal, output); |
---|
| 230 | <a name="l00348"></a>00348 <span class="keywordflow">return</span> output; |
---|
| 231 | <a name="l00349"></a>00349 } |
---|
| 232 | <a name="l00350"></a>00350 |
---|
| 233 | <a name="l00351"></a>00351 |
---|
| 234 | <a name="l00352"></a>00352 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 235 | <a name="l00353"></a><a class="code" href="classitpp_1_1Modulator.html#53826bf7e0ec83b99592235b0c2f6235">00353</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#53826bf7e0ec83b99592235b0c2f6235" title="Modulation of bits.">Modulator<T>::modulate_bits</a>(<span class="keyword">const</span> bvec &bits, <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> &output)<span class="keyword"> const</span> |
---|
| 236 | <a name="l00354"></a>00354 <span class="keyword"></span>{ |
---|
| 237 | <a name="l00355"></a>00355 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(<a class="code" href="classitpp_1_1Modulator.html#552cd7add3e998eca485d0ea39808e0d" title="Setup indicator.">setup_done</a>, <span class="stringliteral">"Modulator<T>::modulate_bits(): Modulator not ready."</span>); |
---|
| 238 | <a name="l00356"></a>00356 <span class="comment">// Check if some bits have to be cut and print warning message in such</span> |
---|
| 239 | <a name="l00357"></a>00357 <span class="comment">// case.</span> |
---|
| 240 | <a name="l00358"></a>00358 <span class="keywordflow">if</span> (bits.length() % <a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>) { |
---|
| 241 | <a name="l00359"></a>00359 <a class="code" href="group__errorhandlingfunc.html#g365842195965b61b7ab3ac7938c58b77" title="Display a warning message.">it_warning</a>(<span class="stringliteral">"Modulator<T>::modulate_bits(): The number of input bits is not a multiple of k (number of bits per symbol). Remainder bits are not modulated."</span>); |
---|
| 242 | <a name="l00360"></a>00360 } |
---|
| 243 | <a name="l00361"></a>00361 <span class="keywordtype">int</span> no_symbols = bits.length() / <a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>; |
---|
| 244 | <a name="l00362"></a>00362 output.<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>(no_symbols); |
---|
| 245 | <a name="l00363"></a>00363 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < no_symbols; i++) { |
---|
| 246 | <a name="l00364"></a>00364 output(i) = <a class="code" href="classitpp_1_1Modulator.html#3069840e9e7a44180615fb772cf9ae42" title="Corresponding modulation symbols (size: M).">symbols</a>(<a class="code" href="classitpp_1_1Modulator.html#3ca26614189cb7a66da369bf0c4b9070" title="Bit to symbol mapping in decimal form (size: M).">bits2symbols</a>(<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>(bits.mid(i * <a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>, k)))); |
---|
| 247 | <a name="l00365"></a>00365 } |
---|
| 248 | <a name="l00366"></a>00366 } |
---|
| 249 | <a name="l00367"></a>00367 |
---|
| 250 | <a name="l00368"></a>00368 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 251 | <a name="l00369"></a><a class="code" href="classitpp_1_1Modulator.html#622fa1ce4243330b7efa0605a9492513">00369</a> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> <a class="code" href="classitpp_1_1Modulator.html#53826bf7e0ec83b99592235b0c2f6235" title="Modulation of bits.">Modulator<T>::modulate_bits</a>(<span class="keyword">const</span> bvec &bits)<span class="keyword"> const</span> |
---|
| 252 | <a name="l00370"></a>00370 <span class="keyword"></span>{ |
---|
| 253 | <a name="l00371"></a>00371 <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> output; |
---|
| 254 | <a name="l00372"></a>00372 <a class="code" href="classitpp_1_1Modulator.html#53826bf7e0ec83b99592235b0c2f6235" title="Modulation of bits.">modulate_bits</a>(bits, output); |
---|
| 255 | <a name="l00373"></a>00373 <span class="keywordflow">return</span> output; |
---|
| 256 | <a name="l00374"></a>00374 } |
---|
| 257 | <a name="l00375"></a>00375 |
---|
| 258 | <a name="l00376"></a>00376 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 259 | <a name="l00377"></a><a class="code" href="classitpp_1_1Modulator.html#4d03bbe8bd467898f149d5f134f6f120">00377</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#4d03bbe8bd467898f149d5f134f6f120" title="Hard demodulation of bits.">Modulator<T>::demodulate_bits</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> &signal, bvec &bits)<span class="keyword"> const</span> |
---|
| 260 | <a name="l00378"></a>00378 <span class="keyword"></span>{ |
---|
| 261 | <a name="l00379"></a>00379 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(<a class="code" href="classitpp_1_1Modulator.html#552cd7add3e998eca485d0ea39808e0d" title="Setup indicator.">setup_done</a>, <span class="stringliteral">"Modulator<T>::demodulate_bist(): Modulator not ready."</span>); |
---|
| 262 | <a name="l00380"></a>00380 <span class="keywordtype">double</span> dist, mindist; |
---|
| 263 | <a name="l00381"></a>00381 <span class="keywordtype">int</span> closest; |
---|
| 264 | <a name="l00382"></a>00382 bits.set_size(<a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>*signal.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>()); |
---|
| 265 | <a name="l00383"></a>00383 |
---|
| 266 | <a name="l00384"></a>00384 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < signal.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>(); i++) { |
---|
| 267 | <a name="l00385"></a>00385 mindist = <a class="code" href="group__fixed.html#ge0a38d51b2bf99a0ba07f2f8885e6adc" title="Absolute value.">std::abs</a>(<a class="code" href="classitpp_1_1Modulator.html#3069840e9e7a44180615fb772cf9ae42" title="Corresponding modulation symbols (size: M).">symbols</a>(0) - signal(i)); |
---|
| 268 | <a name="l00386"></a>00386 closest = 0; |
---|
| 269 | <a name="l00387"></a>00387 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 1; j < <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>; j++) { |
---|
| 270 | <a name="l00388"></a>00388 dist = <a class="code" href="group__fixed.html#ge0a38d51b2bf99a0ba07f2f8885e6adc" title="Absolute value.">std::abs</a>(<a class="code" href="classitpp_1_1Modulator.html#3069840e9e7a44180615fb772cf9ae42" title="Corresponding modulation symbols (size: M).">symbols</a>(j) - signal(i)); |
---|
| 271 | <a name="l00389"></a>00389 <span class="keywordflow">if</span> (dist < mindist) { |
---|
| 272 | <a name="l00390"></a>00390 mindist = dist; |
---|
| 273 | <a name="l00391"></a>00391 closest = j; |
---|
| 274 | <a name="l00392"></a>00392 } |
---|
| 275 | <a name="l00393"></a>00393 } |
---|
| 276 | <a name="l00394"></a>00394 bits.replace_mid(i*<a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>, <a class="code" href="classitpp_1_1Modulator.html#1b1a9a706c0736c51966703bea58cf48" title="Bit to symbol mapping table (size: M x k).">bitmap</a>.get_row(closest)); |
---|
| 277 | <a name="l00395"></a>00395 } |
---|
| 278 | <a name="l00396"></a>00396 } |
---|
| 279 | <a name="l00397"></a>00397 |
---|
| 280 | <a name="l00398"></a>00398 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 281 | <a name="l00399"></a><a class="code" href="classitpp_1_1Modulator.html#9e3432dad687ac0ee102c208e34920f8">00399</a> bvec <a class="code" href="classitpp_1_1Modulator.html#4d03bbe8bd467898f149d5f134f6f120" title="Hard demodulation of bits.">Modulator<T>::demodulate_bits</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> &signal)<span class="keyword"> const</span> |
---|
| 282 | <a name="l00400"></a>00400 <span class="keyword"></span>{ |
---|
| 283 | <a name="l00401"></a>00401 bvec bits; |
---|
| 284 | <a name="l00402"></a>00402 <a class="code" href="classitpp_1_1Modulator.html#4d03bbe8bd467898f149d5f134f6f120" title="Hard demodulation of bits.">demodulate_bits</a>(signal, bits); |
---|
| 285 | <a name="l00403"></a>00403 <span class="keywordflow">return</span> bits; |
---|
| 286 | <a name="l00404"></a>00404 } |
---|
| 287 | <a name="l00405"></a>00405 |
---|
| 288 | <a name="l00406"></a>00406 |
---|
| 289 | <a name="l00407"></a>00407 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 290 | <a name="l00408"></a><a class="code" href="classitpp_1_1Modulator.html#9beffaf8f69378f9c20a85f3023bd9af">00408</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#9beffaf8f69378f9c20a85f3023bd9af" title="Soft demodulator for AWGN channels.">Modulator<T>::demodulate_soft_bits</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> &rx_symbols, <span class="keywordtype">double</span> N0, |
---|
| 291 | <a name="l00409"></a>00409 vec &soft_bits, |
---|
| 292 | <a name="l00410"></a>00410 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method)<span class="keyword"> const</span> |
---|
| 293 | <a name="l00411"></a>00411 <span class="keyword"></span>{ |
---|
| 294 | <a name="l00412"></a>00412 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(<a class="code" href="classitpp_1_1Modulator.html#552cd7add3e998eca485d0ea39808e0d" title="Setup indicator.">setup_done</a>, <span class="stringliteral">"Modulator<T>::demodulate_soft_bits(): Modulator not ready."</span>); |
---|
| 295 | <a name="l00413"></a>00413 <span class="keywordtype">double</span> P0, P1, d0min, d1min, temp; |
---|
| 296 | <a name="l00414"></a>00414 vec metric(<a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>); |
---|
| 297 | <a name="l00415"></a>00415 |
---|
| 298 | <a name="l00416"></a>00416 soft_bits.set_size(<a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a> * rx_symbols.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>()); |
---|
| 299 | <a name="l00417"></a>00417 |
---|
| 300 | <a name="l00418"></a>00418 <span class="keywordflow">if</span> (method == <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) { |
---|
| 301 | <a name="l00419"></a>00419 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> l = 0; l < rx_symbols.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>(); l++) { |
---|
| 302 | <a name="l00420"></a>00420 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>; j++) { |
---|
| 303 | <a name="l00421"></a>00421 metric(j) = <a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335" title="Exp of the elements of a complex matrix m.">std::exp</a>(-<a class="code" href="group__miscfunc.html#gd0a08400c5087615cb59d95c3e05ba38" title="Square of elements.">sqr</a>(rx_symbols(l) - <a class="code" href="classitpp_1_1Modulator.html#3069840e9e7a44180615fb772cf9ae42" title="Corresponding modulation symbols (size: M).">symbols</a>(j)) / N0); |
---|
| 304 | <a name="l00422"></a>00422 } |
---|
| 305 | <a name="l00423"></a>00423 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>; i++) { |
---|
| 306 | <a name="l00424"></a>00424 P0 = P1 = 0; |
---|
| 307 | <a name="l00425"></a>00425 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < (M >> 1); j++) { |
---|
| 308 | <a name="l00426"></a>00426 P0 += metric(<a class="code" href="classitpp_1_1Modulator.html#c19c8fe07e95e4eb80e832a633b7c422" title="Matrix where row k contains the constellation points with &#39;0&#39; in bit position...">S0</a>(i, j)); |
---|
| 309 | <a name="l00427"></a>00427 P1 += metric(<a class="code" href="classitpp_1_1Modulator.html#9d4c223ffd96fdc5b26ba5c44956998b" title="Matrix where row k contains the constellation points with &#39;1&#39; in bit position...">S1</a>(i, j)); |
---|
| 310 | <a name="l00428"></a>00428 } |
---|
| 311 | <a name="l00429"></a>00429 soft_bits(l*k + i) = <a class="code" href="group__logexpfunc.html#g02907e0ed7d04cde3a43e2a9d00c24c0" title="Truncated natural logarithm function.">trunc_log</a>(P0) - <a class="code" href="group__logexpfunc.html#g02907e0ed7d04cde3a43e2a9d00c24c0" title="Truncated natural logarithm function.">trunc_log</a>(P1); |
---|
| 312 | <a name="l00430"></a>00430 } |
---|
| 313 | <a name="l00431"></a>00431 } |
---|
| 314 | <a name="l00432"></a>00432 } |
---|
| 315 | <a name="l00433"></a>00433 <span class="keywordflow">else</span> { <span class="comment">// method == APPROX</span> |
---|
| 316 | <a name="l00434"></a>00434 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> l = 0; l < rx_symbols.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>(); l++) { |
---|
| 317 | <a name="l00435"></a>00435 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>; j++) { |
---|
| 318 | <a name="l00436"></a>00436 metric(j) = <a class="code" href="group__miscfunc.html#gd0a08400c5087615cb59d95c3e05ba38" title="Square of elements.">sqr</a>(rx_symbols(l) - <a class="code" href="classitpp_1_1Modulator.html#3069840e9e7a44180615fb772cf9ae42" title="Corresponding modulation symbols (size: M).">symbols</a>(j)); |
---|
| 319 | <a name="l00437"></a>00437 } |
---|
| 320 | <a name="l00438"></a>00438 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>; i++) { |
---|
| 321 | <a name="l00439"></a>00439 d0min = d1min = <a class="code" href="group__protocol.html#g3e4e78a5230c444344a135c661163ef2" title="ADD DOCUMENTATION HERE.">std::numeric_limits<double>::max</a>(); |
---|
| 322 | <a name="l00440"></a>00440 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < (M >> 1); j++) { |
---|
| 323 | <a name="l00441"></a>00441 temp = metric(<a class="code" href="classitpp_1_1Modulator.html#c19c8fe07e95e4eb80e832a633b7c422" title="Matrix where row k contains the constellation points with &#39;0&#39; in bit position...">S0</a>(i, j)); |
---|
| 324 | <a name="l00442"></a>00442 <span class="keywordflow">if</span> (temp < d0min) { d0min = temp; } |
---|
| 325 | <a name="l00443"></a>00443 temp = metric(<a class="code" href="classitpp_1_1Modulator.html#9d4c223ffd96fdc5b26ba5c44956998b" title="Matrix where row k contains the constellation points with &#39;1&#39; in bit position...">S1</a>(i, j)); |
---|
| 326 | <a name="l00444"></a>00444 <span class="keywordflow">if</span> (temp < d1min) { d1min = temp; } |
---|
| 327 | <a name="l00445"></a>00445 } |
---|
| 328 | <a name="l00446"></a>00446 soft_bits(l*k + i) = (-d0min + d1min) / N0; |
---|
| 329 | <a name="l00447"></a>00447 } |
---|
| 330 | <a name="l00448"></a>00448 } |
---|
| 331 | <a name="l00449"></a>00449 } |
---|
| 332 | <a name="l00450"></a>00450 } |
---|
| 333 | <a name="l00451"></a>00451 |
---|
| 334 | <a name="l00452"></a>00452 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 335 | <a name="l00453"></a><a class="code" href="classitpp_1_1Modulator.html#a9cba88e460e11775fb72d21b543c375">00453</a> vec <a class="code" href="classitpp_1_1Modulator.html#9beffaf8f69378f9c20a85f3023bd9af" title="Soft demodulator for AWGN channels.">Modulator<T>::demodulate_soft_bits</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> &rx_symbols, |
---|
| 336 | <a name="l00454"></a>00454 <span class="keywordtype">double</span> N0, |
---|
| 337 | <a name="l00455"></a>00455 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method)<span class="keyword"> const</span> |
---|
| 338 | <a name="l00456"></a>00456 <span class="keyword"></span>{ |
---|
| 339 | <a name="l00457"></a>00457 vec output; |
---|
| 340 | <a name="l00458"></a>00458 <a class="code" href="classitpp_1_1Modulator.html#9beffaf8f69378f9c20a85f3023bd9af" title="Soft demodulator for AWGN channels.">demodulate_soft_bits</a>(rx_symbols, N0, output, method); |
---|
| 341 | <a name="l00459"></a>00459 <span class="keywordflow">return</span> output; |
---|
| 342 | <a name="l00460"></a>00460 } |
---|
| 343 | <a name="l00461"></a>00461 |
---|
| 344 | <a name="l00462"></a>00462 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 345 | <a name="l00463"></a><a class="code" href="classitpp_1_1Modulator.html#bd014d868b4f883712f92a7130401714">00463</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#9beffaf8f69378f9c20a85f3023bd9af" title="Soft demodulator for AWGN channels.">Modulator<T>::demodulate_soft_bits</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> &rx_symbols, |
---|
| 346 | <a name="l00464"></a>00464 <span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> &channel, <span class="keywordtype">double</span> N0, |
---|
| 347 | <a name="l00465"></a>00465 vec &soft_bits, |
---|
| 348 | <a name="l00466"></a>00466 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method)<span class="keyword"> const</span> |
---|
| 349 | <a name="l00467"></a>00467 <span class="keyword"></span>{ |
---|
| 350 | <a name="l00468"></a>00468 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(<a class="code" href="classitpp_1_1Modulator.html#552cd7add3e998eca485d0ea39808e0d" title="Setup indicator.">setup_done</a>, <span class="stringliteral">"Modulator_2D::demodulate_soft_bits(): Modulator not ready."</span>); |
---|
| 351 | <a name="l00469"></a>00469 <span class="keywordtype">double</span> P0, P1, d0min, d1min, temp; |
---|
| 352 | <a name="l00470"></a>00470 vec metric(<a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>); |
---|
| 353 | <a name="l00471"></a>00471 |
---|
| 354 | <a name="l00472"></a>00472 soft_bits.set_size(<a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a> * rx_symbols.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>()); |
---|
| 355 | <a name="l00473"></a>00473 |
---|
| 356 | <a name="l00474"></a>00474 <span class="keywordflow">if</span> (method == <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) { |
---|
| 357 | <a name="l00475"></a>00475 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> l = 0; l < rx_symbols.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>(); l++) { |
---|
| 358 | <a name="l00476"></a>00476 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>; j++) { |
---|
| 359 | <a name="l00477"></a>00477 metric(j) = <a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335" title="Exp of the elements of a complex matrix m.">std::exp</a>(-<a class="code" href="group__miscfunc.html#gd0a08400c5087615cb59d95c3e05ba38" title="Square of elements.">sqr</a>(rx_symbols(l) - channel(l) * <a class="code" href="classitpp_1_1Modulator.html#3069840e9e7a44180615fb772cf9ae42" title="Corresponding modulation symbols (size: M).">symbols</a>(j)) |
---|
| 360 | <a name="l00478"></a>00478 / N0); |
---|
| 361 | <a name="l00479"></a>00479 } |
---|
| 362 | <a name="l00480"></a>00480 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>; i++) { |
---|
| 363 | <a name="l00481"></a>00481 P0 = P1 = 0; |
---|
| 364 | <a name="l00482"></a>00482 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < (M >> 1); j++) { |
---|
| 365 | <a name="l00483"></a>00483 P0 += metric(<a class="code" href="classitpp_1_1Modulator.html#c19c8fe07e95e4eb80e832a633b7c422" title="Matrix where row k contains the constellation points with &#39;0&#39; in bit position...">S0</a>(i, j)); |
---|
| 366 | <a name="l00484"></a>00484 P1 += metric(<a class="code" href="classitpp_1_1Modulator.html#9d4c223ffd96fdc5b26ba5c44956998b" title="Matrix where row k contains the constellation points with &#39;1&#39; in bit position...">S1</a>(i, j)); |
---|
| 367 | <a name="l00485"></a>00485 } |
---|
| 368 | <a name="l00486"></a>00486 soft_bits(l*k + i) = <a class="code" href="group__logexpfunc.html#g02907e0ed7d04cde3a43e2a9d00c24c0" title="Truncated natural logarithm function.">trunc_log</a>(P0) - <a class="code" href="group__logexpfunc.html#g02907e0ed7d04cde3a43e2a9d00c24c0" title="Truncated natural logarithm function.">trunc_log</a>(P1); |
---|
| 369 | <a name="l00487"></a>00487 } |
---|
| 370 | <a name="l00488"></a>00488 } |
---|
| 371 | <a name="l00489"></a>00489 } |
---|
| 372 | <a name="l00490"></a>00490 <span class="keywordflow">else</span> { <span class="comment">// method == APPROX</span> |
---|
| 373 | <a name="l00491"></a>00491 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> l = 0; l < rx_symbols.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>(); l++) { |
---|
| 374 | <a name="l00492"></a>00492 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>; j++) { |
---|
| 375 | <a name="l00493"></a>00493 metric(j) = <a class="code" href="group__miscfunc.html#gd0a08400c5087615cb59d95c3e05ba38" title="Square of elements.">sqr</a>(rx_symbols(l) - channel(l) * <a class="code" href="classitpp_1_1Modulator.html#3069840e9e7a44180615fb772cf9ae42" title="Corresponding modulation symbols (size: M).">symbols</a>(j)); |
---|
| 376 | <a name="l00494"></a>00494 } |
---|
| 377 | <a name="l00495"></a>00495 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>; i++) { |
---|
| 378 | <a name="l00496"></a>00496 d0min = d1min = <a class="code" href="group__protocol.html#g3e4e78a5230c444344a135c661163ef2" title="ADD DOCUMENTATION HERE.">std::numeric_limits<double>::max</a>(); |
---|
| 379 | <a name="l00497"></a>00497 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < (M >> 1); j++) { |
---|
| 380 | <a name="l00498"></a>00498 temp = metric(<a class="code" href="classitpp_1_1Modulator.html#c19c8fe07e95e4eb80e832a633b7c422" title="Matrix where row k contains the constellation points with &#39;0&#39; in bit position...">S0</a>(i, j)); |
---|
| 381 | <a name="l00499"></a>00499 <span class="keywordflow">if</span> (temp < d0min) { d0min = temp; } |
---|
| 382 | <a name="l00500"></a>00500 temp = metric(<a class="code" href="classitpp_1_1Modulator.html#9d4c223ffd96fdc5b26ba5c44956998b" title="Matrix where row k contains the constellation points with &#39;1&#39; in bit position...">S1</a>(i, j)); |
---|
| 383 | <a name="l00501"></a>00501 <span class="keywordflow">if</span> (temp < d1min) { d1min = temp; } |
---|
| 384 | <a name="l00502"></a>00502 } |
---|
| 385 | <a name="l00503"></a>00503 soft_bits(l*k + i) = (-d0min + d1min) / N0; |
---|
| 386 | <a name="l00504"></a>00504 } |
---|
| 387 | <a name="l00505"></a>00505 } |
---|
| 388 | <a name="l00506"></a>00506 } |
---|
| 389 | <a name="l00507"></a>00507 } |
---|
| 390 | <a name="l00508"></a>00508 |
---|
| 391 | <a name="l00509"></a>00509 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 392 | <a name="l00510"></a><a class="code" href="classitpp_1_1Modulator.html#e40b7afd0d38d2d86b561b9dff6f55fd">00510</a> vec <a class="code" href="classitpp_1_1Modulator.html#9beffaf8f69378f9c20a85f3023bd9af" title="Soft demodulator for AWGN channels.">Modulator<T>::demodulate_soft_bits</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> &rx_symbols, |
---|
| 393 | <a name="l00511"></a>00511 <span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> &channel, |
---|
| 394 | <a name="l00512"></a>00512 <span class="keywordtype">double</span> N0, |
---|
| 395 | <a name="l00513"></a>00513 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method)<span class="keyword"> const</span> |
---|
| 396 | <a name="l00514"></a>00514 <span class="keyword"></span>{ |
---|
| 397 | <a name="l00515"></a>00515 vec output; |
---|
| 398 | <a name="l00516"></a>00516 <a class="code" href="classitpp_1_1Modulator.html#9beffaf8f69378f9c20a85f3023bd9af" title="Soft demodulator for AWGN channels.">demodulate_soft_bits</a>(rx_symbols, channel, N0, output, method); |
---|
| 399 | <a name="l00517"></a>00517 <span class="keywordflow">return</span> output; |
---|
| 400 | <a name="l00518"></a>00518 } |
---|
| 401 | <a name="l00519"></a>00519 |
---|
| 402 | <a name="l00520"></a>00520 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
| 403 | <a name="l00521"></a><a class="code" href="classitpp_1_1Modulator.html#bb3e654a3fb6d127ee8d266677689233">00521</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Modulator.html#bb3e654a3fb6d127ee8d266677689233" title="This function calculates the soft bit mapping matrices S0 and S1.">Modulator<T>::calculate_softbit_matrices</a>() |
---|
| 404 | <a name="l00522"></a>00522 { |
---|
| 405 | <a name="l00523"></a>00523 <span class="keywordtype">int</span> count0, count1; |
---|
| 406 | <a name="l00524"></a>00524 |
---|
| 407 | <a name="l00525"></a>00525 <span class="comment">// Allocate storage space for the result matrices:</span> |
---|
| 408 | <a name="l00526"></a>00526 <a class="code" href="classitpp_1_1Modulator.html#c19c8fe07e95e4eb80e832a633b7c422" title="Matrix where row k contains the constellation points with &#39;0&#39; in bit position...">S0</a>.set_size(<a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>, <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a> >> 1, <span class="keyword">false</span>); |
---|
| 409 | <a name="l00527"></a>00527 <a class="code" href="classitpp_1_1Modulator.html#9d4c223ffd96fdc5b26ba5c44956998b" title="Matrix where row k contains the constellation points with &#39;1&#39; in bit position...">S1</a>.set_size(<a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>, <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a> >> 1, <span class="keyword">false</span>); |
---|
| 410 | <a name="l00528"></a>00528 |
---|
| 411 | <a name="l00529"></a>00529 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="classitpp_1_1Modulator.html#3656edc52486e0551b734b32ab67d3b6" title="Number of bits per modulation symbol.">k</a>; i++) { |
---|
| 412 | <a name="l00530"></a>00530 count0 = 0; |
---|
| 413 | <a name="l00531"></a>00531 count1 = 0; |
---|
| 414 | <a name="l00532"></a>00532 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>; j++) { |
---|
| 415 | <a name="l00533"></a>00533 <span class="keywordflow">if</span> (<a class="code" href="classitpp_1_1Modulator.html#1b1a9a706c0736c51966703bea58cf48" title="Bit to symbol mapping table (size: M x k).">bitmap</a>(j, i) == <a class="code" href="classitpp_1_1bin.html" title="Binary arithmetic (boolean) class.">bin</a>(0)) { |
---|
| 416 | <a name="l00534"></a>00534 <a class="code" href="classitpp_1_1Modulator.html#c19c8fe07e95e4eb80e832a633b7c422" title="Matrix where row k contains the constellation points with &#39;0&#39; in bit position...">S0</a>(i, count0++) = j; |
---|
| 417 | <a name="l00535"></a>00535 } |
---|
| 418 | <a name="l00536"></a>00536 <span class="keywordflow">else</span> { |
---|
| 419 | <a name="l00537"></a>00537 <a class="code" href="classitpp_1_1Modulator.html#9d4c223ffd96fdc5b26ba5c44956998b" title="Matrix where row k contains the constellation points with &#39;1&#39; in bit position...">S1</a>(i, count1++) = j; |
---|
| 420 | <a name="l00538"></a>00538 } |
---|
| 421 | <a name="l00539"></a>00539 } |
---|
| 422 | <a name="l00540"></a>00540 } |
---|
| 423 | <a name="l00541"></a>00541 } |
---|
| 424 | <a name="l00542"></a>00542 |
---|
| 425 | <a name="l00543"></a>00543 |
---|
| 426 | <a name="l00544"></a>00544 |
---|
| 427 | <a name="l00545"></a>00545 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 428 | <a name="l00546"></a>00546 <span class="comment">// QAM : Modulator_2D</span> |
---|
| 429 | <a name="l00547"></a>00547 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 430 | <a name="l00548"></a>00548 |
---|
| 431 | <a name="l00569"></a><a class="code" href="classitpp_1_1QAM.html">00569</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1QAM.html" title="M-ary QAM modulator with square lattice.">QAM</a> : <span class="keyword">public</span> <a class="code" href="classitpp_1_1Modulator.html" title="General modulator for 1D or 2D signal constellations.">Modulator</a><std::complex<double> > |
---|
| 432 | <a name="l00570"></a>00570 { |
---|
| 433 | <a name="l00571"></a>00571 <span class="keyword">public</span>: |
---|
| 434 | <a name="l00573"></a><a class="code" href="classitpp_1_1QAM.html#a5b1798b2370c0648a61e102a0e852f3">00573</a> <a class="code" href="classitpp_1_1QAM.html#a5b1798b2370c0648a61e102a0e852f3" title="Default Constructor.">QAM</a>() {} |
---|
| 435 | <a name="l00575"></a><a class="code" href="classitpp_1_1QAM.html#bcab714c15a168763b39940be2ffb636">00575</a> <a class="code" href="classitpp_1_1QAM.html#bcab714c15a168763b39940be2ffb636" title="Class Constructor.">QAM</a>(<span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>) { <a class="code" href="classitpp_1_1QAM.html#ec5d9e5188bc1ceca2a575f37f806a07" title="Change the size of the signal constellation.">set_M</a>(M); } |
---|
| 436 | <a name="l00577"></a><a class="code" href="classitpp_1_1QAM.html#3c1e5de708ba4c2c007c5613e7f2d50e">00577</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1QAM.html#3c1e5de708ba4c2c007c5613e7f2d50e" title="Destructor.">~QAM</a>() { } |
---|
| 437 | <a name="l00579"></a>00579 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1QAM.html#ec5d9e5188bc1ceca2a575f37f806a07" title="Change the size of the signal constellation.">set_M</a>(<span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>); |
---|
| 438 | <a name="l00580"></a>00580 |
---|
| 439 | <a name="l00582"></a>00582 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1QAM.html#fa8c6d12e65e8a145faabd11d0d6be92" title="Hard demodulation of bits.">demodulate_bits</a>(<span class="keyword">const</span> cvec& signal, bvec& bits) <span class="keyword">const</span>; |
---|
| 440 | <a name="l00584"></a>00584 bvec <a class="code" href="classitpp_1_1QAM.html#fa8c6d12e65e8a145faabd11d0d6be92" title="Hard demodulation of bits.">demodulate_bits</a>(<span class="keyword">const</span> cvec& signal) <span class="keyword">const</span>; |
---|
| 441 | <a name="l00585"></a>00585 |
---|
| 442 | <a name="l00586"></a>00586 <span class="keyword">protected</span>: |
---|
| 443 | <a name="l00588"></a><a class="code" href="classitpp_1_1QAM.html#d2c1d5047f75d9a43e0a7c165a69d165">00588</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1QAM.html#d2c1d5047f75d9a43e0a7c165a69d165" title="The square-root of M.">L</a>; |
---|
| 444 | <a name="l00590"></a><a class="code" href="classitpp_1_1QAM.html#234cc9d2e3b6a0eb76af03371e3472a9">00590</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1QAM.html#234cc9d2e3b6a0eb76af03371e3472a9" title="Scaling factor of square QAM constellation (sqrt((M-1)*2/3)).">scaling_factor</a>; |
---|
| 445 | <a name="l00591"></a>00591 }; |
---|
| 446 | <a name="l00592"></a>00592 |
---|
| 447 | <a name="l00593"></a>00593 |
---|
| 448 | <a name="l00594"></a>00594 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 449 | <a name="l00595"></a>00595 <span class="comment">// PSK : Modulator<std::complex<double> ></span> |
---|
| 450 | <a name="l00596"></a>00596 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 451 | <a name="l00597"></a>00597 |
---|
| 452 | <a name="l00618"></a><a class="code" href="classitpp_1_1PSK.html">00618</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1PSK.html" title="M-ary PSK modulator.">PSK</a> : <span class="keyword">public</span> <a class="code" href="classitpp_1_1Modulator.html" title="General modulator for 1D or 2D signal constellations.">Modulator</a><std::complex<double> > |
---|
| 453 | <a name="l00619"></a>00619 { |
---|
| 454 | <a name="l00620"></a>00620 <span class="keyword">public</span>: |
---|
| 455 | <a name="l00622"></a><a class="code" href="classitpp_1_1PSK.html#03dc53b9f9ec5c7cc4eccf90a2a5f253">00622</a> <a class="code" href="classitpp_1_1PSK.html#03dc53b9f9ec5c7cc4eccf90a2a5f253" title="Default Constructor.">PSK</a>() {} |
---|
| 456 | <a name="l00624"></a><a class="code" href="classitpp_1_1PSK.html#6e20bda8f4a860a3b0ae5f8807002be7">00624</a> <a class="code" href="classitpp_1_1PSK.html#6e20bda8f4a860a3b0ae5f8807002be7" title="Class constructor.">PSK</a>(<span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>) { <a class="code" href="classitpp_1_1PSK.html#879b97ace3a3b51a274c2838eddf78d4" title="Change the size of the signal constellation.">set_M</a>(M); } |
---|
| 457 | <a name="l00626"></a><a class="code" href="classitpp_1_1PSK.html#dda40000d9749c227c3b71c0b18fafd7">00626</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1PSK.html#dda40000d9749c227c3b71c0b18fafd7" title="Destructor.">~PSK</a>() { } |
---|
| 458 | <a name="l00628"></a>00628 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1PSK.html#879b97ace3a3b51a274c2838eddf78d4" title="Change the size of the signal constellation.">set_M</a>(<span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>); |
---|
| 459 | <a name="l00629"></a>00629 |
---|
| 460 | <a name="l00631"></a>00631 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1PSK.html#a3b14b2e7174454ddd1270915161bb4e" title="Hard demodulation of bits.">demodulate_bits</a>(<span class="keyword">const</span> cvec& signal, bvec& bits) <span class="keyword">const</span>; |
---|
| 461 | <a name="l00633"></a>00633 bvec <a class="code" href="classitpp_1_1PSK.html#a3b14b2e7174454ddd1270915161bb4e" title="Hard demodulation of bits.">demodulate_bits</a>(<span class="keyword">const</span> cvec& signal) <span class="keyword">const</span>; |
---|
| 462 | <a name="l00634"></a>00634 }; |
---|
| 463 | <a name="l00635"></a>00635 |
---|
| 464 | <a name="l00636"></a>00636 |
---|
| 465 | <a name="l00637"></a>00637 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 466 | <a name="l00638"></a>00638 <span class="comment">// QPSK : PSK : Modulator<std::complex<double> ></span> |
---|
| 467 | <a name="l00639"></a>00639 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 468 | <a name="l00640"></a>00640 |
---|
| 469 | <a name="l00660"></a><a class="code" href="classitpp_1_1QPSK.html">00660</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1QPSK.html" title="QPSK modulator.">QPSK</a> : <span class="keyword">public</span> <a class="code" href="classitpp_1_1PSK.html" title="M-ary PSK modulator.">PSK</a> |
---|
| 470 | <a name="l00661"></a>00661 { |
---|
| 471 | <a name="l00662"></a>00662 <span class="keyword">public</span>: |
---|
| 472 | <a name="l00664"></a><a class="code" href="classitpp_1_1QPSK.html#48baccb4b26bab67b553ef642f15e083">00664</a> <a class="code" href="classitpp_1_1QPSK.html#48baccb4b26bab67b553ef642f15e083" title="Class Constructor.">QPSK</a>(): <a class="code" href="classitpp_1_1PSK.html" title="M-ary PSK modulator.">PSK</a>(4) {} |
---|
| 473 | <a name="l00666"></a><a class="code" href="classitpp_1_1QPSK.html#f257e3fe687a79188c1d11aafa10cd4b">00666</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1QPSK.html#f257e3fe687a79188c1d11aafa10cd4b" title="Destructor.">~QPSK</a>() {} |
---|
| 474 | <a name="l00667"></a>00667 |
---|
| 475 | <a name="l00689"></a>00689 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1QPSK.html#f0a8d5f3e97965267e263c570ec1a594" title="Soft demodulator for AWGN channel.">demodulate_soft_bits</a>(<span class="keyword">const</span> cvec& rx_symbols, <span class="keywordtype">double</span> N0, |
---|
| 476 | <a name="l00690"></a>00690 vec& soft_bits, |
---|
| 477 | <a name="l00691"></a>00691 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 478 | <a name="l00693"></a>00693 vec <a class="code" href="classitpp_1_1QPSK.html#f0a8d5f3e97965267e263c570ec1a594" title="Soft demodulator for AWGN channel.">demodulate_soft_bits</a>(<span class="keyword">const</span> cvec& rx_symbols, <span class="keywordtype">double</span> N0, |
---|
| 479 | <a name="l00694"></a>00694 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 480 | <a name="l00695"></a>00695 |
---|
| 481 | <a name="l00696"></a>00696 |
---|
| 482 | <a name="l00719"></a>00719 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1QPSK.html#f0a8d5f3e97965267e263c570ec1a594" title="Soft demodulator for AWGN channel.">demodulate_soft_bits</a>(<span class="keyword">const</span> cvec& rx_symbols, |
---|
| 483 | <a name="l00720"></a>00720 <span class="keyword">const</span> cvec& channel, <span class="keywordtype">double</span> N0, |
---|
| 484 | <a name="l00721"></a>00721 vec& soft_bits, |
---|
| 485 | <a name="l00722"></a>00722 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 486 | <a name="l00724"></a>00724 vec <a class="code" href="classitpp_1_1QPSK.html#f0a8d5f3e97965267e263c570ec1a594" title="Soft demodulator for AWGN channel.">demodulate_soft_bits</a>(<span class="keyword">const</span> cvec& rx_symbols, <span class="keyword">const</span> cvec& channel, |
---|
| 487 | <a name="l00725"></a>00725 <span class="keywordtype">double</span> N0, <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 488 | <a name="l00726"></a>00726 }; |
---|
| 489 | <a name="l00727"></a>00727 |
---|
| 490 | <a name="l00728"></a>00728 |
---|
| 491 | <a name="l00729"></a>00729 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 492 | <a name="l00730"></a>00730 <span class="comment">// BPSK_c : PSK : Modulator<std::complex<double> ></span> |
---|
| 493 | <a name="l00731"></a>00731 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 494 | <a name="l00732"></a>00732 |
---|
| 495 | <a name="l00758"></a><a class="code" href="classitpp_1_1BPSK__c.html">00758</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1BPSK__c.html" title="BPSK modulator with complex symbols.">BPSK_c</a> : <span class="keyword">public</span> <a class="code" href="classitpp_1_1PSK.html" title="M-ary PSK modulator.">PSK</a> |
---|
| 496 | <a name="l00759"></a>00759 { |
---|
| 497 | <a name="l00760"></a>00760 <span class="keyword">public</span>: |
---|
| 498 | <a name="l00762"></a><a class="code" href="classitpp_1_1BPSK__c.html#b9fec782b1b30ed82fe9501748e8dc77">00762</a> <a class="code" href="classitpp_1_1BPSK__c.html#b9fec782b1b30ed82fe9501748e8dc77" title="Constructor.">BPSK_c</a>(): <a class="code" href="classitpp_1_1PSK.html" title="M-ary PSK modulator.">PSK</a>(2) {} |
---|
| 499 | <a name="l00764"></a><a class="code" href="classitpp_1_1BPSK__c.html#875e10dff64692bdccaa2893722bd823">00764</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1BPSK__c.html#875e10dff64692bdccaa2893722bd823" title="Destructor.">~BPSK_c</a>() {} |
---|
| 500 | <a name="l00765"></a>00765 |
---|
| 501 | <a name="l00767"></a>00767 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BPSK__c.html#553f833f72bfedff81dbe8bd96b044da" title="Modulate bits into BPSK symbols in complex domain.">modulate_bits</a>(<span class="keyword">const</span> bvec& bits, cvec& output) <span class="keyword">const</span>; |
---|
| 502 | <a name="l00769"></a>00769 cvec <a class="code" href="classitpp_1_1BPSK__c.html#553f833f72bfedff81dbe8bd96b044da" title="Modulate bits into BPSK symbols in complex domain.">modulate_bits</a>(<span class="keyword">const</span> bvec& bits) <span class="keyword">const</span>; |
---|
| 503 | <a name="l00771"></a>00771 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BPSK__c.html#442fa8ff1a0d59a1137587d82c2e51b5" title="Demodulate noisy BPSK symbols in complex domain into bits.">demodulate_bits</a>(<span class="keyword">const</span> cvec& signal, bvec& output) <span class="keyword">const</span>; |
---|
| 504 | <a name="l00773"></a>00773 bvec <a class="code" href="classitpp_1_1BPSK__c.html#442fa8ff1a0d59a1137587d82c2e51b5" title="Demodulate noisy BPSK symbols in complex domain into bits.">demodulate_bits</a>(<span class="keyword">const</span> cvec& signal) <span class="keyword">const</span>; |
---|
| 505 | <a name="l00774"></a>00774 |
---|
| 506 | <a name="l00794"></a>00794 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BPSK__c.html#d36813fb58ef90ca61b622f8e981bdb1" title="Soft demodulator for AWGN channel.">demodulate_soft_bits</a>(<span class="keyword">const</span> cvec& rx_symbols, <span class="keywordtype">double</span> N0, |
---|
| 507 | <a name="l00795"></a>00795 vec& soft_bits, |
---|
| 508 | <a name="l00796"></a>00796 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 509 | <a name="l00798"></a>00798 vec <a class="code" href="classitpp_1_1BPSK__c.html#d36813fb58ef90ca61b622f8e981bdb1" title="Soft demodulator for AWGN channel.">demodulate_soft_bits</a>(<span class="keyword">const</span> cvec& rx_symbols, <span class="keywordtype">double</span> N0, |
---|
| 510 | <a name="l00799"></a>00799 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 511 | <a name="l00800"></a>00800 |
---|
| 512 | <a name="l00821"></a>00821 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BPSK__c.html#d36813fb58ef90ca61b622f8e981bdb1" title="Soft demodulator for AWGN channel.">demodulate_soft_bits</a>(<span class="keyword">const</span> cvec& rx_symbols, |
---|
| 513 | <a name="l00822"></a>00822 <span class="keyword">const</span> cvec& channel, <span class="keywordtype">double</span> N0, |
---|
| 514 | <a name="l00823"></a>00823 vec& soft_bits, |
---|
| 515 | <a name="l00824"></a>00824 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 516 | <a name="l00826"></a>00826 vec <a class="code" href="classitpp_1_1BPSK__c.html#d36813fb58ef90ca61b622f8e981bdb1" title="Soft demodulator for AWGN channel.">demodulate_soft_bits</a>(<span class="keyword">const</span> cvec& rx_symbols, <span class="keyword">const</span> cvec& channel, |
---|
| 517 | <a name="l00827"></a>00827 <span class="keywordtype">double</span> N0, <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 518 | <a name="l00828"></a>00828 }; |
---|
| 519 | <a name="l00829"></a>00829 |
---|
| 520 | <a name="l00830"></a>00830 |
---|
| 521 | <a name="l00831"></a>00831 |
---|
| 522 | <a name="l00832"></a>00832 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 523 | <a name="l00833"></a>00833 <span class="comment">// BPSK : Modulator<double></span> |
---|
| 524 | <a name="l00834"></a>00834 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 525 | <a name="l00835"></a>00835 |
---|
| 526 | <a name="l00859"></a><a class="code" href="classitpp_1_1BPSK.html">00859</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1BPSK.html" title="BPSK modulator with real symbols.">BPSK</a> : <span class="keyword">public</span> <a class="code" href="classitpp_1_1Modulator.html" title="General modulator for 1D or 2D signal constellations.">Modulator</a><double> |
---|
| 527 | <a name="l00860"></a>00860 { |
---|
| 528 | <a name="l00861"></a>00861 <span class="keyword">public</span>: |
---|
| 529 | <a name="l00863"></a><a class="code" href="classitpp_1_1BPSK.html#9aaf06588353a953f02b369f10a0bb76">00863</a> <a class="code" href="classitpp_1_1BPSK.html#9aaf06588353a953f02b369f10a0bb76" title="Constructor.">BPSK</a>(): <a class="code" href="classitpp_1_1Modulator.html" title="General modulator for 1D or 2D signal constellations.">Modulator</a><double>(<span class="stringliteral">"1.0 -1.0"</span>, <span class="stringliteral">"0 1"</span>) {} |
---|
| 530 | <a name="l00865"></a><a class="code" href="classitpp_1_1BPSK.html#11d99b8c0dfef6e0017ac691507f02cf">00865</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1BPSK.html#11d99b8c0dfef6e0017ac691507f02cf" title="Destructor.">~BPSK</a>() {} |
---|
| 531 | <a name="l00866"></a>00866 |
---|
| 532 | <a name="l00868"></a>00868 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BPSK.html#ff002bcb92f62a0f01e76ce1b0ab543e" title="Modulate bits into BPSK symbols in complex domain.">modulate_bits</a>(<span class="keyword">const</span> bvec& bits, vec& output) <span class="keyword">const</span>; |
---|
| 533 | <a name="l00870"></a>00870 vec <a class="code" href="classitpp_1_1BPSK.html#ff002bcb92f62a0f01e76ce1b0ab543e" title="Modulate bits into BPSK symbols in complex domain.">modulate_bits</a>(<span class="keyword">const</span> bvec& bits) <span class="keyword">const</span>; |
---|
| 534 | <a name="l00872"></a>00872 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BPSK.html#86ec97762f354d8020fcab199faa6e5e" title="Demodulate noisy BPSK symbols in complex domain into bits.">demodulate_bits</a>(<span class="keyword">const</span> vec& signal, bvec& output) <span class="keyword">const</span>; |
---|
| 535 | <a name="l00874"></a>00874 bvec <a class="code" href="classitpp_1_1BPSK.html#86ec97762f354d8020fcab199faa6e5e" title="Demodulate noisy BPSK symbols in complex domain into bits.">demodulate_bits</a>(<span class="keyword">const</span> vec& signal) <span class="keyword">const</span>; |
---|
| 536 | <a name="l00875"></a>00875 |
---|
| 537 | <a name="l00893"></a>00893 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BPSK.html#384c489595bc85fada37e5138e1e2365" title="Soft demodulator for AWGN channel.">demodulate_soft_bits</a>(<span class="keyword">const</span> vec& rx_symbols, <span class="keywordtype">double</span> N0, |
---|
| 538 | <a name="l00894"></a>00894 vec& soft_bits, |
---|
| 539 | <a name="l00895"></a>00895 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 540 | <a name="l00897"></a>00897 vec <a class="code" href="classitpp_1_1BPSK.html#384c489595bc85fada37e5138e1e2365" title="Soft demodulator for AWGN channel.">demodulate_soft_bits</a>(<span class="keyword">const</span> vec& rx_symbols, <span class="keywordtype">double</span> N0, |
---|
| 541 | <a name="l00898"></a>00898 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 542 | <a name="l00899"></a>00899 |
---|
| 543 | <a name="l00919"></a>00919 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BPSK.html#384c489595bc85fada37e5138e1e2365" title="Soft demodulator for AWGN channel.">demodulate_soft_bits</a>(<span class="keyword">const</span> vec& rx_symbols, |
---|
| 544 | <a name="l00920"></a>00920 <span class="keyword">const</span> vec& channel, <span class="keywordtype">double</span> N0, |
---|
| 545 | <a name="l00921"></a>00921 vec& soft_bits, |
---|
| 546 | <a name="l00922"></a>00922 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 547 | <a name="l00924"></a>00924 vec <a class="code" href="classitpp_1_1BPSK.html#384c489595bc85fada37e5138e1e2365" title="Soft demodulator for AWGN channel.">demodulate_soft_bits</a>(<span class="keyword">const</span> vec& rx_symbols, <span class="keyword">const</span> vec& channel, |
---|
| 548 | <a name="l00925"></a>00925 <span class="keywordtype">double</span> N0, <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 549 | <a name="l00926"></a>00926 }; |
---|
| 550 | <a name="l00927"></a>00927 |
---|
| 551 | <a name="l00928"></a>00928 |
---|
| 552 | <a name="l00929"></a>00929 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 553 | <a name="l00930"></a>00930 <span class="comment">// PAM_c : Modulator<std::complex<double> ></span> |
---|
| 554 | <a name="l00931"></a>00931 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 555 | <a name="l00932"></a>00932 |
---|
| 556 | <a name="l00951"></a><a class="code" href="classitpp_1_1PAM__c.html">00951</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1PAM__c.html" title="M-ary PAM modulator with complex symbols.">PAM_c</a> : <span class="keyword">public</span> <a class="code" href="classitpp_1_1Modulator.html" title="General modulator for 1D or 2D signal constellations.">Modulator</a><std::complex<double> > |
---|
| 557 | <a name="l00952"></a>00952 { |
---|
| 558 | <a name="l00953"></a>00953 <span class="keyword">public</span>: |
---|
| 559 | <a name="l00955"></a><a class="code" href="classitpp_1_1PAM__c.html#9bf8f8af7de4d55dc96b430179e22615">00955</a> <a class="code" href="classitpp_1_1PAM__c.html#9bf8f8af7de4d55dc96b430179e22615" title="Default Constructor.">PAM_c</a>() {} |
---|
| 560 | <a name="l00957"></a><a class="code" href="classitpp_1_1PAM__c.html#ddf72f5ca262c86fb593c52a83ddd5a3">00957</a> <a class="code" href="classitpp_1_1PAM__c.html#ddf72f5ca262c86fb593c52a83ddd5a3" title="Constructor.">PAM_c</a>(<span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>) { <a class="code" href="classitpp_1_1PAM__c.html#5fdc1ce14d29d8d291dd23406904b606" title="Set the size of the signal constellation.">set_M</a>(M); } |
---|
| 561 | <a name="l00959"></a><a class="code" href="classitpp_1_1PAM__c.html#e1d8dee85093389be82470086df67797">00959</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1PAM__c.html#e1d8dee85093389be82470086df67797" title="Destructor.">~PAM_c</a>() {} |
---|
| 562 | <a name="l00961"></a>00961 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1PAM__c.html#5fdc1ce14d29d8d291dd23406904b606" title="Set the size of the signal constellation.">set_M</a>(<span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>); |
---|
| 563 | <a name="l00962"></a>00962 |
---|
| 564 | <a name="l00964"></a>00964 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1PAM__c.html#4254b3f8ca63e0a99fe83b1eeac22d2b" title="Hard demodulation of PAM symbols in complex domain to bits.">demodulate_bits</a>(<span class="keyword">const</span> cvec& signal, bvec& output) <span class="keyword">const</span>; |
---|
| 565 | <a name="l00966"></a>00966 bvec <a class="code" href="classitpp_1_1PAM__c.html#4254b3f8ca63e0a99fe83b1eeac22d2b" title="Hard demodulation of PAM symbols in complex domain to bits.">demodulate_bits</a>(<span class="keyword">const</span> cvec& signal) <span class="keyword">const</span>; |
---|
| 566 | <a name="l00967"></a>00967 |
---|
| 567 | <a name="l01007"></a>01007 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1PAM__c.html#56e1f1d20bfecdd0e5ef37456a5179ae" title="Soft demodulator for AWGN channels.">demodulate_soft_bits</a>(<span class="keyword">const</span> cvec& rx_symbols, <span class="keywordtype">double</span> N0, |
---|
| 568 | <a name="l01008"></a>01008 vec& soft_bits, |
---|
| 569 | <a name="l01009"></a>01009 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 570 | <a name="l01011"></a>01011 <span class="keyword">virtual</span> vec <a class="code" href="classitpp_1_1PAM__c.html#56e1f1d20bfecdd0e5ef37456a5179ae" title="Soft demodulator for AWGN channels.">demodulate_soft_bits</a>(<span class="keyword">const</span> cvec& rx_symbols, <span class="keywordtype">double</span> N0, |
---|
| 571 | <a name="l01012"></a>01012 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 572 | <a name="l01013"></a>01013 |
---|
| 573 | <a name="l01052"></a>01052 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1PAM__c.html#56e1f1d20bfecdd0e5ef37456a5179ae" title="Soft demodulator for AWGN channels.">demodulate_soft_bits</a>(<span class="keyword">const</span> cvec& rx_symbols, |
---|
| 574 | <a name="l01053"></a>01053 <span class="keyword">const</span> cvec& channel, <span class="keywordtype">double</span> N0, |
---|
| 575 | <a name="l01054"></a>01054 vec& soft_bits, |
---|
| 576 | <a name="l01055"></a>01055 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 577 | <a name="l01057"></a>01057 <span class="keyword">virtual</span> vec <a class="code" href="classitpp_1_1PAM__c.html#56e1f1d20bfecdd0e5ef37456a5179ae" title="Soft demodulator for AWGN channels.">demodulate_soft_bits</a>(<span class="keyword">const</span> cvec& rx_symbols, |
---|
| 578 | <a name="l01058"></a>01058 <span class="keyword">const</span> cvec& channel, <span class="keywordtype">double</span> N0, |
---|
| 579 | <a name="l01059"></a>01059 <a class="code" href="group__modulators.html#g5128af4688e1a1caa84e1fabf051faa7" title="Soft demodulation methods.">Soft_Method</a> method = <a class="code" href="group__modulators.html#gg5128af4688e1a1caa84e1fabf051faa72cf9506073f5021e57377fc989ad46b2" title="Log-MAP full calculation.">LOGMAP</a>) <span class="keyword">const</span>; |
---|
| 580 | <a name="l01060"></a>01060 |
---|
| 581 | <a name="l01061"></a>01061 <span class="keyword">protected</span>: |
---|
| 582 | <a name="l01063"></a><a class="code" href="classitpp_1_1PAM__c.html#d654c2e53ee82b2279ab894b8801b980">01063</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1PAM__c.html#d654c2e53ee82b2279ab894b8801b980" title="Scaling factor used to normalize the average energy to 1.">scaling_factor</a>; |
---|
| 583 | <a name="l01064"></a>01064 }; |
---|
| 584 | <a name="l01065"></a>01065 |
---|
| 585 | <a name="l01066"></a>01066 |
---|
| 586 | <a name="l01067"></a>01067 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 587 | <a name="l01068"></a>01068 <span class="comment">// PAM : Modulator<double></span> |
---|
| 588 | <a name="l01069"></a>01069 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 589 | <a name="l01070"></a>01070 |
---|
| 590 | <a name="l01087"></a><a class="code" href="classitpp_1_1PAM.html">01087</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1PAM.html" title="M-ary PAM modulator with real symbols.">PAM</a> : <span class="keyword">public</span> <a class="code" href="classitpp_1_1Modulator.html" title="General modulator for 1D or 2D signal constellations.">Modulator</a><double> |
---|
| 591 | <a name="l01088"></a>01088 { |
---|
| 592 | <a name="l01089"></a>01089 <span class="keyword">public</span>: |
---|
| 593 | <a name="l01091"></a><a class="code" href="classitpp_1_1PAM.html#a53666adab014006597ad29ed1f805a9">01091</a> <a class="code" href="classitpp_1_1PAM.html#a53666adab014006597ad29ed1f805a9" title="Default Constructor.">PAM</a>() {} |
---|
| 594 | <a name="l01093"></a><a class="code" href="classitpp_1_1PAM.html#8313557132fafc0f41caefd75ca72f17">01093</a> <a class="code" href="classitpp_1_1PAM.html#8313557132fafc0f41caefd75ca72f17" title="Constructor.">PAM</a>(<span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>) { <a class="code" href="classitpp_1_1PAM.html#04183ae1e27cf1e4ebdb80ebed313fb9" title="Set the size of the signal constellation.">set_M</a>(M); } |
---|
| 595 | <a name="l01095"></a><a class="code" href="classitpp_1_1PAM.html#bdef15e7e3808977e3d3d9432f55d584">01095</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1PAM.html#bdef15e7e3808977e3d3d9432f55d584" title="Destructor.">~PAM</a>() {} |
---|
| 596 | <a name="l01097"></a>01097 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1PAM.html#04183ae1e27cf1e4ebdb80ebed313fb9" title="Set the size of the signal constellation.">set_M</a>(<span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Modulator.html#a434960c7ff9e5356d832aa53b46930b" title="Number of modulation symbols.">M</a>); |
---|
| 597 | <a name="l01098"></a>01098 |
---|
| 598 | <a name="l01100"></a>01100 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1PAM.html#2bc71f0c4c0326806caf0ed505d55a9c" title="Hard demodulation of PAM symbols in complex domain to bits.">demodulate_bits</a>(<span class="keyword">const</span> vec& signal, bvec& output) <span class="keyword">const</span>; |
---|
| 599 | <a name="l01102"></a>01102 bvec <a class="code" href="classitpp_1_1PAM.html#2bc71f0c4c0326806caf0ed505d55a9c" title="Hard demodulation of PAM symbols in complex domain to bits.">demodulate_bits</a>(<span class="keyword">const</span> vec& signal) <span class="keyword">const</span>; |
---|
| 600 | <a name="l01103"></a>01103 |
---|
| 601 | <a name="l01104"></a>01104 <span class="keyword">protected</span>: |
---|
| 602 | <a name="l01106"></a><a class="code" href="classitpp_1_1PAM.html#533787cc46e673e23308eeba3e3b4adc">01106</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1PAM.html#533787cc46e673e23308eeba3e3b4adc" title="Scaling factor used to normalize the average energy to 1.">scaling_factor</a>; |
---|
| 603 | <a name="l01107"></a>01107 }; |
---|
| 604 | <a name="l01108"></a>01108 |
---|
| 605 | <a name="l01109"></a>01109 } <span class="comment">// namespace itpp</span> |
---|
| 606 | <a name="l01110"></a>01110 |
---|
| 607 | <a name="l01111"></a>01111 <span class="preprocessor">#endif // #ifndef MODULATOR_H</span> |
---|
| 608 | </pre></div></div> |
---|
| 609 | <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:12 2009 for mixpp by |
---|
| 610 | <a href="http://www.doxygen.org/index.html"> |
---|
| 611 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> |
---|
| 612 | </body> |
---|
| 613 | </html> |
---|