/usr/share/doc/libitpp-dev/html/convcode.html is in libitpp-doc 4.3.1-7.
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 | <!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.11 -->
<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 Page</span></a></li>
<li class="current"><a href="pages.html"><span>Related 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 convolutional encoder and decoder </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>In this example we will show how to use the convolutional encoder/decoder class in it++. The Viterbi decoder uses the soft received values.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="itcomm_8h.html">itpp/itcomm.h</a>></span></div><div class="line"></div><div class="line"><span class="keyword">using namespace </span><a class="code" href="namespaceitpp.html">itpp</a>;</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> constraint_length, MaxNrofErrors, Nobits, MaxIterations, p, i;</div><div class="line"> <span class="keywordtype">double</span> Ec, Eb;</div><div class="line"></div><div class="line"> <span class="comment">//Vectors</span></div><div class="line"> ivec generators;</div><div class="line"> vec EbN0dB, EbN0, N0, ber, trans_symbols, rec_symbols;</div><div class="line"> bvec uncoded_bits, coded_bits, decoded_bits;</div><div class="line"></div><div class="line"> <span class="comment">//Classes</span></div><div class="line"> <a class="code" href="classitpp_1_1BPSK.html">BPSK</a> bpsk;</div><div class="line"> <a class="code" href="classitpp_1_1BERC.html">BERC</a> berc;</div><div class="line"> <a class="code" href="classitpp_1_1Convolutional__Code.html">Convolutional_Code</a> conv_code;</div><div class="line"> <a class="code" href="classitpp_1_1AWGN__Channel.html">AWGN_Channel</a> channel;</div><div class="line"></div><div class="line"> <span class="comment">/*</span></div><div class="line"><span class="comment"> Set up the convolutional encoder/decoder class:</span></div><div class="line"><span class="comment"> The generators are given in octal form by adding a zero in front of the numbers.</span></div><div class="line"><span class="comment"> In this example we will simulate a rate 1/3 code that is listed in J. G. Proakis,</span></div><div class="line"><span class="comment"> "Digital communications". The encoder has constraint length 7.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"> generators.set_size(3, <span class="keyword">false</span>);</div><div class="line"> generators(0) = 0133;</div><div class="line"> generators(1) = 0145;</div><div class="line"> generators(2) = 0175;</div><div class="line"> constraint_length = 7;</div><div class="line"> conv_code.<a class="code" href="classitpp_1_1Convolutional__Code.html#ab8ca18ab14b3b6a1e1a1132f0386c84f">set_generator_polynomials</a>(generators, constraint_length);</div><div class="line"></div><div class="line"> <span class="comment">//Init: Calculate some simulation specific parameters:</span></div><div class="line"> Ec = 1.0;</div><div class="line"> EbN0dB = <a class="code" href="group__specmat.html#ga00d68c6d3fa03dee1c8a03670dc574f4">linspace</a>(-2, 6, 5);</div><div class="line"> EbN0 = <a class="code" href="group__logexpfunc.html#ga9a4a3d1188d2ec6a6815c237bd3ab2cc">inv_dB</a>(EbN0dB);</div><div class="line"> Eb = Ec / conv_code.<a class="code" href="classitpp_1_1Convolutional__Code.html#ae7e892230d677d7b64917cd6f8e7b823">get_rate</a>();</div><div class="line"> N0 = Eb * <a class="code" href="group__logexpfunc.html#ga0c42d158b1f623f9b72c1ccde7e2fd09">pow</a>(EbN0, -1);</div><div class="line"> MaxNrofErrors = 100;</div><div class="line"> Nobits = 10000;</div><div class="line"> MaxIterations = 10;</div><div class="line"> ber.set_size(EbN0dB.length(), <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> (p = 0; p < EbN0dB.length(); p++) {</div><div class="line"></div><div class="line"> cout << <span class="stringliteral">"Now simulating point "</span> << p + 1 << <span class="stringliteral">" out of "</span> << EbN0dB.length() << endl;</div><div class="line"> berc.<a class="code" href="classitpp_1_1BERC.html#a3b575cfbe8dd194c2cd51a6aa52651e5">clear</a>(); <span class="comment">//Clear the bit error rate counter.</span></div><div class="line"> channel.<a class="code" href="classitpp_1_1AWGN__Channel.html#aedf43a1a192a6c474ef915c297e9fcbb">set_noise</a>(N0(p) / 2.0); <span class="comment">//Set the noise value of the AWGN channel.</span></div><div class="line"></div><div class="line"> <span class="keywordflow">for</span> (i = 0; i < MaxIterations; i++) {</div><div class="line"></div><div class="line"> uncoded_bits = <a class="code" href="group__randgen.html#ga5aa06887cf1fd3301b040987924068f0">randb</a>(Nobits); <span class="comment">//The uncoded bits.</span></div><div class="line"> coded_bits = conv_code.<a class="code" href="classitpp_1_1Convolutional__Code.html#af9d5354b5ea7f2a090a488b383e995ef">encode</a>(uncoded_bits); <span class="comment">//The convolutional encoder function.</span></div><div class="line"> bpsk.<a class="code" href="classitpp_1_1BPSK.html#aff002bcb92f62a0f01e76ce1b0ab543e">modulate_bits</a>(coded_bits, trans_symbols); <span class="comment">//The BPSK modulator.</span></div><div class="line"> rec_symbols = channel(trans_symbols); <span class="comment">//The AWGN channel.</span></div><div class="line"> decoded_bits = conv_code.<a class="code" href="classitpp_1_1Convolutional__Code.html#af3bf2206a471342563a4080e42d6b435">decode</a>(rec_symbols); <span class="comment">//The Viterbi decoder function.</span></div><div class="line"> berc.<a class="code" href="classitpp_1_1BERC.html#a539b0c989badff3027d97e4693fc9cd7">count</a>(uncoded_bits, decoded_bits); <span class="comment">//Count the errors.</span></div><div class="line"> ber(p) = berc.<a class="code" href="classitpp_1_1BERC.html#af17d5f534ba34558d3632a98f29f0519">get_errorrate</a>();</div><div class="line"></div><div class="line"> <span class="comment">//Break the simulation on this point if sufficient number of bit errors were observed:</span></div><div class="line"> <span class="keywordflow">if</span> (berc.<a class="code" href="classitpp_1_1BERC.html#a02e757f28e87003404ad0d4aec1e44a6">get_errors</a>() > MaxNrofErrors) {</div><div class="line"> cout << <span class="stringliteral">"Breaking on point "</span> << p + 1 << <span class="stringliteral">" with "</span> << berc.<a class="code" href="classitpp_1_1BERC.html#a02e757f28e87003404ad0d4aec1e44a6">get_errors</a>() << <span class="stringliteral">" errors."</span> << 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"></div><div class="line"> <span class="comment">//Print the results:</span></div><div class="line"> cout << <span class="stringliteral">"BER = "</span> << ber << endl;</div><div class="line"> cout << <span class="stringliteral">"EbN0dB = "</span> << EbN0dB << 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><!-- fragment --><p>When you run this program, the output will look something like this:</p>
<div class="fragment"><div class="line">Now simulating point 1 out of 5</div><div class="line">Breaking on point 1 with 3297 errors.</div><div class="line">Now simulating point 2 out of 5</div><div class="line">Breaking on point 2 with 781 errors.</div><div class="line">Now simulating point 3 out of 5</div><div class="line">Breaking on point 3 with 112 errors.</div><div class="line">Now simulating point 4 out of 5</div><div class="line">Now simulating point 5 out of 5</div><div class="line">BER = [0.330858 0.0783743 0.00280983 0 0]</div><div class="line">EbN0dB = [-2 0 2 4 6]</div></div><!-- fragment --> </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;">
<p style="padding-left: 10px; font-size: 85%;">Generated on Tue Aug 2 2016 16:13:35 for IT++ by <a href="http://www.doxygen.org/index.html">Doxygen</a> 1.8.11</p>
</div>
</body>
</html>
|