This file is indexed.

/usr/share/doc/libitpp-dev/html/spread.html is in libitpp-doc 4.3.1-3.

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
<!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.8.6 -->
<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>
        <div id="MSearchBox" class="MSearchBoxInactive">
          <div class="left">
            <form id="FSearchBox" action="search.php" method="get">
              <img id="MSearchSelect" src="search/mag.png" alt=""/>
              <input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S" 
                     onfocus="searchBox.OnSearchFieldFocus(true)" 
                     onblur="searchBox.OnSearchFieldFocus(false)"/>
            </form>
          </div><div class="right"></div>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Simulation of a Multicode CDMA system on an AWGN channel </div>  </div>
</div><!--header-->
<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"><div class="line"><span class="preprocessor">#include &lt;<a class="code" href="itcomm_8h.html">itpp/itcomm.h</a>&gt;</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">using namespace </span>itpp;</div>
<div class="line"></div>
<div class="line"><span class="comment">//These lines are needed for use of cout and endl</span></div>
<div class="line"><span class="keyword">using</span> std::cout;</div>
<div class="line"><span class="keyword">using</span> std::endl;</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">int</span> main()</div>
<div class="line">{</div>
<div class="line">  <span class="comment">//Scalars:</span></div>
<div class="line">  <span class="keywordtype">int</span> SF, Ncode, sc, i, j, NumOfBits, MaxIterations, MaxNrOfErrors, MinNrOfErrors;</div>
<div class="line">  <span class="keywordtype">double</span> Eb;</div>
<div class="line"></div>
<div class="line">  <span class="comment">//Vectors and matrixes:</span></div>
<div class="line">  vec EbN0dB, EbN0, N0, ber;</div>
<div class="line">  smat all_codes, spread_codesI, spread_codesQ;</div>
<div class="line">  bvec transmited_bits, received_bits;</div>
<div class="line">  cvec transmited_symbols, received_symbols, transmited_chips, received_chips;</div>
<div class="line"></div>
<div class="line">  <span class="comment">//Classes:</span></div>
<div class="line">  <a class="code" href="classitpp_1_1Multicode__Spread__2d.html">Multicode_Spread_2d</a> mc_spread;</div>
<div class="line">  <a class="code" href="classitpp_1_1AWGN__Channel.html">AWGN_Channel</a> channel;</div>
<div class="line">  <a class="code" href="classitpp_1_1QPSK.html">QPSK</a> qpsk;</div>
<div class="line">  <a class="code" href="classitpp_1_1BERC.html">BERC</a> berc;</div>
<div class="line"></div>
<div class="line">  <span class="comment">//Initialize the spreading:</span></div>
<div class="line">  SF = 4;                            <span class="comment">//The spreading factor is 4</span></div>
<div class="line">  Ncode = 4;                         <span class="comment">//Use all four codes in the multi-code spreader</span></div>
<div class="line">  all_codes = <a class="code" href="group__convertfunc.html#gac7c855f55a10bf3affdb26dbda8242b4">to_smat</a>(<a class="code" href="group__specmat.html#ga8ce5cf3016addfef54c999891116b7ef">hadamard</a>(SF)); <span class="comment">//Calculate the spreading codes</span></div>
<div class="line"></div>
<div class="line">  <span class="comment">//Set the spreading codes:</span></div>
<div class="line">  spread_codesI.set_size(Ncode, SF, <span class="keyword">false</span>);</div>
<div class="line">  spread_codesQ.set_size(Ncode, SF, <span class="keyword">false</span>);</div>
<div class="line">  <span class="keywordflow">for</span> (sc = 0; sc &lt; Ncode; sc++) {</div>
<div class="line">    spread_codesI.set_row(sc, all_codes.get_row(sc));</div>
<div class="line">    spread_codesQ.set_row(sc, all_codes.get_row(sc));</div>
<div class="line">  }</div>
<div class="line">  mc_spread.<a class="code" href="classitpp_1_1Multicode__Spread__2d.html#aa77a0c16beadaa6e31824140a15bebce">set_codes</a>(<a class="code" href="group__convertfunc.html#ga790487f584fdef1d3ee0889fa4986ffc">to_mat</a>(spread_codesI), <a class="code" href="group__convertfunc.html#ga790487f584fdef1d3ee0889fa4986ffc">to_mat</a>(spread_codesQ));</div>
<div class="line"></div>
<div class="line">  <span class="comment">//Specify simulation specific variables:</span></div>
<div class="line">  EbN0dB = <a class="code" href="group__specmat.html#ga00d68c6d3fa03dee1c8a03670dc574f4">linspace</a>(-2, 14, 17);</div>
<div class="line">  EbN0 = <a class="code" href="group__logexpfunc.html#ga0c42d158b1f623f9b72c1ccde7e2fd09">pow</a>(10, EbN0dB / 10);</div>
<div class="line">  Eb = 1.0;</div>
<div class="line">  N0 = Eb * <a class="code" href="group__logexpfunc.html#ga0c42d158b1f623f9b72c1ccde7e2fd09">pow</a>(EbN0, -1.0);</div>
<div class="line">  NumOfBits = 50000;</div>
<div class="line">  MaxIterations = 10;</div>
<div class="line">  MaxNrOfErrors = 200;</div>
<div class="line">  MinNrOfErrors = 5;</div>
<div class="line">  ber.set_size(EbN0dB.size(), <span class="keyword">false</span>);</div>
<div class="line">  ber.clear();</div>
<div class="line"></div>
<div class="line">  <span class="comment">//Randomize the random number generators:</span></div>
<div class="line">  <a class="code" href="group__randgen.html#ga001a62b1a1e3092d3bc60f71c95208cd">RNG_randomize</a>();</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">for</span> (i = 0; i &lt; EbN0dB.length(); i++) {</div>
<div class="line"></div>
<div class="line">    cout &lt;&lt; endl &lt;&lt; <span class="stringliteral">&quot;Simulating point nr &quot;</span> &lt;&lt; i + 1 &lt;&lt; endl;</div>
<div class="line">    berc.<a class="code" href="classitpp_1_1BERC.html#a3b575cfbe8dd194c2cd51a6aa52651e5">clear</a>();</div>
<div class="line">    channel.<a class="code" href="classitpp_1_1AWGN__Channel.html#aedf43a1a192a6c474ef915c297e9fcbb">set_noise</a>(N0(i) / 2.0);</div>
<div class="line"></div>
<div class="line">    <span class="keywordflow">for</span> (j = 0; j &lt; MaxIterations; j++) {</div>
<div class="line"></div>
<div class="line">      transmited_bits = <a class="code" href="group__randgen.html#ga5aa06887cf1fd3301b040987924068f0">randb</a>(NumOfBits);</div>
<div class="line">      transmited_symbols  = qpsk.<a class="code" href="classitpp_1_1Modulator.html#a53826bf7e0ec83b99592235b0c2f6235">modulate_bits</a>(transmited_bits);</div>
<div class="line"></div>
<div class="line">      <span class="comment">//This is where we do the multi-code spreading:</span></div>
<div class="line">      transmited_chips =  mc_spread.<a class="code" href="classitpp_1_1Multicode__Spread__2d.html#a17bb74ea4c88fe0ffd565b9020dede28">spread</a>(transmited_symbols);</div>
<div class="line"></div>
<div class="line">      received_chips = channel(transmited_chips);</div>
<div class="line"></div>
<div class="line">      <span class="comment">//The multi-code despreading:</span></div>
<div class="line">      <span class="comment">//The second argument tells the despreader that the offset is zero chips.</span></div>
<div class="line">      <span class="comment">//This offset is usefull on channels with delay.</span></div>
<div class="line">      received_symbols = mc_spread.<a class="code" href="classitpp_1_1Multicode__Spread__2d.html#ad191b52b55d0306fd7e591a299b4d94d">despread</a>(received_chips, 0);</div>
<div class="line"></div>
<div class="line">      received_bits = qpsk.<a class="code" href="classitpp_1_1PSK.html#aa3b14b2e7174454ddd1270915161bb4e">demodulate_bits</a>(received_symbols);</div>
<div class="line"></div>
<div class="line">      berc.<a class="code" href="classitpp_1_1BERC.html#a539b0c989badff3027d97e4693fc9cd7">count</a>(transmited_bits, received_bits);</div>
<div class="line">      ber(i) = berc.<a class="code" href="classitpp_1_1BERC.html#af17d5f534ba34558d3632a98f29f0519">get_errorrate</a>();</div>
<div class="line"></div>
<div class="line">      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">get_errorrate</a>() &lt;&lt; endl;</div>
<div class="line">      <span class="keywordflow">if</span> (berc.<a class="code" href="classitpp_1_1BERC.html#a02e757f28e87003404ad0d4aec1e44a6">get_errors</a>() &gt; MaxNrOfErrors) {</div>
<div class="line">        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">get_errors</a>() &lt;&lt; <span class="stringliteral">&quot; errors.&quot;</span> &lt;&lt; endl;</div>
<div class="line">        <span class="keywordflow">break</span>;</div>
<div class="line">      }</div>
<div class="line"></div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    <span class="keywordflow">if</span> (berc.<a class="code" href="classitpp_1_1BERC.html#a02e757f28e87003404ad0d4aec1e44a6">get_errors</a>() &lt; MinNrOfErrors) {</div>
<div class="line">      cout &lt;&lt; <span class="stringliteral">&quot;Exiting Simulation on point &quot;</span> &lt;&lt; i + 1 &lt;&lt; endl;</div>
<div class="line">      <span class="keywordflow">break</span>;</div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <span class="comment">//Print results:</span></div>
<div class="line">  cout &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;EbN0dB = &quot;</span> &lt;&lt; EbN0dB &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;ber = &quot;</span> &lt;&lt; ber &lt;&lt; endl;</div>
<div class="line"></div>
<div class="line">  <span class="comment">//Exit program:</span></div>
<div class="line">  <span class="keywordflow">return</span> 0;</div>
<div class="line"></div>
<div class="line">}</div>
<div class="line"></div>
</div><!-- fragment --><p>A typical run of this program will look like this:</p>
<div class="fragment"><div class="line"></div>
<div class="line">Simulating point nr 1</div>
<div class="line">   Itteration 1: ber = 0.13016</div>
<div class="line">Breaking on point 1 with 6508 errors.</div>
<div class="line"></div>
<div class="line">Simulating point nr 2</div>
<div class="line">   Itteration 1: ber = 0.103</div>
<div class="line">Breaking on point 2 with 5150 errors.</div>
<div class="line"></div>
<div class="line">Simulating point nr 3</div>
<div class="line">   Itteration 1: ber = 0.07886</div>
<div class="line">Breaking on point 3 with 3943 errors.</div>
<div class="line"></div>
<div class="line">Simulating point nr 4</div>
<div class="line">   Itteration 1: ber = 0.05534</div>
<div class="line">Breaking on point 4 with 2767 errors.</div>
<div class="line"></div>
<div class="line">Simulating point nr 5</div>
<div class="line">   Itteration 1: ber = 0.03822</div>
<div class="line">Breaking on point 5 with 1911 errors.</div>
<div class="line"></div>
<div class="line">Simulating point nr 6</div>
<div class="line">   Itteration 1: ber = 0.02388</div>
<div class="line">Breaking on point 6 with 1194 errors.</div>
<div class="line"></div>
<div class="line">Simulating point nr 7</div>
<div class="line">   Itteration 1: ber = 0.01316</div>
<div class="line">Breaking on point 7 with 658 errors.</div>
<div class="line"></div>
<div class="line">Simulating point nr 8</div>
<div class="line">   Itteration 1: ber = 0.00586</div>
<div class="line">Breaking on point 8 with 293 errors.</div>
<div class="line"></div>
<div class="line">Simulating point nr 9</div>
<div class="line">   Itteration 1: ber = 0.0027</div>
<div class="line">   Itteration 2: ber = 0.00247</div>
<div class="line">Breaking on point 9 with 247 errors.</div>
<div class="line"></div>
<div class="line">Simulating point nr 10</div>
<div class="line">   Itteration 1: ber = 0.00094</div>
<div class="line">   Itteration 2: ber = 0.00086</div>
<div class="line">   Itteration 3: ber = 0.00076</div>
<div class="line">   Itteration 4: ber = 0.00077</div>
<div class="line">   Itteration 5: ber = 0.0008</div>
<div class="line">   Itteration 6: ber = 0.000796667</div>
<div class="line">Breaking on point 10 with 239 errors.</div>
<div class="line"></div>
<div class="line">Simulating point nr 11</div>
<div class="line">   Itteration 1: ber = 0.00016</div>
<div class="line">   Itteration 2: ber = 0.00016</div>
<div class="line">   Itteration 3: ber = 0.000186667</div>
<div class="line">   Itteration 4: ber = 0.000175</div>
<div class="line">   Itteration 5: ber = 0.000172</div>
<div class="line">   Itteration 6: ber = 0.000173333</div>
<div class="line">   Itteration 7: ber = 0.000162857</div>
<div class="line">   Itteration 8: ber = 0.00017</div>
<div class="line">   Itteration 9: ber = 0.000166667</div>
<div class="line">   Itteration 10: ber = 0.000172</div>
<div class="line"></div>
<div class="line">Simulating point nr 12</div>
<div class="line">   Itteration 1: ber = 4e-05</div>
<div class="line">   Itteration 2: ber = 2e-05</div>
<div class="line">   Itteration 3: ber = 2.66667e-05</div>
<div class="line">   Itteration 4: ber = 2.5e-05</div>
<div class="line">   Itteration 5: ber = 2e-05</div>
<div class="line">   Itteration 6: ber = 2e-05</div>
<div class="line">   Itteration 7: ber = 3.14286e-05</div>
<div class="line">   Itteration 8: ber = 2.75e-05</div>
<div class="line">   Itteration 9: ber = 2.44444e-05</div>
<div class="line">   Itteration 10: ber = 2.6e-05</div>
<div class="line"></div>
<div class="line">Simulating point nr 13</div>
<div class="line">   Itteration 1: ber = 0</div>
<div class="line">   Itteration 2: ber = 0</div>
<div class="line">   Itteration 3: ber = 0</div>
<div class="line">   Itteration 4: ber = 0</div>
<div class="line">   Itteration 5: ber = 0</div>
<div class="line">   Itteration 6: ber = 0</div>
<div class="line">   Itteration 7: ber = 0</div>
<div class="line">   Itteration 8: ber = 2.5e-06</div>
<div class="line">   Itteration 9: ber = 2.22222e-06</div>
<div class="line">   Itteration 10: ber = 2e-06</div>
<div class="line">Exiting Simulation on point 13</div>
<div class="line"></div>
<div class="line">EbN0dB = [-2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14]</div>
<div class="line">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]</div>
</div><!-- fragment --><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><!-- contents -->
<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 Sat Mar 22 2014 05:34:27 for IT++ by <a href="http://www.doxygen.org/index.html">Doxygen</a> 1.8.6</p>
</div>
</body>
</html>