root/doc/html/classitpp_1_1Fix__Factory.html @ 353

Revision 353, 18.5 kB (checked in by smidl, 16 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::Fix_Factory 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_1Fix__Factory.html">Fix_Factory</a>
68  </div>
69</div>
70<div class="contents">
71<h1>itpp::Fix_Factory Class Reference<br>
72<small>
73[<a class="el" href="group__fixed.html">Fixed-point Module</a>]</small>
74</h1><!-- doxytag: class="itpp::Fix_Factory" --><!-- doxytag: inherits="itpp::Factory" -->Class factory for fixed-point data types <a class="el" href="classitpp_1_1Fix.html" title="Fixed-point data type.">Fix</a> and <a class="el" href="classitpp_1_1CFix.html" title="Complex fixed-point data type.">CFix</a>
75<a href="#_details">More...</a>
76<p>
77<code>#include &lt;<a class="el" href="fix__factory_8h-source.html">fix_factory.h</a>&gt;</code>
78<p>
79
80<p>
81<a href="classitpp_1_1Fix__Factory-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="eda0bed04ba1dd12dc91e032858e84fb"></a><!-- doxytag: member="itpp::Fix_Factory::Fix_Factory" ref="eda0bed04ba1dd12dc91e032858e84fb" args="(int w=MAX_WORDLEN, e_mode e=TC, o_mode o=WRAP, q_mode q=TRN, Stat *ptr=0)" -->
85&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Fix__Factory.html#eda0bed04ba1dd12dc91e032858e84fb">Fix_Factory</a> (int w=MAX_WORDLEN, <a class="el" href="group__fixed.html#g3a204def662e60bf9bb54d27db09450d">e_mode</a> e=TC, <a class="el" href="group__fixed.html#g18d0ad4d7280177b761737a7b8b5c45d">o_mode</a> o=WRAP, <a class="el" href="group__fixed.html#ga644362f0b3d795ce8521326e20fed11">q_mode</a> q=TRN, <a class="el" href="classitpp_1_1Stat.html">Stat</a> *ptr=0)</td></tr>
86
87<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor. <br></td></tr>
88<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b9e876a7dd92e05d6a2863353eed94b9"></a><!-- doxytag: member="itpp::Fix_Factory::~Fix_Factory" ref="b9e876a7dd92e05d6a2863353eed94b9" args="()" -->
89virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Fix__Factory.html#b9e876a7dd92e05d6a2863353eed94b9">~Fix_Factory</a> ()</td></tr>
90
91<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor. <br></td></tr>
92<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="3576b737190e17c85ae3682d581367f1"></a><!-- doxytag: member="itpp::Fix_Factory::operator double" ref="3576b737190e17c85ae3682d581367f1" args="() const " -->
93&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Fix__Factory.html#3576b737190e17c85ae3682d581367f1">operator double</a> () const </td></tr>
94
95<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Conversion operator. Useful in templated code. <br></td></tr>
96<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="601a0d0a724e3073b012c6e31ee219c4"></a><!-- doxytag: member="itpp::Fix_Factory::create" ref="601a0d0a724e3073b012c6e31ee219c4" args="(Fix *&amp;ptr, const int n) const " -->
97virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Fix__Factory.html#601a0d0a724e3073b012c6e31ee219c4">create</a> (<a class="el" href="classitpp_1_1Fix.html">Fix</a> *&amp;ptr, const int n) const </td></tr>
98
99<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create an n-length array of <a class="el" href="classitpp_1_1Fix.html" title="Fixed-point data type.">Fix</a>. <br></td></tr>
100<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d3cc9f26169882f6e3938280cad5b6bd"></a><!-- doxytag: member="itpp::Fix_Factory::create" ref="d3cc9f26169882f6e3938280cad5b6bd" args="(CFix *&amp;ptr, const int n) const " -->
101virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Fix__Factory.html#d3cc9f26169882f6e3938280cad5b6bd">create</a> (<a class="el" href="classitpp_1_1CFix.html">CFix</a> *&amp;ptr, const int n) const </td></tr>
102
103<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create an n-length array of <a class="el" href="classitpp_1_1CFix.html" title="Complex fixed-point data type.">CFix</a>. <br></td></tr>
104<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
105<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="925bb19eaaad983fded8fefcc7bc0b8b"></a><!-- doxytag: member="itpp::Fix_Factory::wordlen" ref="925bb19eaaad983fded8fefcc7bc0b8b" args="" -->
106int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Fix__Factory.html#925bb19eaaad983fded8fefcc7bc0b8b">wordlen</a></td></tr>
107
108<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Word length. <br></td></tr>
109<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="76fd5ebd9d282c163da0c33369c02981"></a><!-- doxytag: member="itpp::Fix_Factory::emode" ref="76fd5ebd9d282c163da0c33369c02981" args="" -->
110<a class="el" href="group__fixed.html#g3a204def662e60bf9bb54d27db09450d">e_mode</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Fix__Factory.html#76fd5ebd9d282c163da0c33369c02981">emode</a></td></tr>
111
112<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sign encoding mode. <br></td></tr>
113<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="deaafb710992a3ad23b6349e6698b62f"></a><!-- doxytag: member="itpp::Fix_Factory::omode" ref="deaafb710992a3ad23b6349e6698b62f" args="" -->
114<a class="el" href="group__fixed.html#g18d0ad4d7280177b761737a7b8b5c45d">o_mode</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Fix__Factory.html#deaafb710992a3ad23b6349e6698b62f">omode</a></td></tr>
115
116<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Overflow mode. <br></td></tr>
117<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="5fb29c23aeabf9c03346e536387eacdb"></a><!-- doxytag: member="itpp::Fix_Factory::qmode" ref="5fb29c23aeabf9c03346e536387eacdb" args="" -->
118<a class="el" href="group__fixed.html#ga644362f0b3d795ce8521326e20fed11">q_mode</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Fix__Factory.html#5fb29c23aeabf9c03346e536387eacdb">qmode</a></td></tr>
119
120<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Quantization mode. <br></td></tr>
121<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="15489b032eae2e03aeeb578d119a1135"></a><!-- doxytag: member="itpp::Fix_Factory::stat_ptr" ref="15489b032eae2e03aeeb578d119a1135" args="" -->
122<a class="el" href="classitpp_1_1Stat.html">Stat</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Fix__Factory.html#15489b032eae2e03aeeb578d119a1135">stat_ptr</a></td></tr>
123
124<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pointer to statistics object. <br></td></tr>
125<tr><td colspan="2"><br><h2>Friends</h2></td></tr>
126<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9020e0345476ee9b79bb12f7e8aec826"></a><!-- doxytag: member="itpp::Fix_Factory::Fix" ref="9020e0345476ee9b79bb12f7e8aec826" args="" -->
127class&nbsp;</td><td class="memItemRight" valign="bottom"><b>Fix</b></td></tr>
128
129<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7a29bff26517f266d4dafa7004ca2a6d"></a><!-- doxytag: member="itpp::Fix_Factory::CFix" ref="7a29bff26517f266d4dafa7004ca2a6d" args="" -->
130class&nbsp;</td><td class="memItemRight" valign="bottom"><b>CFix</b></td></tr>
131
132</table>
133<hr><a name="_details"></a><h2>Detailed Description</h2>
134Class factory for fixed-point data types <a class="el" href="classitpp_1_1Fix.html" title="Fixed-point data type.">Fix</a> and <a class="el" href="classitpp_1_1CFix.html" title="Complex fixed-point data type.">CFix</a>.
135<p>
136For an introduction to factories, see the Detailed Description for <a class="el" href="classitpp_1_1Factory.html" title="Base class for class factories.">Factory</a>. For more information on the fixed-point data types, see the Detailed Description in the <a class="el" href="group__fixed.html">Fixed-point Module</a> module.<p>
137This example shows how to declare a <a class="el" href="classitpp_1_1Fix__Factory.html" title="Class factory for fixed-point data types Fix and CFix.">Fix_Factory</a>: <div class="fragment"><pre class="fragment">  <span class="comment">// Declare UFIX32, a factory for 32-bit unsigned Fix/CFix with wrap-around</span>
138  <span class="comment">// i.e. a factory for Fix(0.0, 0, 32, US, WRAP) and CFix(0.0, 0, 32, US, WRAP)</span>
139  <a class="code" href="classitpp_1_1Fix__Factory.html#eda0bed04ba1dd12dc91e032858e84fb" title="Constructor.">Fix_Factory</a> UFIX32(32, <a class="code" href="group__fixed.html#gg3a204def662e60bf9bb54d27db09450d1d95a58e7c118ad0647ea7003a0117e3" title="Unsigned.">US</a>, <a class="code" href="group__fixed.html#gg18d0ad4d7280177b761737a7b8b5c45da7ea797d8579a3e2dc82f792e16e946b" title="Wrap-around.">WRAP</a>);
140</pre></div><p>
141However, the user does not need to declare <code>UFIX32</code> since it is one of the already declared factories in <a class="el" href="fix__factory_8h.html" title="Definitions of a class factory for fixed-point data types Fix and CFix.">fix_factory.h</a> (which is included by <a class="el" href="itbase_8h.html" title="Include file for the IT++ base module.">itbase.h</a>): <div class="fragment"><pre class="fragment">  <a class="code" href="classitpp_1_1Fix__Factory.html#eda0bed04ba1dd12dc91e032858e84fb" title="Constructor.">Fix_Factory</a> FIX1(1, <a class="code" href="group__fixed.html#gg3a204def662e60bf9bb54d27db09450df4bddf5c0c77795974633939360e6e4a" title="Two&amp;#39;s complement.">TC</a>, <a class="code" href="group__fixed.html#gg18d0ad4d7280177b761737a7b8b5c45da7ea797d8579a3e2dc82f792e16e946b" title="Wrap-around.">WRAP</a>);  <span class="comment">// for Fix/CFix with 1 bit</span>
142  ...
143  <a class="code" href="classitpp_1_1Fix__Factory.html#eda0bed04ba1dd12dc91e032858e84fb" title="Constructor.">Fix_Factory</a> FIX64(64, <a class="code" href="group__fixed.html#gg3a204def662e60bf9bb54d27db09450df4bddf5c0c77795974633939360e6e4a" title="Two&amp;#39;s complement.">TC</a>, <a class="code" href="group__fixed.html#gg18d0ad4d7280177b761737a7b8b5c45da7ea797d8579a3e2dc82f792e16e946b" title="Wrap-around.">WRAP</a>);  <span class="comment">// for Fix/CFix with 64 bits</span>
144
145  <a class="code" href="classitpp_1_1Fix__Factory.html#eda0bed04ba1dd12dc91e032858e84fb" title="Constructor.">Fix_Factory</a> UFIX1(1, <a class="code" href="group__fixed.html#gg3a204def662e60bf9bb54d27db09450d1d95a58e7c118ad0647ea7003a0117e3" title="Unsigned.">US</a>, <a class="code" href="group__fixed.html#gg18d0ad4d7280177b761737a7b8b5c45da7ea797d8579a3e2dc82f792e16e946b" title="Wrap-around.">WRAP</a>);  <span class="comment">// for Unsigned Fix/CFix with 1 bit</span>
146  ...
147  <a class="code" href="classitpp_1_1Fix__Factory.html#eda0bed04ba1dd12dc91e032858e84fb" title="Constructor.">Fix_Factory</a> UFIX64(64, <a class="code" href="group__fixed.html#gg3a204def662e60bf9bb54d27db09450d1d95a58e7c118ad0647ea7003a0117e3" title="Unsigned.">US</a>, <a class="code" href="group__fixed.html#gg18d0ad4d7280177b761737a7b8b5c45da7ea797d8579a3e2dc82f792e16e946b" title="Wrap-around.">WRAP</a>);  <span class="comment">// for Unsigned Fix/CFix with 64 bits</span>
148
149  <a class="code" href="classitpp_1_1Fix__Factory.html#eda0bed04ba1dd12dc91e032858e84fb" title="Constructor.">Fix_Factory</a> SFIX1(1, <a class="code" href="group__fixed.html#gg3a204def662e60bf9bb54d27db09450df4bddf5c0c77795974633939360e6e4a" title="Two&amp;#39;s complement.">TC</a>, <a class="code" href="group__fixed.html#gg18d0ad4d7280177b761737a7b8b5c45d813f45e186a9d13fb81daea4bb065407" title="Saturation.">SAT</a>);  <span class="comment">// for Saturated Fix/CFix with 1 bit</span>
150  ...
151  <a class="code" href="classitpp_1_1Fix__Factory.html#eda0bed04ba1dd12dc91e032858e84fb" title="Constructor.">Fix_Factory</a> SFIX64(64, <a class="code" href="group__fixed.html#gg3a204def662e60bf9bb54d27db09450df4bddf5c0c77795974633939360e6e4a" title="Two&amp;#39;s complement.">TC</a>, <a class="code" href="group__fixed.html#gg18d0ad4d7280177b761737a7b8b5c45d813f45e186a9d13fb81daea4bb065407" title="Saturation.">SAT</a>);  <span class="comment">// for Saturated Fix/CFix with 64 bits</span>
152
153  <a class="code" href="classitpp_1_1Fix__Factory.html#eda0bed04ba1dd12dc91e032858e84fb" title="Constructor.">Fix_Factory</a> SUFIX1(1, <a class="code" href="group__fixed.html#gg3a204def662e60bf9bb54d27db09450d1d95a58e7c118ad0647ea7003a0117e3" title="Unsigned.">US</a>, <a class="code" href="group__fixed.html#gg18d0ad4d7280177b761737a7b8b5c45d813f45e186a9d13fb81daea4bb065407" title="Saturation.">SAT</a>);  <span class="comment">// for Saturated Unsigned Fix/CFix with 1 bit</span>
154  ...
155  <a class="code" href="classitpp_1_1Fix__Factory.html#eda0bed04ba1dd12dc91e032858e84fb" title="Constructor.">Fix_Factory</a> SUFIX64(64, <a class="code" href="group__fixed.html#gg3a204def662e60bf9bb54d27db09450d1d95a58e7c118ad0647ea7003a0117e3" title="Unsigned.">US</a>, <a class="code" href="group__fixed.html#gg18d0ad4d7280177b761737a7b8b5c45d813f45e186a9d13fb81daea4bb065407" title="Saturation.">SAT</a>);  <span class="comment">// for Saturated Unsigned Fix/CFix with 64 bits</span>
156</pre></div> This means that it is only necessary for the user to declare a <a class="el" href="classitpp_1_1Fix__Factory.html" title="Class factory for fixed-point data types Fix and CFix.">Fix_Factory</a> if it is desired to have some other overflow mode than <code>WRAP</code> or <code>SAT</code>, or some other quantization mode than <code>TRN</code>, or a non-zero statistics object pointer.<p>
157<dl class="note" compact><dt><b>Note:</b></dt><dd>U stands for Unsigned but S stands for Saturated, NOT for Signed.</dd></dl>
158The Array/Vec/Mat constructors can take a <a class="el" href="classitpp_1_1Fix__Factory.html" title="Class factory for fixed-point data types Fix and CFix.">Fix_Factory</a> as an argument: <div class="fragment"><pre class="fragment">  <span class="comment">// Declare a Vec&lt;Fix&gt; with size 10 that will use</span>
159  <span class="comment">// Fix(0.0, 0, 32, US, WRAP) for element creation</span>
160  Vec&lt;Fix&gt; vf(10, UFIX32);
161
162  <span class="comment">// Declare an Array&lt;Array&lt;Mat&lt;CFix&gt; &gt; &gt; with size 10 that will use</span>
163  <span class="comment">// CFix(0.0, 0, 32, US, WRAP) for element creation</span>
164  Array&lt;Array&lt;Mat&lt;CFix&gt; &gt; &gt; aamcf(10, UFIX32);
165</pre></div><p>
166Even a Fix/CFix declaration can take a <a class="el" href="classitpp_1_1Fix__Factory.html" title="Class factory for fixed-point data types Fix and CFix.">Fix_Factory</a> as a constructor argument: <div class="fragment"><pre class="fragment">  <span class="comment">// Equivalent to</span>
167  <span class="comment">// Fix f(0.0, 0, 32, US, WRAP);</span>
168  Fix f(UFIX32);
169</pre></div><p>
170This syntax is also legal if <a class="el" href="classitpp_1_1Fix.html" title="Fixed-point data type.">Fix</a> is replaced with <code>double</code> and <a class="el" href="classitpp_1_1CFix.html" title="Complex fixed-point data type.">CFix</a> is replaced with <code>complex&lt;double&gt;</code>, i.e. <div class="fragment"><pre class="fragment">  <span class="comment">// The factory will be ignored</span>
171  Vec&lt;double&gt; vd(10, UFIX32);
172
173  <span class="comment">// The factory will be ignored</span>
174  Array&lt;Array&lt;Mat&lt;complex&lt;double&gt; &gt; &gt; &gt; aamcd(10, UFIX32);
175
176  <span class="comment">// The factory will be converted to double(0.0) i.e. innocent initialization</span>
177  <span class="keywordtype">double</span> d(UFIX32);
178</pre></div> which can be useful in templated code, e.g. when the same code should support both floating- and fixed-point data types. <hr>The documentation for this class was generated from the following files:<ul>
179<li><a class="el" href="fix__factory_8h-source.html">fix_factory.h</a><li><a class="el" href="fix__factory_8cpp.html">fix_factory.cpp</a></ul>
180</div>
181<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:19 2009 for mixpp by&nbsp;
182<a href="http://www.doxygen.org/index.html">
183<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
184</body>
185</html>
Note: See TracBrowser for help on using the browser.