root/doc/html/classitpp_1_1Scalar__Quantizer.html @ 354

Revision 353, 12.2 kB (checked in by smidl, 15 years ago)

doc

Line 
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: itpp::Scalar_Quantizer Class Reference</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<!--
10function 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}
22function 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}
46window.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&nbsp;Page</span></a></li>
53      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
54      <li><a href="modules.html"><span>Modules</span></a></li>
55      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
56      <li><a href="files.html"><span>Files</span></a></li>
57    </ul>
58  </div>
59  <div class="tabs">
60    <ul>
61      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
62      <li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
63      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
64      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
65    </ul>
66  </div>
67  <div class="navpath"><b>itpp</b>::<a class="el" href="classitpp_1_1Scalar__Quantizer.html">Scalar_Quantizer</a>
68  </div>
69</div>
70<div class="contents">
71<h1>itpp::Scalar_Quantizer Class Reference<br>
72<small>
73[<a class="el" href="group__sourcecoding.html">Source Coding Routines</a>]</small>
74</h1><!-- doxytag: class="itpp::Scalar_Quantizer" -->Class for vector quantization. 
75<a href="#_details">More...</a>
76<p>
77<code>#include &lt;<a class="el" href="vq_8h-source.html">vq.h</a>&gt;</code>
78<p>
79
80<p>
81<a href="classitpp_1_1Scalar__Quantizer-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
82<tr><td></td></tr>
83<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
84<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f73dcc2779186b029f49d600bc56ac3c"></a><!-- doxytag: member="itpp::Scalar_Quantizer::Scalar_Quantizer" ref="f73dcc2779186b029f49d600bc56ac3c" args="()" -->
85&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#f73dcc2779186b029f49d600bc56ac3c">Scalar_Quantizer</a> ()</td></tr>
86
87<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor. <br></td></tr>
88<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9604101d745a44720d06da3ef5ddf8bf"></a><!-- doxytag: member="itpp::Scalar_Quantizer::Scalar_Quantizer" ref="9604101d745a44720d06da3ef5ddf8bf" args="(const char *Name)" -->
89&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#9604101d745a44720d06da3ef5ddf8bf">Scalar_Quantizer</a> (const char *<a class="el" href="classitpp_1_1Name.html">Name</a>)</td></tr>
90
91<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a VQ from a VQ file. <br></td></tr>
92<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="993310523150d96f08e1946f250fd6c8"></a><!-- doxytag: member="itpp::Scalar_Quantizer::encode" ref="993310523150d96f08e1946f250fd6c8" args="(double x) const " -->
93int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#993310523150d96f08e1946f250fd6c8">encode</a> (double x) const </td></tr>
94
95<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Encode. <br></td></tr>
96<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="dfe8acb4615a6d79ea34966db54d3ef8"></a><!-- doxytag: member="itpp::Scalar_Quantizer::encode" ref="dfe8acb4615a6d79ea34966db54d3ef8" args="(const vec &amp;x) const " -->
97ivec&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#dfe8acb4615a6d79ea34966db54d3ef8">encode</a> (const vec &amp;x) const </td></tr>
98
99<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Encode the input vector. <br></td></tr>
100<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9fbb81df938f0fa61df1ce1ecd7335c8"></a><!-- doxytag: member="itpp::Scalar_Quantizer::decode" ref="9fbb81df938f0fa61df1ce1ecd7335c8" args="(int Index) const " -->
101double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#9fbb81df938f0fa61df1ce1ecd7335c8">decode</a> (int Index) const </td></tr>
102
103<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Decode the index. <br></td></tr>
104<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="76a5396db4388c8d65d5035ebd93847d"></a><!-- doxytag: member="itpp::Scalar_Quantizer::decode" ref="76a5396db4388c8d65d5035ebd93847d" args="(const ivec &amp;Index) const " -->
105vec&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#76a5396db4388c8d65d5035ebd93847d">decode</a> (const ivec &amp;Index) const </td></tr>
106
107<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Decode the indices. <br></td></tr>
108<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="21415f4d555d724f598842ee704fa00b"></a><!-- doxytag: member="itpp::Scalar_Quantizer::Q" ref="21415f4d555d724f598842ee704fa00b" args="(double x) const " -->
109double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#21415f4d555d724f598842ee704fa00b">Q</a> (double x) const </td></tr>
110
111<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Quantize. <br></td></tr>
112<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="29496fc0b97033932ad11c57c1756c95"></a><!-- doxytag: member="itpp::Scalar_Quantizer::Q" ref="29496fc0b97033932ad11c57c1756c95" args="(const vec &amp;x) const " -->
113vec&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#29496fc0b97033932ad11c57c1756c95">Q</a> (const vec &amp;x) const </td></tr>
114
115<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Quantize the input vector. <br></td></tr>
116<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a8962a3fa882e11e3d8c53f7fb30e345"></a><!-- doxytag: member="itpp::Scalar_Quantizer::operator()" ref="a8962a3fa882e11e3d8c53f7fb30e345" args="(double x) const " -->
117double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#a8962a3fa882e11e3d8c53f7fb30e345">operator()</a> (double x) const </td></tr>
118
119<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Quantize. <br></td></tr>
120<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b3de4654438e720659fdb59ec1432b32"></a><!-- doxytag: member="itpp::Scalar_Quantizer::operator()" ref="b3de4654438e720659fdb59ec1432b32" args="(const vec &amp;x) const " -->
121vec&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#b3de4654438e720659fdb59ec1432b32">operator()</a> (const vec &amp;x) const </td></tr>
122
123<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Quantize the input vector. <br></td></tr>
124<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="620a3920dd245d4d11a1529846ed3dd0"></a><!-- doxytag: member="itpp::Scalar_Quantizer::set_levels" ref="620a3920dd245d4d11a1529846ed3dd0" args="(const vec &amp;L)" -->
125void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#620a3920dd245d4d11a1529846ed3dd0">set_levels</a> (const vec &amp;L)</td></tr>
126
127<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialize the codebook by a matrix. <br></td></tr>
128<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0aa1f8dba47dfb2a230c7759cde0b284"></a><!-- doxytag: member="itpp::Scalar_Quantizer::get_levels" ref="0aa1f8dba47dfb2a230c7759cde0b284" args="() const " -->
129vec&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#0aa1f8dba47dfb2a230c7759cde0b284">get_levels</a> () const </td></tr>
130
131<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the codebook. <br></td></tr>
132<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="95ec523ac68942d0ddcbaa6a36931f6c"></a><!-- doxytag: member="itpp::Scalar_Quantizer::size" ref="95ec523ac68942d0ddcbaa6a36931f6c" args="() const " -->
133int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#95ec523ac68942d0ddcbaa6a36931f6c">size</a> () const </td></tr>
134
135<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the size (number of codevectors) of the VQ. <br></td></tr>
136<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
137<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b2e70d0c59ab2b4de616b4a687135d00"></a><!-- doxytag: member="itpp::Scalar_Quantizer::Levels" ref="b2e70d0c59ab2b4de616b4a687135d00" args="" -->
138vec&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#b2e70d0c59ab2b4de616b4a687135d00">Levels</a></td></tr>
139
140<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The vector containing the code book. <br></td></tr>
141<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2e93c197ff825e6f090d636ad6d3a374"></a><!-- doxytag: member="itpp::Scalar_Quantizer::LatestDist" ref="2e93c197ff825e6f090d636ad6d3a374" args="" -->
142double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Scalar__Quantizer.html#2e93c197ff825e6f090d636ad6d3a374">LatestDist</a></td></tr>
143
144<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The distortion at the latest time a vector was encoded. <br></td></tr>
145</table>
146<hr><a name="_details"></a><h2>Detailed Description</h2>
147Class for vector quantization.
148<p>
149The following code illustrates how the quantizer can be initialized from a file and used to quantize a random vector. <div class="fragment"><pre class="fragment">  <a class="code" href="classitpp_1_1Scalar__Quantizer.html#f73dcc2779186b029f49d600bc56ac3c" title="Default constructor.">Scalar_Quantizer</a> Quantizer;
150  <span class="keywordtype">double</span>    x,y;
151  <span class="keywordtype">int</span>     i;
152
153  Quantizer.load(<span class="stringliteral">"random.sq"</span>);
154  x=<a class="code" href="group__randgen.html#g9ecf5af23567f51abc9af737fdbd872a" title="Generates a random Gaussian (0,1) variable.">randn</a>();
155  i=Quantizer.encode(x);
156  y=Quantizer.decode(i);
157</pre></div> <hr>The documentation for this class was generated from the following file:<ul>
158<li><a class="el" href="vq_8h-source.html">vq.h</a></ul>
159</div>
160<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:19 2009 for mixpp by&nbsp;
161<a href="http://www.doxygen.org/index.html">
162<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
163</body>
164</html>
Note: See TracBrowser for help on using the browser.