This file is indexed.

/usr/share/doc/libitpp-dev/html/spread.html is in libitpp-doc 4.2-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
  <title>Welcome to IT++!</title>
  <link href="doxygen.css" rel="stylesheet" type="text/css">
  <link href="tabs.css" rel="stylesheet" type="text/css">
  <link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div style="width: 100%; height: 40px; background-color: #ffff00; border: 1px solid #b0b0b0; margin: 5px 5px 5px 0; padding: 2px;">
  <a href="http://itpp.sourceforge.net"><img src="itpp_logo.png" alt="IT++ Logo" style="float: left; border: 0;"></a>
</div>
<!-- Generated by Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">Simulation of a Multicode CDMA system on an AWGN channel </div>  </div>
</div>
<div class="contents">
<div class="textblock"><p>In this example we will introduce the multi-code spreading class <code>Multicode_Spread_2d</code>. This is the most general spreading class availiable in it++. Different spreading codes may be assigned to the I and Q branches. The number of multiple spreading codes and the spreading factor is determined by the number of rows and collumns respectively that is used when calling the member function set_codes. In this example we will use four Hadamard sequenced of length four, and the same spreading sequences will be used for the I and Q brances.</p>
<div class="fragment"><pre class="fragment"><span class="preprocessor">#include &lt;<a class="code" href="itcomm_8h.html" title="Include file for the IT++ communications module.">itpp/itcomm.h</a>&gt;</span>

<span class="keyword">using namespace </span>itpp;

<span class="comment">//These lines are needed for use of cout and endl</span>
<span class="keyword">using</span> std::cout;
<span class="keyword">using</span> std::endl;

<span class="keywordtype">int</span> main()
{
  <span class="comment">//Scalars:</span>
  <span class="keywordtype">int</span> SF, Ncode, sc, i, j, NumOfBits, MaxIterations, MaxNrOfErrors, MinNrOfErrors;
  <span class="keywordtype">double</span> Eb;

  <span class="comment">//Vectors and matrixes:</span>
  vec EbN0dB, EbN0, N0, ber;
  smat all_codes, spread_codesI, spread_codesQ;
  bvec transmited_bits, received_bits;
  cvec transmited_symbols, received_symbols, transmited_chips, received_chips;

  <span class="comment">//Classes:</span>
  <a class="code" href="classitpp_1_1Multicode__Spread__2d.html" title="Multicode spreading of complex symbols to complex output.">Multicode_Spread_2d</a> mc_spread;
  <a class="code" href="classitpp_1_1AWGN__Channel.html" title="Ordinary AWGN Channel for cvec or vec inputs and outputs.">AWGN_Channel</a> channel;
  <a class="code" href="classitpp_1_1QPSK.html" title="QPSK modulator.">QPSK</a> qpsk;
  <a class="code" href="classitpp_1_1BERC.html" title="Bit Error Rate Counter (BERC) Class.">BERC</a> berc;

  <span class="comment">//Initialize the spreading:</span>
  SF = 4;                            <span class="comment">//The spreading factor is 4</span>
  Ncode = 4;                         <span class="comment">//Use all four codes in the multi-code spreader</span>
  all_codes = <a class="code" href="group__convertfunc.html#gaf713af60052f77c79cdb145311341e99" title="Converts a Mat&lt;T&gt; to smat.">to_smat</a>(<a class="code" href="group__specmat.html#ga10afe3456dd34b57639dee69e8f7d06f" title="Hadamard matrix.">hadamard</a>(SF)); <span class="comment">//Calculate the spreading codes</span>

  <span class="comment">//Set the spreading codes:</span>
  spread_codesI.set_size(Ncode, SF, <span class="keyword">false</span>);
  spread_codesQ.set_size(Ncode, SF, <span class="keyword">false</span>);
  <span class="keywordflow">for</span> (sc = 0; sc &lt; Ncode; sc++) {
    spread_codesI.set_row(sc, all_codes.get_row(sc));
    spread_codesQ.set_row(sc, all_codes.get_row(sc));
  }
  mc_spread.<a class="code" href="classitpp_1_1Multicode__Spread__2d.html#aa77a0c16beadaa6e31824140a15bebce" title="Set the spreading codes.">set_codes</a>(<a class="code" href="group__convertfunc.html#ga7d8813d98735a505d262763fa149dd2d" title="Converts a Mat&lt;T&gt; to mat.">to_mat</a>(spread_codesI), <a class="code" href="group__convertfunc.html#ga7d8813d98735a505d262763fa149dd2d" title="Converts a Mat&lt;T&gt; to mat.">to_mat</a>(spread_codesQ));

  <span class="comment">//Specify simulation specific variables:</span>
  EbN0dB = <a class="code" href="group__specmat.html#gae5632baa525e231b015f3d45f3503cac" title="Linspace (works in the same way as the matlab version)">linspace</a>(-2, 14, 17);
  EbN0 = <a class="code" href="group__logexpfunc.html#ga0c42d158b1f623f9b72c1ccde7e2fd09" title="Calculates x to the power of y (x^y)">pow</a>(10, EbN0dB / 10);
  Eb = 1.0;
  N0 = Eb * <a class="code" href="group__logexpfunc.html#ga0c42d158b1f623f9b72c1ccde7e2fd09" title="Calculates x to the power of y (x^y)">pow</a>(EbN0, -1.0);
  NumOfBits = 50000;
  MaxIterations = 10;
  MaxNrOfErrors = 200;
  MinNrOfErrors = 5;
  ber.set_size(EbN0dB.size(), <span class="keyword">false</span>);
  ber.clear();

  <span class="comment">//Randomize the random number generators:</span>
  <a class="code" href="group__randgen.html#gadf5dd6e879881b651896c213e6efd3ba" title="Set a random seed for the Global Random Number Generator.">RNG_randomize</a>();

  <span class="keywordflow">for</span> (i = 0; i &lt; EbN0dB.length(); i++) {

    cout &lt;&lt; endl &lt;&lt; <span class="stringliteral">&quot;Simulating point nr &quot;</span> &lt;&lt; i + 1 &lt;&lt; endl;
    berc.<a class="code" href="classitpp_1_1BERC.html#a3b575cfbe8dd194c2cd51a6aa52651e5" title="Clears the bit error counter.">clear</a>();
    channel.<a class="code" href="classitpp_1_1AWGN__Channel.html#aedf43a1a192a6c474ef915c297e9fcbb" title="Set noise variance (for complex-valued channels the sum of real and imaginary parts)">set_noise</a>(N0(i) / 2.0);

    <span class="keywordflow">for</span> (j = 0; j &lt; MaxIterations; j++) {

      transmited_bits = <a class="code" href="group__randgen.html#ga5aa06887cf1fd3301b040987924068f0" title="Generates a random bit (equally likely 0s and 1s)">randb</a>(NumOfBits);
      transmited_symbols  = qpsk.<a class="code" href="classitpp_1_1Modulator.html#a53826bf7e0ec83b99592235b0c2f6235" title="Modulation of bits.">modulate_bits</a>(transmited_bits);

      <span class="comment">//This is where we do the multi-code spreading:</span>
      transmited_chips =  mc_spread.<a class="code" href="classitpp_1_1Multicode__Spread__2d.html#a17bb74ea4c88fe0ffd565b9020dede28" title="Spreading of signal.">spread</a>(transmited_symbols);

      received_chips = channel(transmited_chips);

      <span class="comment">//The multi-code despreading:</span>
      <span class="comment">//The second argument tells the despreader that the offset is zero chips.</span>
      <span class="comment">//This offset is usefull on channels with delay.</span>
      received_symbols = mc_spread.<a class="code" href="classitpp_1_1Multicode__Spread__2d.html#ad191b52b55d0306fd7e591a299b4d94d" title="Despreading of signal. timing is the start position of the first symbol, given in number of samples...">despread</a>(received_chips, 0);

      received_bits = qpsk.<a class="code" href="classitpp_1_1PSK.html#aa3b14b2e7174454ddd1270915161bb4e" title="Hard demodulation of bits.">demodulate_bits</a>(received_symbols);

      berc.<a class="code" href="classitpp_1_1BERC.html#a539b0c989badff3027d97e4693fc9cd7" title="Cumulative error counter.">count</a>(transmited_bits, received_bits);
      ber(i) = berc.<a class="code" href="classitpp_1_1BERC.html#af17d5f534ba34558d3632a98f29f0519" title="Returns the estimated bit error rate.">get_errorrate</a>();

      cout &lt;&lt; <span class="stringliteral">&quot;   Itteration &quot;</span> &lt;&lt; j + 1 &lt;&lt; <span class="stringliteral">&quot;: ber = &quot;</span> &lt;&lt; berc.<a class="code" href="classitpp_1_1BERC.html#af17d5f534ba34558d3632a98f29f0519" title="Returns the estimated bit error rate.">get_errorrate</a>() &lt;&lt; endl;
      <span class="keywordflow">if</span> (berc.<a class="code" href="classitpp_1_1BERC.html#a02e757f28e87003404ad0d4aec1e44a6" title="Returns the counted number of bit errors.">get_errors</a>() &gt; MaxNrOfErrors) {
        cout &lt;&lt; <span class="stringliteral">&quot;Breaking on point &quot;</span> &lt;&lt; i + 1 &lt;&lt; <span class="stringliteral">&quot; with &quot;</span> &lt;&lt; berc.<a class="code" href="classitpp_1_1BERC.html#a02e757f28e87003404ad0d4aec1e44a6" title="Returns the counted number of bit errors.">get_errors</a>() &lt;&lt; <span class="stringliteral">&quot; errors.&quot;</span> &lt;&lt; endl;
        <span class="keywordflow">break</span>;
      }

    }

    <span class="keywordflow">if</span> (berc.<a class="code" href="classitpp_1_1BERC.html#a02e757f28e87003404ad0d4aec1e44a6" title="Returns the counted number of bit errors.">get_errors</a>() &lt; MinNrOfErrors) {
      cout &lt;&lt; <span class="stringliteral">&quot;Exiting Simulation on point &quot;</span> &lt;&lt; i + 1 &lt;&lt; endl;
      <span class="keywordflow">break</span>;
    }

  }

  <span class="comment">//Print results:</span>
  cout &lt;&lt; endl;
  cout &lt;&lt; <span class="stringliteral">&quot;EbN0dB = &quot;</span> &lt;&lt; EbN0dB &lt;&lt; endl;
  cout &lt;&lt; <span class="stringliteral">&quot;ber = &quot;</span> &lt;&lt; ber &lt;&lt; endl;

  <span class="comment">//Exit program:</span>
  <span class="keywordflow">return</span> 0;

}

</pre></div><p>A typical run of this program will look like this:</p>
<div class="fragment"><pre class="fragment">
Simulating point nr 1
   Itteration 1: ber = 0.13016
Breaking on point 1 with 6508 errors.

Simulating point nr 2
   Itteration 1: ber = 0.103
Breaking on point 2 with 5150 errors.

Simulating point nr 3
   Itteration 1: ber = 0.07886
Breaking on point 3 with 3943 errors.

Simulating point nr 4
   Itteration 1: ber = 0.05534
Breaking on point 4 with 2767 errors.

Simulating point nr 5
   Itteration 1: ber = 0.03822
Breaking on point 5 with 1911 errors.

Simulating point nr 6
   Itteration 1: ber = 0.02388
Breaking on point 6 with 1194 errors.

Simulating point nr 7
   Itteration 1: ber = 0.01316
Breaking on point 7 with 658 errors.

Simulating point nr 8
   Itteration 1: ber = 0.00586
Breaking on point 8 with 293 errors.

Simulating point nr 9
   Itteration 1: ber = 0.0027
   Itteration 2: ber = 0.00247
Breaking on point 9 with 247 errors.

Simulating point nr 10
   Itteration 1: ber = 0.00094
   Itteration 2: ber = 0.00086
   Itteration 3: ber = 0.00076
   Itteration 4: ber = 0.00077
   Itteration 5: ber = 0.0008
   Itteration 6: ber = 0.000796667
Breaking on point 10 with 239 errors.

Simulating point nr 11
   Itteration 1: ber = 0.00016
   Itteration 2: ber = 0.00016
   Itteration 3: ber = 0.000186667
   Itteration 4: ber = 0.000175
   Itteration 5: ber = 0.000172
   Itteration 6: ber = 0.000173333
   Itteration 7: ber = 0.000162857
   Itteration 8: ber = 0.00017
   Itteration 9: ber = 0.000166667
   Itteration 10: ber = 0.000172

Simulating point nr 12
   Itteration 1: ber = 4e-05
   Itteration 2: ber = 2e-05
   Itteration 3: ber = 2.66667e-05
   Itteration 4: ber = 2.5e-05
   Itteration 5: ber = 2e-05
   Itteration 6: ber = 2e-05
   Itteration 7: ber = 3.14286e-05
   Itteration 8: ber = 2.75e-05
   Itteration 9: ber = 2.44444e-05
   Itteration 10: ber = 2.6e-05

Simulating point nr 13
   Itteration 1: ber = 0
   Itteration 2: ber = 0
   Itteration 3: ber = 0
   Itteration 4: ber = 0
   Itteration 5: ber = 0
   Itteration 6: ber = 0
   Itteration 7: ber = 0
   Itteration 8: ber = 2.5e-06
   Itteration 9: ber = 2.22222e-06
   Itteration 10: ber = 2e-06
Exiting Simulation on point 13

EbN0dB = [-2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14]
ber = [0.13016 0.103 0.07886 0.05534 0.03822 0.02388 0.01316 0.00586 0.00247 0.000796667 0.000172 2.6e-05 2e-06 0 0 0 0]
</pre></div><p>Use copy-and-paste to insert the variables <code>EbN0dB</code> and <code>ber</code> into Matlab and plot the result. </p>
</div></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div style="clear: both; width: 100%; height: 31px; background-color: #ffff00; border: 1px solid #b0b0b0; margin: 5px 5px 5px 0; padding: 2px;">
  <a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=37044&amp;type=1" alt="SourceForge Logo" style="float: right; border: 0;"></a>
  <p style="padding-left: 10px; font-size: 85%;">Generated on Wed Jul 27 2011 16:27:06 for IT++ by <a href="http://www.doxygen.org/index.html">Doxygen</a> 1.7.4</p>
</div>
</body>
</html>