This file is indexed.

/usr/share/doc/libitpp-dev/html/mimoconv.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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<!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">MIMO (spatial multiplexing) with convolutional coding </div>  </div>
</div>
<div class="contents">
<div class="textblock"><p>This example demonstrates how to use the <code>Modulator_ND</code> (MIMO) class for soft-output demodulation. The program simulates a simple convolutionally coded spatial-multiplexing (V-BLAST style) MIMO system with maximum-likelihood, alternatively zero-forcing, demodulation and soft Viterbi decoding, but no iteration between the demodulator and the decoder.</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="keyword">using namespace </span>std;


<span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)
{
  <span class="comment">// -- modulation and channel parameters (taken from command line input) --</span>
  <span class="keywordtype">int</span> nC;                    <span class="comment">// type of constellation  (1=QPSK, 2=16-QAM, 3=64-QAM)</span>
  <span class="keywordtype">int</span> nRx;                   <span class="comment">// number of receive antennas</span>
  <span class="keywordtype">int</span> nTx;                   <span class="comment">// number of transmit antennas</span>
  <span class="keywordtype">int</span> Tc;                    <span class="comment">// coherence time (number of channel vectors with same H)</span>

  <span class="keywordflow">if</span> (argc != 5) {
    cout &lt;&lt; <span class="stringliteral">&quot;Usage: cm nTx nRx nC Tc&quot;</span> &lt;&lt; endl &lt;&lt; <span class="stringliteral">&quot;Example: cm 2 2 1 100000 (2x2 QPSK MIMO on slow fading channel)&quot;</span> &lt;&lt; endl;
    exit(1);
  }
  <span class="keywordflow">else</span> {
    sscanf(argv[1], <span class="stringliteral">&quot;%i&quot;</span>, &amp;nTx);
    sscanf(argv[2], <span class="stringliteral">&quot;%i&quot;</span>, &amp;nRx);
    sscanf(argv[3], <span class="stringliteral">&quot;%i&quot;</span>, &amp;nC);
    sscanf(argv[4], <span class="stringliteral">&quot;%i&quot;</span>, &amp;Tc);
  }

  cout &lt;&lt; <span class="stringliteral">&quot;Initializing.. &quot;</span> &lt;&lt; nTx &lt;&lt; <span class="stringliteral">&quot; TX antennas, &quot;</span> &lt;&lt; nRx &lt;&lt; <span class="stringliteral">&quot; RX antennas, &quot;</span>
       &lt;&lt; (1 &lt;&lt; nC) &lt;&lt; <span class="stringliteral">&quot;-PAM per dimension, coherence time &quot;</span> &lt;&lt; Tc &lt;&lt; endl;

  <span class="comment">// -- simulation control parameters --</span>
  <span class="keyword">const</span> vec EbN0db = <span class="stringliteral">&quot;-5:0.5:50&quot;</span>;        <span class="comment">// SNR range</span>
  <span class="keyword">const</span> <span class="keywordtype">int</span> Nmethods = 2;                 <span class="comment">// number of demodulators to try</span>
  <span class="keyword">const</span> <span class="keywordtype">int</span> Nbitsmax = 50000000;  <span class="comment">// maximum number of bits to ever simulate per SNR point</span>
  <span class="keyword">const</span> <span class="keywordtype">int</span> Nu = 1000;                   <span class="comment">// length of data packet (before applying channel coding)</span>

  <span class="keywordtype">int</span> Nbers, Nfers;              <span class="comment">// target number of bit/frame errors per SNR point</span>
  <span class="keywordtype">double</span> BERmin, FERmin;         <span class="comment">// BER/FER at which to terminate simulation</span>
  <span class="keywordflow">if</span> (Tc == 1) {         <span class="comment">// Fast fading channel, BER is of primary interest</span>
    BERmin = 0.001;      <span class="comment">// stop simulating a given method if BER&lt;this value</span>
    FERmin = 1.0e-10;    <span class="comment">// stop simulating a given method if FER&lt;this value</span>
    Nbers = 1000;        <span class="comment">// move to next SNR point after counting 1000 bit errors</span>
    Nfers = 200;         <span class="comment">// do not stop on this condition</span>
  }
  <span class="keywordflow">else</span> {               <span class="comment">// Slow fading channel, FER is of primary interest here</span>
    BERmin = 1.0e-15;    <span class="comment">// stop simulating a given method if BER&lt;this value</span>
    FERmin = 0.01;       <span class="comment">// stop simulating a given method if FER&lt;this value</span>
    Nbers = -1;          <span class="comment">// do not stop on this condition</span>
    Nfers = 200;         <span class="comment">// move to next SNR point after counting 200 frame errors</span>
  }

  <span class="comment">// -- Channel code parameters --</span>
  <a class="code" href="classitpp_1_1Convolutional__Code.html" title="Binary Convolutional rate 1/n class.">Convolutional_Code</a> code;
  ivec generator(3);
  generator(0) = 0133;  <span class="comment">// use rate 1/3 code</span>
  generator(1) = 0165;
  generator(2) = 0171;
  <span class="keywordtype">double</span> rate = 1.0 / 3.0;
  code.<a class="code" href="classitpp_1_1Convolutional__Code.html#ab8ca18ab14b3b6a1e1a1132f0386c84f" title="Set generator polynomials. Given in Proakis integer form.">set_generator_polynomials</a>(generator, 7);
  bvec dummy;
  code.<a class="code" href="classitpp_1_1Convolutional__Code.html#a47230acfea5aa32cb31e63abca1d222e" title="Encoding that starts and ends in the zero state.">encode_tail</a>(<a class="code" href="group__randgen.html#ga5aa06887cf1fd3301b040987924068f0" title="Generates a random bit (equally likely 0s and 1s)">randb</a>(Nu), dummy);
  <span class="keyword">const</span> <span class="keywordtype">int</span> Nc = <a class="code" href="group__matrix__functions.html#ga97bb6b35d6d4c683c7558842e4500c2d" title="Length of vector.">length</a>(dummy);      <span class="comment">// find out how long the coded blocks are</span>

  <span class="comment">// ============= Initialize ====================================</span>

  <span class="keyword">const</span> <span class="keywordtype">int</span> Nctx = (int)(2 * nC * nTx * <a class="code" href="group__convertfunc.html#ga21dd9f813dc0a0342a5d0124b5c2ef33" title="Round to nearest upper integer.">ceil</a>(<span class="keywordtype">double</span>(Nc) / <span class="keywordtype">double</span>(2 * nC * nTx)));   <span class="comment">// Total number of bits to transmit</span>
  <span class="keyword">const</span> <span class="keywordtype">int</span> Nvec = Nctx / (2 * nC * nTx);    <span class="comment">// Number of channel vectors to transmit</span>
  <span class="keyword">const</span> <span class="keywordtype">int</span> Nbitspvec = 2 * nC * nTx;        <span class="comment">// Number of bits per channel vector</span>

  <span class="comment">// initialize MIMO channel with uniform QAM per complex dimension and Gray coding</span>
  <a class="code" href="classitpp_1_1ND__UQAM.html" title="Complex MIMO channel with uniform QAM per dimension.">ND_UQAM</a> chan;
  chan.<a class="code" href="classitpp_1_1ND__UQAM.html#ae52a188982cb681b069e7d6e985a7d06" title="Set component modulators to M-QAM with Gray mapping.">set_M</a>(nTx, 1 &lt;&lt; (2*nC));
  cout &lt;&lt; chan &lt;&lt; endl;

  <span class="comment">// initialize interleaver</span>
  <a class="code" href="classitpp_1_1Sequence__Interleaver.html">Sequence_Interleaver&lt;bin&gt;</a> sequence_interleaver_b(Nctx);
  <a class="code" href="classitpp_1_1Sequence__Interleaver.html" title="Sequence Interleaver Class.">Sequence_Interleaver&lt;int&gt;</a> sequence_interleaver_i(Nctx);
  sequence_interleaver_b.randomize_interleaver_sequence();
  sequence_interleaver_i.set_interleaver_sequence(sequence_interleaver_b.get_interleaver_sequence());

  <span class="comment">//  RNG_randomize();</span>

  <a class="code" href="classitpp_1_1Array.html">Array&lt;cvec&gt;</a> Y(Nvec);        <span class="comment">// received data</span>
  <a class="code" href="classitpp_1_1Array.html" title="General array class.">Array&lt;cmat&gt;</a> H(Nvec / Tc + 1);   <span class="comment">// channel matrix (new matrix for each coherence interval)</span>

  ivec Contflag = <a class="code" href="group__specmat.html#ga42a431a8a221e1eae1749d6eb4321869" title="A Int vector of ones.">ones_i</a>(Nmethods);   <span class="comment">// flag to determine whether to run a given demodulator</span>
  <span class="keywordflow">if</span> (<a class="code" href="group__logexpfunc.html#ga0c42d158b1f623f9b72c1ccde7e2fd09" title="Calculates x to the power of y (x^y)">pow</a>(2.0, nC*2.0*nTx) &gt; 256) {   <span class="comment">// ML decoder too complex..</span>
    Contflag(1) = 0;
  }
  <span class="keywordflow">if</span> (nTx &gt; nRx) {
    Contflag(0) = 0;                  <span class="comment">// ZF not for underdetermined systems</span>
  }
  cout &lt;&lt; <span class="stringliteral">&quot;Running methods: &quot;</span> &lt;&lt; Contflag &lt;&lt; endl;

  cout.setf(ios::fixed, ios::floatfield);
  cout.setf(ios::showpoint);
  cout.precision(5);

  <span class="comment">// ================== Run simulation =======================</span>
  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> nsnr = 0; nsnr &lt; <a class="code" href="group__matrix__functions.html#ga97bb6b35d6d4c683c7558842e4500c2d" title="Length of vector.">length</a>(EbN0db); nsnr++) {
    <span class="keyword">const</span> <span class="keywordtype">double</span> Eb = 1.0; <span class="comment">// transmitted energy per information bit</span>
    <span class="keyword">const</span> <span class="keywordtype">double</span> N0 = <a class="code" href="group__logexpfunc.html#ga9a4a3d1188d2ec6a6815c237bd3ab2cc" title="Inverse of decibel of x.">inv_dB</a>(-EbN0db(nsnr));
    <span class="keyword">const</span> <span class="keywordtype">double</span> sigma2 = N0; <span class="comment">// Variance of each scalar complex noise sample</span>
    <span class="keyword">const</span> <span class="keywordtype">double</span> Es = rate * 2 * nC * Eb; <span class="comment">// Energy per complex scalar symbol</span>
    <span class="comment">// (Each transmitted scalar complex symbol contains rate*2*nC</span>
    <span class="comment">// information bits.)</span>
    <span class="keyword">const</span> <span class="keywordtype">double</span> Ess = <a class="code" href="group__miscfunc.html#gaf559d29ca56ad3396a4284964b01a9b0" title="Square root of the elements.">sqrt</a>(Es);

    <a class="code" href="classitpp_1_1Array.html" title="General array class.">Array&lt;BERC&gt;</a> berc(Nmethods);  <span class="comment">// counter for coded BER</span>
    <a class="code" href="classitpp_1_1Array.html" title="General array class.">Array&lt;BERC&gt;</a> bercu(Nmethods); <span class="comment">// counter for uncoded BER</span>
    <a class="code" href="classitpp_1_1Array.html" title="General array class.">Array&lt;BLERC&gt;</a> ferc(Nmethods); <span class="comment">// counter for coded FER</span>

    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; Nmethods; i++) {
      ferc(i).<a class="code" href="classitpp_1_1BLERC.html#a43db2b81f9aada3bb4b0d644fa188f5e" title="Set the block size.">set_blocksize</a>(Nu);
    }

    <span class="keywordtype">long</span> <span class="keywordtype">int</span> nbits = 0;
    <span class="keywordflow">while</span> (nbits &lt; Nbitsmax) {
      nbits += Nu;

      <span class="comment">// generate and encode random data</span>
      bvec inputbits = <a class="code" href="group__randgen.html#ga5aa06887cf1fd3301b040987924068f0" title="Generates a random bit (equally likely 0s and 1s)">randb</a>(Nu);
      bvec txbits;
      code.<a class="code" href="classitpp_1_1Convolutional__Code.html#a47230acfea5aa32cb31e63abca1d222e" title="Encoding that starts and ends in the zero state.">encode_tail</a>(inputbits, txbits);
      <span class="comment">// coded block length is not always a multiple of the number of</span>
      <span class="comment">// bits per channel vector</span>
      txbits = <a class="code" href="namespaceitpp.html#ad98037d7e388fae1104114624060998f" title="Append element e to the end of the Array a.">concat</a>(txbits, <a class="code" href="group__randgen.html#ga5aa06887cf1fd3301b040987924068f0" title="Generates a random bit (equally likely 0s and 1s)">randb</a>(Nctx - Nc));
      txbits = sequence_interleaver_b.interleave(txbits);

      <span class="comment">// -- generate channel and data ----</span>
      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 0; k &lt; Nvec; k++) {
        <span class="comment">/* A complex valued channel matrix is used here. An</span>
<span class="comment">           alternative (with equivalent result) would be to use a</span>
<span class="comment">           real-valued (structured) channel matrix of twice the</span>
<span class="comment">           dimension.</span>
<span class="comment">        */</span>
        <span class="keywordflow">if</span> (k % Tc == 0) {   <span class="comment">// generate a new channel realization every Tc intervals</span>
          H(k / Tc) = Ess * <a class="code" href="group__randgen.html#ga3c0042e44132fb903d44e7c5a03f5db3" title="Generates a random complex Gaussian (0,1) variable.">randn_c</a>(nRx, nTx);
        }

        <span class="comment">// modulate and transmit bits</span>
        bvec bitstmp = txbits(k * 2 * nTx * nC, (k + 1) * 2 * nTx * nC - 1);
        cvec x = chan.<a class="code" href="classitpp_1_1Modulator__NCD.html#a6e0475c4f4dc96d08f5f4707a9dfaf17" title="Modulate bits into symbols.">modulate_bits</a>(bitstmp);
        cvec e = <a class="code" href="group__miscfunc.html#gaf559d29ca56ad3396a4284964b01a9b0" title="Square root of the elements.">sqrt</a>(sigma2) * <a class="code" href="group__randgen.html#ga3c0042e44132fb903d44e7c5a03f5db3" title="Generates a random complex Gaussian (0,1) variable.">randn_c</a>(nRx);
        Y(k) = H(k / Tc) * x + e;
      }

      <span class="comment">// -- demodulate --</span>
      <a class="code" href="classitpp_1_1Array.html" title="General array class.">Array&lt;QLLRvec&gt;</a> LLRin(Nmethods);
      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; Nmethods; i++) {
        LLRin(i) = <a class="code" href="group__specmat.html#ga9c37bc66992f8d3d29d8c3aef6a5a514" title="A Int vector of zeros.">zeros_i</a>(Nctx);
      }

      QLLRvec llr_apr = <a class="code" href="group__specmat.html#ga9c37bc66992f8d3d29d8c3aef6a5a514" title="A Int vector of zeros.">zeros_i</a>(nC * 2 * nTx);  <span class="comment">// no a priori input to demodulator</span>
      QLLRvec llr_apost = <a class="code" href="group__specmat.html#ga9c37bc66992f8d3d29d8c3aef6a5a514" title="A Int vector of zeros.">zeros_i</a>(nC * 2 * nTx);
      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 0; k &lt; Nvec; k++) {
        <span class="comment">// zero forcing demodulation</span>
        <span class="keywordflow">if</span> (Contflag(0)) {
          chan.<a class="code" href="classitpp_1_1Modulator__NCD.html#aa25a04d3c20e24c033a1dd152e674f7c" title="Soft demodulation wrapper function for various methods.">demodulate_soft_bits</a>(Y(k), H(k / Tc), sigma2, llr_apr, llr_apost,
                                    <a class="code" href="classitpp_1_1Modulator__ND.html#a6e3b4c745f904cdb34301aeb4cc03035ad5798fd18f93f399475392b8aee09cba" title="Zero-Forcing Log-MAP approximated demodulation.">ND_UQAM::ZF_LOGMAP</a>);
          LLRin(0).set_subvector(k*Nbitspvec, llr_apost);
        }

        <span class="comment">// ML demodulation</span>
        <span class="keywordflow">if</span> (Contflag(1)) {
          chan.<a class="code" href="classitpp_1_1Modulator__NCD.html#aa25a04d3c20e24c033a1dd152e674f7c" title="Soft demodulation wrapper function for various methods.">demodulate_soft_bits</a>(Y(k), H(k / Tc), sigma2, llr_apr, llr_apost);
          LLRin(1).set_subvector(k*Nbitspvec, llr_apost);
        }
      }

      <span class="comment">// -- decode and count errors --</span>
      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; Nmethods; i++) {
        bvec decoded_bits;
        <span class="keywordflow">if</span> (Contflag(i)) {
          bercu(i).count(txbits(0, Nc - 1), LLRin(i)(0, Nc - 1) &lt; 0);  <span class="comment">// uncoded BER</span>
          LLRin(i) = sequence_interleaver_i.deinterleave(LLRin(i), 0);
          <span class="comment">// QLLR values must be converted to real numbers since the convolutional decoder wants this</span>
          vec llr = chan.<a class="code" href="classitpp_1_1Modulator__ND.html#ab68aa9155f305d9fb4e8d3cab45d5c9d" title="Get LLR calculation unit.">get_llrcalc</a>().<a class="code" href="classitpp_1_1LLR__calc__unit.html#a6fe45918d01b24059e4173b7bf939f91" title="Convert an LLR type to a &quot;real&quot; LLR.">to_double</a>(LLRin(i).left(Nc));
          <span class="comment">//   llr=-llr; // UNCOMMENT THIS LINE IF COMPILING WITH 3.10.5 OR EARLIER (BEFORE HARMONIZING LLR CONVENTIONS)</span>
          code.<a class="code" href="classitpp_1_1Convolutional__Code.html#a9f42d8c8bdb51460ebc7d43deb93bad7" title="Decode a block of encoded data where encode_tail has been used.">decode_tail</a>(llr, decoded_bits);
          berc(i).<a class="code" href="classitpp_1_1BERC.html#a539b0c989badff3027d97e4693fc9cd7" title="Cumulative error counter.">count</a>(inputbits(0, Nu - 1), decoded_bits(0, Nu - 1));  <span class="comment">// coded BER</span>
          ferc(i).<a class="code" href="classitpp_1_1BLERC.html#abe58d4abce92b4b53ad614a28aac20e7" title="Calculate the number of block errors between in1 and in2.">count</a>(inputbits(0, Nu - 1), decoded_bits(0, Nu - 1));  <span class="comment">// coded FER</span>
        }
      }

      <span class="comment">/* Check whether it is time to terminate the simulation.</span>
<span class="comment">       Terminate when all demodulators that are still running have</span>
<span class="comment">       counted at least Nbers or Nfers bit/frame errors. */</span>
      <span class="keywordtype">int</span> minber = 1000000;
      <span class="keywordtype">int</span> minfer = 1000000;
      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; Nmethods; i++) {
        <span class="keywordflow">if</span> (Contflag(i)) {
          minber = <a class="code" href="group__miscfunc.html#ga814aaa20dabe8eeb87c95116491a0341" title="Minimum value of vector.">min</a>(minber, <a class="code" href="group__convertfunc.html#ga82f2a2bcb10cbc8aa8c450ef5cc2c1a7" title="Round to nearest integer.">round_i</a>(berc(i).get_errors()));
          minfer = <a class="code" href="group__miscfunc.html#ga814aaa20dabe8eeb87c95116491a0341" title="Minimum value of vector.">min</a>(minfer, <a class="code" href="group__convertfunc.html#ga82f2a2bcb10cbc8aa8c450ef5cc2c1a7" title="Round to nearest integer.">round_i</a>(ferc(i).get_errors()));
        }
      }
      <span class="keywordflow">if</span> (Nbers &gt; 0 &amp;&amp; minber &gt; Nbers) { <span class="keywordflow">break</span>;}
      <span class="keywordflow">if</span> (Nfers &gt; 0 &amp;&amp; minfer &gt; Nfers) { <span class="keywordflow">break</span>;}
    }

    cout &lt;&lt; <span class="stringliteral">&quot;-----------------------------------------------------&quot;</span> &lt;&lt; endl;
    cout &lt;&lt; <span class="stringliteral">&quot;Eb/N0: &quot;</span> &lt;&lt; EbN0db(nsnr) &lt;&lt; <span class="stringliteral">&quot; dB. Simulated &quot;</span> &lt;&lt; nbits &lt;&lt; <span class="stringliteral">&quot; bits.&quot;</span> &lt;&lt; endl;
    cout &lt;&lt; <span class="stringliteral">&quot; Uncoded BER: &quot;</span> &lt;&lt; bercu(0).get_errorrate() &lt;&lt; <span class="stringliteral">&quot; (ZF);     &quot;</span> &lt;&lt; bercu(1).get_errorrate() &lt;&lt; <span class="stringliteral">&quot; (ML)&quot;</span> &lt;&lt; endl;
    cout &lt;&lt; <span class="stringliteral">&quot; Coded BER:   &quot;</span> &lt;&lt; berc(0).<a class="code" href="classitpp_1_1BERC.html#af17d5f534ba34558d3632a98f29f0519" title="Returns the estimated bit error rate.">get_errorrate</a>()  &lt;&lt; <span class="stringliteral">&quot; (ZF);     &quot;</span> &lt;&lt; berc(1).<a class="code" href="classitpp_1_1BERC.html#af17d5f534ba34558d3632a98f29f0519" title="Returns the estimated bit error rate.">get_errorrate</a>()  &lt;&lt; <span class="stringliteral">&quot; (ML)&quot;</span> &lt;&lt; endl;
    cout &lt;&lt; <span class="stringliteral">&quot; Coded FER:   &quot;</span> &lt;&lt; ferc(0).<a class="code" href="classitpp_1_1BLERC.html#a724ae26011a5389735bf7974775ff3ad" title="Returns the block error rate.">get_errorrate</a>()  &lt;&lt; <span class="stringliteral">&quot; (ZF);     &quot;</span> &lt;&lt; ferc(1).<a class="code" href="classitpp_1_1BLERC.html#a724ae26011a5389735bf7974775ff3ad" title="Returns the block error rate.">get_errorrate</a>()  &lt;&lt; <span class="stringliteral">&quot; (ML)&quot;</span> &lt;&lt; endl;
    cout.flush();

    <span class="comment">/* Check wheter it is time to terminate simulation. Stop when all</span>
<span class="comment">    methods have reached the min BER/FER of interest. */</span>
    <span class="keywordtype">int</span> contflag = 0;
    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; Nmethods; i++) {
      <span class="keywordflow">if</span> (Contflag(i)) {
        <span class="keywordflow">if</span> (berc(i).get_errorrate() &gt; BERmin)  {  contflag = 1;  }
        <span class="keywordflow">else</span> { Contflag(i) = 0; }
        <span class="keywordflow">if</span> (ferc(i).get_errorrate() &gt; FERmin)  {  contflag = 1;  }
        <span class="keywordflow">else</span> { Contflag(i) = 0; }
      }
    }
    <span class="keywordflow">if</span> (contflag) { <span class="keywordflow">continue</span>; }
    <span class="keywordflow">else</span> {<span class="keywordflow">break</span>; }
  }

  <span class="keywordflow">return</span> 0;
}
</pre></div><p>To run the program,</p>
<div class="fragment"><pre class="fragment">mimoconv nTx nRx nC Tc
</pre></div><p> where</p>
<ul>
<li>nTx=number of transmit antennas</li>
<li>nRx=number of receive antennas</li>
<li>nC=constellation (1=QPSK, 2=16-QAM, 3=64-QAM)</li>
<li>Tc=coherence time (channel uses) </li>
</ul>
</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>