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: pulse_shape.h Source File</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 | <!-- |
---|
10 | function 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 | } |
---|
22 | function 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 | } |
---|
46 | window.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 Page</span></a></li> |
---|
53 | <li><a href="pages.html"><span>Related Pages</span></a></li> |
---|
54 | <li><a href="modules.html"><span>Modules</span></a></li> |
---|
55 | <li><a href="annotated.html"><span>Classes</span></a></li> |
---|
56 | <li class="current"><a href="files.html"><span>Files</span></a></li> |
---|
57 | </ul> |
---|
58 | </div> |
---|
59 | <div class="tabs"> |
---|
60 | <ul> |
---|
61 | <li><a href="files.html"><span>File List</span></a></li> |
---|
62 | <li><a href="globals.html"><span>File Members</span></a></li> |
---|
63 | </ul> |
---|
64 | </div> |
---|
65 | <h1>pulse_shape.h</h1><a href="pulse__shape_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 |
---|
66 | <a name="l00029"></a>00029 <span class="preprocessor">#ifndef PULSE_SHAPE_H</span> |
---|
67 | <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define PULSE_SHAPE_H</span> |
---|
68 | <a name="l00031"></a>00031 <span class="preprocessor"></span> |
---|
69 | <a name="l00032"></a>00032 <span class="preprocessor">#include <<a class="code" href="vec_8h.html" title="Templated Vector Class Definitions.">itpp/base/vec.h</a>></span> |
---|
70 | <a name="l00033"></a>00033 <span class="preprocessor">#include <<a class="code" href="matfunc_8h.html" title="Various functions on vectors and matrices - header file.">itpp/base/matfunc.h</a>></span> |
---|
71 | <a name="l00034"></a>00034 <span class="preprocessor">#include <<a class="code" href="trig__hyp_8h.html" title="Trigonometric and hyperbolic functions - header file.">itpp/base/math/trig_hyp.h</a>></span> |
---|
72 | <a name="l00035"></a>00035 <span class="preprocessor">#include <<a class="code" href="filter_8h.html" title="Definitions of Filter classes and functions.">itpp/signal/filter.h</a>></span> |
---|
73 | <a name="l00036"></a>00036 <span class="preprocessor">#include <<a class="code" href="resampling_8h.html" title="Resampling functions - header file.">itpp/signal/resampling.h</a>></span> |
---|
74 | <a name="l00037"></a>00037 |
---|
75 | <a name="l00038"></a>00038 |
---|
76 | <a name="l00039"></a>00039 <span class="keyword">namespace </span>itpp |
---|
77 | <a name="l00040"></a>00040 { |
---|
78 | <a name="l00041"></a>00041 |
---|
79 | <a name="l00072"></a>00072 <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3> |
---|
80 | <a name="l00073"></a><a class="code" href="classitpp_1_1Pulse__Shape.html">00073</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1Pulse__Shape.html" title="General FIR Pulse Shape.">Pulse_Shape</a> |
---|
81 | <a name="l00074"></a>00074 { |
---|
82 | <a name="l00075"></a>00075 <span class="keyword">public</span>: |
---|
83 | <a name="l00077"></a>00077 <a class="code" href="classitpp_1_1Pulse__Shape.html#18ee00c59ff47173615bb45bbfca4262" title="Constructor.">Pulse_Shape</a>(); |
---|
84 | <a name="l00079"></a>00079 <a class="code" href="classitpp_1_1Pulse__Shape.html#18ee00c59ff47173615bb45bbfca4262" title="Constructor.">Pulse_Shape</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T2></a> &<a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>, <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd" title="Samples per input symbol.">upsampling_factor</a>); |
---|
85 | <a name="l00081"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#a5a924f1b96e02daf3a65c41df18d042">00081</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#a5a924f1b96e02daf3a65c41df18d042" title="Destructor.">~Pulse_Shape</a>() {} |
---|
86 | <a name="l00089"></a>00089 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#038f13f1eab9ae39e29c6c01fac0ac79" title="Set the general impulse response of the FIR filter.">set_pulse_shape</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T2></a> &impulse_response, <span class="keywordtype">int</span> upsampling_factor); |
---|
87 | <a name="l00091"></a>00091 <a class="code" href="classitpp_1_1Vec.html">Vec<T2></a> <a class="code" href="classitpp_1_1Pulse__Shape.html#ac428c5628e3e5dff632b382caaacebe" title="Get the pulse shape.">get_pulse_shape</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
88 | <a name="l00093"></a>00093 <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#a344853245e5f45984b099e79fa998d5" title="Get the over sampling factor.">get_upsampling_factor</a>() <span class="keyword">const</span>; |
---|
89 | <a name="l00095"></a>00095 <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#7556133cd7fb2ac87f4d34dee30bfc41" title="Get the length of the pulse in number of symbols.">get_pulse_length</a>() <span class="keyword">const</span>; |
---|
90 | <a name="l00097"></a>00097 <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#db6d549dc1076d2b8b4163b2078b7694" title="Get the length of the internal FIR filter.">get_filter_length</a>() <span class="keyword">const</span>; |
---|
91 | <a name="l00098"></a>00098 |
---|
92 | <a name="l00100"></a>00100 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#466e1220847c89e090a4bb367962df21" title="Shape the input symbols performing upsampling.">shape_symbols</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T1></a> &input, <a class="code" href="classitpp_1_1Vec.html">Vec<T3></a> &output); |
---|
93 | <a name="l00102"></a>00102 <a class="code" href="classitpp_1_1Vec.html">Vec<T3></a> <a class="code" href="classitpp_1_1Pulse__Shape.html#466e1220847c89e090a4bb367962df21" title="Shape the input symbols performing upsampling.">shape_symbols</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T1></a> &input); |
---|
94 | <a name="l00103"></a>00103 |
---|
95 | <a name="l00105"></a>00105 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#14086d26f13af721df4ae4939f80d331" title="Shape the input samples already upsampled.">shape_samples</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T1></a> &input, <a class="code" href="classitpp_1_1Vec.html">Vec<T3></a> &output); |
---|
96 | <a name="l00107"></a>00107 <a class="code" href="classitpp_1_1Vec.html">Vec<T3></a> <a class="code" href="classitpp_1_1Pulse__Shape.html#14086d26f13af721df4ae4939f80d331" title="Shape the input samples already upsampled.">shape_samples</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T1></a> &input); |
---|
97 | <a name="l00108"></a>00108 |
---|
98 | <a name="l00110"></a>00110 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#f85b84d4d2717ca2ae2170074c735bfa" title="Clear internal states.">clear</a>(<span class="keywordtype">void</span>); |
---|
99 | <a name="l00111"></a>00111 |
---|
100 | <a name="l00112"></a>00112 <span class="keyword">protected</span>: |
---|
101 | <a name="l00114"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce">00114</a> <a class="code" href="classitpp_1_1Vec.html">Vec<T2></a> impulse_response; |
---|
102 | <a name="l00116"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#5dcd026bd37e73f910f2c5d6c1120d41">00116</a> <a class="code" href="classitpp_1_1MA__Filter.html" title="Moving Average Filter Base Class.This class implements a moving average (MA) filter...">MA_Filter<T1, T2, T3></a> <a class="code" href="classitpp_1_1Pulse__Shape.html#5dcd026bd37e73f910f2c5d6c1120d41" title="The pulse shaping filter.">shaping_filter</a>; |
---|
103 | <a name="l00118"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#adc84feb7843931d28b69b03595c47f9">00118</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#adc84feb7843931d28b69b03595c47f9" title="Length in symbols.">pulse_length</a>; |
---|
104 | <a name="l00120"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd">00120</a> <span class="keywordtype">int</span> upsampling_factor; |
---|
105 | <a name="l00122"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#f649289d3f21befa740b7462520c2bc7">00122</a> <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#f649289d3f21befa740b7462520c2bc7" title="Ensures that setup is called before any other member function.">setup_done</a>; |
---|
106 | <a name="l00123"></a>00123 }; |
---|
107 | <a name="l00124"></a>00124 |
---|
108 | <a name="l00161"></a>00161 <span class="keyword">template</span><<span class="keyword">class</span> T1> |
---|
109 | <a name="l00162"></a><a class="code" href="classitpp_1_1Raised__Cosine.html">00162</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1Raised__Cosine.html" title="Raised Cosine (RC) Pulse Shaper.">Raised_Cosine</a> : <span class="keyword">public</span> <a class="code" href="classitpp_1_1Pulse__Shape.html" title="General FIR Pulse Shape.">Pulse_Shape</a><T1, double, T1> |
---|
110 | <a name="l00163"></a>00163 { |
---|
111 | <a name="l00164"></a>00164 <span class="keyword">public</span>: |
---|
112 | <a name="l00166"></a><a class="code" href="classitpp_1_1Raised__Cosine.html#153c6ae26e19dab3fb07fed0afac53c0">00166</a> <a class="code" href="classitpp_1_1Raised__Cosine.html#153c6ae26e19dab3fb07fed0afac53c0" title="Constructor.">Raised_Cosine</a>() {} |
---|
113 | <a name="l00168"></a>00168 <a class="code" href="classitpp_1_1Raised__Cosine.html#153c6ae26e19dab3fb07fed0afac53c0" title="Constructor.">Raised_Cosine</a>(<span class="keywordtype">double</span> roll_off, <span class="keywordtype">int</span> filter_length = 6, <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd" title="Samples per input symbol.">upsampling_factor</a> = 8); |
---|
114 | <a name="l00170"></a><a class="code" href="classitpp_1_1Raised__Cosine.html#871bbcb278b13fdeaae72c74876d4101">00170</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1Raised__Cosine.html#871bbcb278b13fdeaae72c74876d4101" title="Destructor.">~Raised_Cosine</a>() {} |
---|
115 | <a name="l00172"></a>00172 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Raised__Cosine.html#e6912fad171506d162aba99e60a7875b" title="Set pulse shape (roll_off_factor between 0 and 1, filter_length even).">set_pulse_shape</a>(<span class="keywordtype">double</span> <a class="code" href="classitpp_1_1Raised__Cosine.html#392677c9e81525f06a1a3e03e5a96cdf" title="The roll off factor (i.e. alpha).">roll_off_factor</a>, <span class="keywordtype">int</span> filter_length = 6, <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd" title="Samples per input symbol.">upsampling_factor</a> = 8); |
---|
116 | <a name="l00174"></a>00174 <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1Raised__Cosine.html#8c9500204ca6ffc2aa66e52bcd378dd2" title="Get the roll-off factor.">get_roll_off</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
117 | <a name="l00175"></a>00175 |
---|
118 | <a name="l00176"></a>00176 <span class="keyword">protected</span>: |
---|
119 | <a name="l00178"></a><a class="code" href="classitpp_1_1Raised__Cosine.html#392677c9e81525f06a1a3e03e5a96cdf">00178</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1Raised__Cosine.html#392677c9e81525f06a1a3e03e5a96cdf" title="The roll off factor (i.e. alpha).">roll_off_factor</a>; |
---|
120 | <a name="l00179"></a>00179 }; |
---|
121 | <a name="l00180"></a>00180 |
---|
122 | <a name="l00225"></a>00225 <span class="keyword">template</span><<span class="keyword">class</span> T1> |
---|
123 | <a name="l00226"></a><a class="code" href="classitpp_1_1Root__Raised__Cosine.html">00226</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1Root__Raised__Cosine.html" title="(Square) Root Raised Cosine (RRC) Pulse Shaper">Root_Raised_Cosine</a> : <span class="keyword">public</span> <a class="code" href="classitpp_1_1Pulse__Shape.html" title="General FIR Pulse Shape.">Pulse_Shape</a><T1, double, T1> |
---|
124 | <a name="l00227"></a>00227 { |
---|
125 | <a name="l00228"></a>00228 <span class="keyword">public</span>: |
---|
126 | <a name="l00230"></a><a class="code" href="classitpp_1_1Root__Raised__Cosine.html#f8664a35bcb061fdb28c5db4737842ce">00230</a> <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#f8664a35bcb061fdb28c5db4737842ce" title="Constructor.">Root_Raised_Cosine</a>() {} |
---|
127 | <a name="l00232"></a>00232 <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#f8664a35bcb061fdb28c5db4737842ce" title="Constructor.">Root_Raised_Cosine</a>(<span class="keywordtype">double</span> <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb" title="The roll off factor (i.e. alpha).">roll_off_factor</a>, <span class="keywordtype">int</span> filter_length = 6, <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd" title="Samples per input symbol.">upsampling_factor</a> = 8); |
---|
128 | <a name="l00234"></a><a class="code" href="classitpp_1_1Root__Raised__Cosine.html#1375918f69f97ca87ae8d3b64cd35b75">00234</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#1375918f69f97ca87ae8d3b64cd35b75" title="Destructor.">~Root_Raised_Cosine</a>() {} |
---|
129 | <a name="l00236"></a>00236 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#1809df167d368caf1bde6a7341934fcb" title="Set pulse_shape, roll_off_factor between 0 and 1, filter_length even.">set_pulse_shape</a>(<span class="keywordtype">double</span> <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb" title="The roll off factor (i.e. alpha).">roll_off_factor</a>, <span class="keywordtype">int</span> filter_length = 6, <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd" title="Samples per input symbol.">upsampling_factor</a> = 8); |
---|
130 | <a name="l00238"></a>00238 <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#b14c9e22c4e9393b6c81f4add91f5c4e" title="Get the Roll-off factor.">get_roll_off</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
131 | <a name="l00239"></a>00239 |
---|
132 | <a name="l00240"></a>00240 <span class="keyword">protected</span>: |
---|
133 | <a name="l00242"></a><a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb">00242</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb" title="The roll off factor (i.e. alpha).">roll_off_factor</a>; |
---|
134 | <a name="l00243"></a>00243 }; |
---|
135 | <a name="l00244"></a>00244 |
---|
136 | <a name="l00245"></a>00245 <span class="comment">//-------------------------------------------------------------------------</span> |
---|
137 | <a name="l00246"></a>00246 <span class="comment">// Implementation of templated code starts here</span> |
---|
138 | <a name="l00247"></a>00247 <span class="comment">//-------------------------------------------------------------------------</span> |
---|
139 | <a name="l00248"></a>00248 |
---|
140 | <a name="l00249"></a>00249 <span class="comment">//---------------------------- Pulse_Shape --------------------------------</span> |
---|
141 | <a name="l00250"></a>00250 |
---|
142 | <a name="l00251"></a>00251 <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3> |
---|
143 | <a name="l00252"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#18ee00c59ff47173615bb45bbfca4262">00252</a> <a class="code" href="classitpp_1_1Pulse__Shape.html#18ee00c59ff47173615bb45bbfca4262" title="Constructor.">Pulse_Shape<T1, T2, T3>::Pulse_Shape</a>() |
---|
144 | <a name="l00253"></a>00253 { |
---|
145 | <a name="l00254"></a>00254 <a class="code" href="classitpp_1_1Pulse__Shape.html#f649289d3f21befa740b7462520c2bc7" title="Ensures that setup is called before any other member function.">setup_done</a> = <span class="keyword">false</span>; |
---|
146 | <a name="l00255"></a>00255 <a class="code" href="classitpp_1_1Pulse__Shape.html#adc84feb7843931d28b69b03595c47f9" title="Length in symbols.">pulse_length</a> = 0; |
---|
147 | <a name="l00256"></a>00256 <a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd" title="Samples per input symbol.">upsampling_factor</a> = 0; |
---|
148 | <a name="l00257"></a>00257 } |
---|
149 | <a name="l00258"></a>00258 |
---|
150 | <a name="l00259"></a>00259 |
---|
151 | <a name="l00260"></a>00260 <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3> |
---|
152 | <a name="l00261"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#a6ef5c03cff55b63033a9e451e80a239">00261</a> <a class="code" href="classitpp_1_1Pulse__Shape.html#18ee00c59ff47173615bb45bbfca4262" title="Constructor.">Pulse_Shape<T1, T2, T3>::Pulse_Shape</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T2></a> &impulse_response, <span class="keywordtype">int</span> upsampling_factor) |
---|
153 | <a name="l00262"></a>00262 { |
---|
154 | <a name="l00263"></a>00263 <a class="code" href="classitpp_1_1Pulse__Shape.html#038f13f1eab9ae39e29c6c01fac0ac79" title="Set the general impulse response of the FIR filter.">set_pulse_shape</a>(impulse_response, upsampling_factor); |
---|
155 | <a name="l00264"></a>00264 } |
---|
156 | <a name="l00265"></a>00265 |
---|
157 | <a name="l00266"></a>00266 <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3> |
---|
158 | <a name="l00267"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#038f13f1eab9ae39e29c6c01fac0ac79">00267</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#038f13f1eab9ae39e29c6c01fac0ac79" title="Set the general impulse response of the FIR filter.">Pulse_Shape<T1, T2, T3>::set_pulse_shape</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T2></a> &impulse_response_in, <span class="keywordtype">int</span> upsampling_factor_in) |
---|
159 | <a name="l00268"></a>00268 { |
---|
160 | <a name="l00269"></a>00269 <a class="code" href="group__errorhandlingfunc.html#g0dfeed1c189885b05ebebe78abcc9785" title="Abort if t is true.">it_error_if</a>(impulse_response_in.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>() == 0, <span class="stringliteral">"Pulse_Shape: impulse response is zero length"</span>); |
---|
161 | <a name="l00270"></a>00270 <a class="code" href="group__errorhandlingfunc.html#g0dfeed1c189885b05ebebe78abcc9785" title="Abort if t is true.">it_error_if</a>(upsampling_factor_in < 1, <span class="stringliteral">"Pulse_Shape: incorrect upsampling factor"</span>); |
---|
162 | <a name="l00271"></a>00271 |
---|
163 | <a name="l00272"></a>00272 <a class="code" href="classitpp_1_1Pulse__Shape.html#adc84feb7843931d28b69b03595c47f9" title="Length in symbols.">pulse_length</a> = (impulse_response_in.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>() - 1) / upsampling_factor_in; |
---|
164 | <a name="l00273"></a>00273 <a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd" title="Samples per input symbol.">upsampling_factor</a> = upsampling_factor_in; |
---|
165 | <a name="l00274"></a>00274 |
---|
166 | <a name="l00275"></a>00275 <a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a> = impulse_response_in; |
---|
167 | <a name="l00276"></a>00276 <a class="code" href="classitpp_1_1Pulse__Shape.html#5dcd026bd37e73f910f2c5d6c1120d41" title="The pulse shaping filter.">shaping_filter</a>.set_coeffs(<a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>); |
---|
168 | <a name="l00277"></a>00277 <a class="code" href="classitpp_1_1Pulse__Shape.html#5dcd026bd37e73f910f2c5d6c1120d41" title="The pulse shaping filter.">shaping_filter</a>.clear(); |
---|
169 | <a name="l00278"></a>00278 <a class="code" href="classitpp_1_1Pulse__Shape.html#f649289d3f21befa740b7462520c2bc7" title="Ensures that setup is called before any other member function.">setup_done</a> = <span class="keyword">true</span>; |
---|
170 | <a name="l00279"></a>00279 } |
---|
171 | <a name="l00280"></a>00280 |
---|
172 | <a name="l00281"></a>00281 <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3> |
---|
173 | <a name="l00282"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#ac428c5628e3e5dff632b382caaacebe">00282</a> <a class="code" href="classitpp_1_1Vec.html">Vec<T2></a> <a class="code" href="classitpp_1_1Pulse__Shape.html#ac428c5628e3e5dff632b382caaacebe" title="Get the pulse shape.">Pulse_Shape<T1, T2, T3>::get_pulse_shape</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span> |
---|
174 | <a name="l00283"></a>00283 <span class="keyword"></span>{ |
---|
175 | <a name="l00284"></a>00284 <span class="keywordflow">return</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>; |
---|
176 | <a name="l00285"></a>00285 } |
---|
177 | <a name="l00286"></a>00286 |
---|
178 | <a name="l00287"></a>00287 <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3> |
---|
179 | <a name="l00288"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#a344853245e5f45984b099e79fa998d5">00288</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#a344853245e5f45984b099e79fa998d5" title="Get the over sampling factor.">Pulse_Shape<T1, T2, T3>::get_upsampling_factor</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span> |
---|
180 | <a name="l00289"></a>00289 <span class="keyword"></span>{ |
---|
181 | <a name="l00290"></a>00290 <span class="keywordflow">return</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd" title="Samples per input symbol.">upsampling_factor</a>; |
---|
182 | <a name="l00291"></a>00291 } |
---|
183 | <a name="l00292"></a>00292 |
---|
184 | <a name="l00293"></a>00293 <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3> |
---|
185 | <a name="l00294"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#7556133cd7fb2ac87f4d34dee30bfc41">00294</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#7556133cd7fb2ac87f4d34dee30bfc41" title="Get the length of the pulse in number of symbols.">Pulse_Shape<T1, T2, T3>::get_pulse_length</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span> |
---|
186 | <a name="l00295"></a>00295 <span class="keyword"></span>{ |
---|
187 | <a name="l00296"></a>00296 <span class="keywordflow">return</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#adc84feb7843931d28b69b03595c47f9" title="Length in symbols.">pulse_length</a>; |
---|
188 | <a name="l00297"></a>00297 } |
---|
189 | <a name="l00298"></a>00298 |
---|
190 | <a name="l00299"></a>00299 <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3> |
---|
191 | <a name="l00300"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#db6d549dc1076d2b8b4163b2078b7694">00300</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#db6d549dc1076d2b8b4163b2078b7694" title="Get the length of the internal FIR filter.">Pulse_Shape<T1, T2, T3>::get_filter_length</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span> |
---|
192 | <a name="l00301"></a>00301 <span class="keyword"></span>{ |
---|
193 | <a name="l00302"></a>00302 <span class="keywordflow">return</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>(); |
---|
194 | <a name="l00303"></a>00303 } |
---|
195 | <a name="l00304"></a>00304 |
---|
196 | <a name="l00305"></a>00305 <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3> |
---|
197 | <a name="l00306"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#466e1220847c89e090a4bb367962df21">00306</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#466e1220847c89e090a4bb367962df21" title="Shape the input symbols performing upsampling.">Pulse_Shape<T1, T2, T3>::shape_symbols</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T1></a>& input, <a class="code" href="classitpp_1_1Vec.html">Vec<T3></a> &output) |
---|
198 | <a name="l00307"></a>00307 { |
---|
199 | <a name="l00308"></a>00308 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(<a class="code" href="classitpp_1_1Pulse__Shape.html#f649289d3f21befa740b7462520c2bc7" title="Ensures that setup is called before any other member function.">setup_done</a>, <span class="stringliteral">"Pulse_Shape must be set up before using"</span>); |
---|
200 | <a name="l00309"></a>00309 <a class="code" href="group__errorhandlingfunc.html#g0dfeed1c189885b05ebebe78abcc9785" title="Abort if t is true.">it_error_if</a>(<a class="code" href="classitpp_1_1Pulse__Shape.html#adc84feb7843931d28b69b03595c47f9" title="Length in symbols.">pulse_length</a> == 0, <span class="stringliteral">"Pulse_Shape: impulse response is zero length"</span>); |
---|
201 | <a name="l00310"></a>00310 <a class="code" href="group__errorhandlingfunc.html#g0dfeed1c189885b05ebebe78abcc9785" title="Abort if t is true.">it_error_if</a>(input.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>() == 0, <span class="stringliteral">"Pulse_Shape: input is zero length"</span>); |
---|
202 | <a name="l00311"></a>00311 |
---|
203 | <a name="l00312"></a>00312 <span class="keywordflow">if</span> (<a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd" title="Samples per input symbol.">upsampling_factor</a> > 1) |
---|
204 | <a name="l00313"></a>00313 output = <a class="code" href="classitpp_1_1Pulse__Shape.html#5dcd026bd37e73f910f2c5d6c1120d41" title="The pulse shaping filter.">shaping_filter</a>(<a class="code" href="group__resampling.html#g3d871a62ec6d1cebc121b191eefaefdd" title="Upsample each column by inserting (usf-1) zeros after each column.">upsample</a>(input, <a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd" title="Samples per input symbol.">upsampling_factor</a>)); |
---|
205 | <a name="l00314"></a>00314 <span class="keywordflow">else</span> |
---|
206 | <a name="l00315"></a>00315 output = input; |
---|
207 | <a name="l00316"></a>00316 } |
---|
208 | <a name="l00317"></a>00317 |
---|
209 | <a name="l00318"></a>00318 <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3> |
---|
210 | <a name="l00319"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#e12e322608d6eecd5b7f2e3c9492c9a0">00319</a> <a class="code" href="classitpp_1_1Vec.html">Vec<T3></a> <a class="code" href="classitpp_1_1Pulse__Shape.html#466e1220847c89e090a4bb367962df21" title="Shape the input symbols performing upsampling.">Pulse_Shape<T1, T2, T3>::shape_symbols</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T1></a>& input) |
---|
211 | <a name="l00320"></a>00320 { |
---|
212 | <a name="l00321"></a>00321 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(<a class="code" href="classitpp_1_1Pulse__Shape.html#f649289d3f21befa740b7462520c2bc7" title="Ensures that setup is called before any other member function.">setup_done</a>, <span class="stringliteral">"Pulse_Shape must be set up before using"</span>); |
---|
213 | <a name="l00322"></a>00322 <a class="code" href="classitpp_1_1Vec.html">Vec<T3></a> temp; |
---|
214 | <a name="l00323"></a>00323 <a class="code" href="classitpp_1_1Pulse__Shape.html#466e1220847c89e090a4bb367962df21" title="Shape the input symbols performing upsampling.">shape_symbols</a>(input, temp); |
---|
215 | <a name="l00324"></a>00324 <span class="keywordflow">return</span> temp; |
---|
216 | <a name="l00325"></a>00325 } |
---|
217 | <a name="l00326"></a>00326 |
---|
218 | <a name="l00327"></a>00327 <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3> |
---|
219 | <a name="l00328"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#14086d26f13af721df4ae4939f80d331">00328</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#14086d26f13af721df4ae4939f80d331" title="Shape the input samples already upsampled.">Pulse_Shape<T1, T2, T3>::shape_samples</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T1></a>& input, <a class="code" href="classitpp_1_1Vec.html">Vec<T3></a> &output) |
---|
220 | <a name="l00329"></a>00329 { |
---|
221 | <a name="l00330"></a>00330 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(<a class="code" href="classitpp_1_1Pulse__Shape.html#f649289d3f21befa740b7462520c2bc7" title="Ensures that setup is called before any other member function.">setup_done</a>, <span class="stringliteral">"Pulse_Shape must be set up before using"</span>); |
---|
222 | <a name="l00331"></a>00331 <a class="code" href="group__errorhandlingfunc.html#g0dfeed1c189885b05ebebe78abcc9785" title="Abort if t is true.">it_error_if</a>(<a class="code" href="classitpp_1_1Pulse__Shape.html#adc84feb7843931d28b69b03595c47f9" title="Length in symbols.">pulse_length</a> == 0, <span class="stringliteral">"Pulse_Shape: impulse response is zero length"</span>); |
---|
223 | <a name="l00332"></a>00332 <a class="code" href="group__errorhandlingfunc.html#g0dfeed1c189885b05ebebe78abcc9785" title="Abort if t is true.">it_error_if</a>(input.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>() == 0, <span class="stringliteral">"Pulse_Shape: input is zero length"</span>); |
---|
224 | <a name="l00333"></a>00333 |
---|
225 | <a name="l00334"></a>00334 <span class="keywordflow">if</span> (<a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd" title="Samples per input symbol.">upsampling_factor</a> > 1) |
---|
226 | <a name="l00335"></a>00335 output = <a class="code" href="classitpp_1_1Pulse__Shape.html#5dcd026bd37e73f910f2c5d6c1120d41" title="The pulse shaping filter.">shaping_filter</a>(input); |
---|
227 | <a name="l00336"></a>00336 <span class="keywordflow">else</span> |
---|
228 | <a name="l00337"></a>00337 output = input; |
---|
229 | <a name="l00338"></a>00338 } |
---|
230 | <a name="l00339"></a>00339 |
---|
231 | <a name="l00340"></a>00340 <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3> |
---|
232 | <a name="l00341"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#0161cf1c884ce1de260df48c82a15aa7">00341</a> <a class="code" href="classitpp_1_1Vec.html">Vec<T3></a> <a class="code" href="classitpp_1_1Pulse__Shape.html#14086d26f13af721df4ae4939f80d331" title="Shape the input samples already upsampled.">Pulse_Shape<T1, T2, T3>::shape_samples</a>(<span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T1></a>& input) |
---|
233 | <a name="l00342"></a>00342 { |
---|
234 | <a name="l00343"></a>00343 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(<a class="code" href="classitpp_1_1Pulse__Shape.html#f649289d3f21befa740b7462520c2bc7" title="Ensures that setup is called before any other member function.">setup_done</a>, <span class="stringliteral">"Pulse_Shape must be set up before using"</span>); |
---|
235 | <a name="l00344"></a>00344 <a class="code" href="classitpp_1_1Vec.html">Vec<T3></a> temp; |
---|
236 | <a name="l00345"></a>00345 <a class="code" href="classitpp_1_1Pulse__Shape.html#14086d26f13af721df4ae4939f80d331" title="Shape the input samples already upsampled.">shape_samples</a>(input, temp); |
---|
237 | <a name="l00346"></a>00346 <span class="keywordflow">return</span> temp; |
---|
238 | <a name="l00347"></a>00347 } |
---|
239 | <a name="l00348"></a>00348 |
---|
240 | <a name="l00349"></a>00349 <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3> |
---|
241 | <a name="l00350"></a><a class="code" href="classitpp_1_1Pulse__Shape.html#f85b84d4d2717ca2ae2170074c735bfa">00350</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Pulse__Shape.html#f85b84d4d2717ca2ae2170074c735bfa" title="Clear internal states.">Pulse_Shape<T1, T2, T3>::clear</a>(<span class="keywordtype">void</span>) |
---|
242 | <a name="l00351"></a>00351 { |
---|
243 | <a name="l00352"></a>00352 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(<a class="code" href="classitpp_1_1Pulse__Shape.html#f649289d3f21befa740b7462520c2bc7" title="Ensures that setup is called before any other member function.">setup_done</a>, <span class="stringliteral">"Pulse_Shape must be set up before using"</span>); |
---|
244 | <a name="l00353"></a>00353 <a class="code" href="classitpp_1_1Pulse__Shape.html#5dcd026bd37e73f910f2c5d6c1120d41" title="The pulse shaping filter.">shaping_filter</a>.clear(); |
---|
245 | <a name="l00354"></a>00354 } |
---|
246 | <a name="l00355"></a>00355 |
---|
247 | <a name="l00356"></a>00356 <span class="comment">//-------------------- Raised_Cosine -----------------------------------</span> |
---|
248 | <a name="l00357"></a>00357 |
---|
249 | <a name="l00358"></a>00358 <span class="keyword">template</span><<span class="keyword">class</span> T1> |
---|
250 | <a name="l00359"></a><a class="code" href="classitpp_1_1Raised__Cosine.html#46d57402d014f22476ed38bfc6ad618d">00359</a> <a class="code" href="classitpp_1_1Raised__Cosine.html#153c6ae26e19dab3fb07fed0afac53c0" title="Constructor.">Raised_Cosine<T1>::Raised_Cosine</a>(<span class="keywordtype">double</span> roll_off_factor, <span class="keywordtype">int</span> filter_length, <span class="keywordtype">int</span> upsampling_factor) |
---|
251 | <a name="l00360"></a>00360 { |
---|
252 | <a name="l00361"></a>00361 <a class="code" href="classitpp_1_1Raised__Cosine.html#e6912fad171506d162aba99e60a7875b" title="Set pulse shape (roll_off_factor between 0 and 1, filter_length even).">set_pulse_shape</a>(roll_off_factor, filter_length, upsampling_factor); |
---|
253 | <a name="l00362"></a>00362 } |
---|
254 | <a name="l00363"></a>00363 |
---|
255 | <a name="l00364"></a>00364 <span class="keyword">template</span><<span class="keyword">class</span> T1> |
---|
256 | <a name="l00365"></a><a class="code" href="classitpp_1_1Raised__Cosine.html#e6912fad171506d162aba99e60a7875b">00365</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Raised__Cosine.html#e6912fad171506d162aba99e60a7875b" title="Set pulse shape (roll_off_factor between 0 and 1, filter_length even).">Raised_Cosine<T1>::set_pulse_shape</a>(<span class="keywordtype">double</span> roll_off_factor_in, <span class="keywordtype">int</span> filter_length, <span class="keywordtype">int</span> upsampling_factor_in) |
---|
257 | <a name="l00366"></a>00366 { |
---|
258 | <a name="l00367"></a>00367 <a class="code" href="group__errorhandlingfunc.html#g0dfeed1c189885b05ebebe78abcc9785" title="Abort if t is true.">it_error_if</a>(roll_off_factor_in < 0 || roll_off_factor_in > 1, <span class="stringliteral">"Raised_Cosine: roll-off out of range"</span>); |
---|
259 | <a name="l00368"></a>00368 <a class="code" href="classitpp_1_1Raised__Cosine.html#392677c9e81525f06a1a3e03e5a96cdf" title="The roll off factor (i.e. alpha).">roll_off_factor</a> = roll_off_factor_in; |
---|
260 | <a name="l00369"></a>00369 |
---|
261 | <a name="l00370"></a>00370 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(<a class="code" href="group__miscfunc.html#g7fa3ce6e66b7a5cfd8a19afbaade3e07" title="Return true if x is an even integer.">is_even</a>(filter_length), <span class="stringliteral">"Raised_Cosine: Filter length not even"</span>); |
---|
262 | <a name="l00371"></a>00371 |
---|
263 | <a name="l00372"></a>00372 <span class="keywordtype">int</span> i; |
---|
264 | <a name="l00373"></a>00373 <span class="keywordtype">double</span> t, den; |
---|
265 | <a name="l00374"></a>00374 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd" title="Samples per input symbol.">upsampling_factor</a> = upsampling_factor_in; |
---|
266 | <a name="l00375"></a>00375 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#adc84feb7843931d28b69b03595c47f9" title="Length in symbols.">pulse_length</a> = filter_length; |
---|
267 | <a name="l00376"></a>00376 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>.<a class="code" href="classitpp_1_1Vec.html#a4b02b7819e540bb3853c15e6480ada6" title="Set length of vector. if copy = true then keeping the old values.">set_size</a>(filter_length * upsampling_factor_in + 1, |
---|
268 | <a name="l00377"></a>00377 <span class="keyword">false</span>); |
---|
269 | <a name="l00378"></a>00378 |
---|
270 | <a name="l00379"></a>00379 <span class="keywordflow">for</span> (i = 0; i < this-><a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>(); i++) { |
---|
271 | <a name="l00380"></a>00380 <span class="comment">// delayed to be casual</span> |
---|
272 | <a name="l00381"></a>00381 t = (double)(i - filter_length * upsampling_factor_in / 2) |
---|
273 | <a name="l00382"></a>00382 / upsampling_factor_in; |
---|
274 | <a name="l00383"></a>00383 den = 1 - <a class="code" href="group__miscfunc.html#gd0a08400c5087615cb59d95c3e05ba38" title="Square of elements.">sqr</a>(2 * <a class="code" href="classitpp_1_1Raised__Cosine.html#392677c9e81525f06a1a3e03e5a96cdf" title="The roll off factor (i.e. alpha).">roll_off_factor</a> * t); |
---|
275 | <a name="l00384"></a>00384 <span class="keywordflow">if</span> (den == 0) { |
---|
276 | <a name="l00385"></a>00385 <span class="comment">// exception according to "The Care and feeding of digital,</span> |
---|
277 | <a name="l00386"></a>00386 <span class="comment">// pulse-shaping filters" by Ken Gentile,</span> |
---|
278 | <a name="l00387"></a>00387 <span class="comment">// the limit of raised cosine impulse responce function,</span> |
---|
279 | <a name="l00388"></a>00388 <span class="comment">// as (alpha * t / tau) approaches (+- 0.5) is given as:</span> |
---|
280 | <a name="l00389"></a>00389 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>(i) = <a class="code" href="group__trifunc.html#ga55ffe19493ed1ddcae764163fc33e34" title="Sinc function, sin(pi*x)/(pi*x).">sinc</a>(t) * pi / 4; |
---|
281 | <a name="l00390"></a>00390 } |
---|
282 | <a name="l00391"></a>00391 <span class="keywordflow">else</span> { |
---|
283 | <a name="l00392"></a>00392 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>(i) = <a class="code" href="group__trifunc.html#g098a0025955a83d70458225324c21acf" title="Cosine function.">std::cos</a>(<a class="code" href="classitpp_1_1Raised__Cosine.html#392677c9e81525f06a1a3e03e5a96cdf" title="The roll off factor (i.e. alpha).">roll_off_factor</a> * pi * t) |
---|
284 | <a name="l00393"></a>00393 * <a class="code" href="group__trifunc.html#ga55ffe19493ed1ddcae764163fc33e34" title="Sinc function, sin(pi*x)/(pi*x).">sinc</a>(t) / den; |
---|
285 | <a name="l00394"></a>00394 } |
---|
286 | <a name="l00395"></a>00395 } |
---|
287 | <a name="l00396"></a>00396 |
---|
288 | <a name="l00397"></a>00397 <span class="comment">// BUGFIX: Commented out to achieve similar results to Matlab</span> |
---|
289 | <a name="l00398"></a>00398 <span class="comment">// rcosfil function. Now the concatenation of two root-raised</span> |
---|
290 | <a name="l00399"></a>00399 <span class="comment">// cosine filters gives tha same results as a one raised cosine</span> |
---|
291 | <a name="l00400"></a>00400 <span class="comment">// shaping function.</span> |
---|
292 | <a name="l00401"></a>00401 <span class="comment">// this->impulse_response /= std::sqrt(double(this->upsampling_factor));</span> |
---|
293 | <a name="l00402"></a>00402 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#5dcd026bd37e73f910f2c5d6c1120d41" title="The pulse shaping filter.">shaping_filter</a>.<a class="code" href="classitpp_1_1MA__Filter.html#5a8b88c583ea3d944e0fe96d2d8f236c" title="Set the filter coefficients.">set_coeffs</a>(this-><a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>); |
---|
294 | <a name="l00403"></a>00403 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#5dcd026bd37e73f910f2c5d6c1120d41" title="The pulse shaping filter.">shaping_filter</a>.<a class="code" href="classitpp_1_1MA__Filter.html#fd9611f51af7dbab081188574a35ca29" title="Clears the filter memory.">clear</a>(); |
---|
295 | <a name="l00404"></a>00404 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#f649289d3f21befa740b7462520c2bc7" title="Ensures that setup is called before any other member function.">setup_done</a> = <span class="keyword">true</span>; |
---|
296 | <a name="l00405"></a>00405 } |
---|
297 | <a name="l00406"></a>00406 |
---|
298 | <a name="l00407"></a>00407 <span class="keyword">template</span><<span class="keyword">class</span> T1> |
---|
299 | <a name="l00408"></a><a class="code" href="classitpp_1_1Raised__Cosine.html#8c9500204ca6ffc2aa66e52bcd378dd2">00408</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1Raised__Cosine.html#8c9500204ca6ffc2aa66e52bcd378dd2" title="Get the roll-off factor.">Raised_Cosine<T1>::get_roll_off</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span> |
---|
300 | <a name="l00409"></a>00409 <span class="keyword"></span>{ |
---|
301 | <a name="l00410"></a>00410 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(this-><a class="code" href="classitpp_1_1Pulse__Shape.html#f649289d3f21befa740b7462520c2bc7" title="Ensures that setup is called before any other member function.">setup_done</a>, <span class="stringliteral">"Pulse_Shape must be set up before using"</span>); |
---|
302 | <a name="l00411"></a>00411 <span class="keywordflow">return</span> <a class="code" href="classitpp_1_1Raised__Cosine.html#392677c9e81525f06a1a3e03e5a96cdf" title="The roll off factor (i.e. alpha).">roll_off_factor</a>; |
---|
303 | <a name="l00412"></a>00412 } |
---|
304 | <a name="l00413"></a>00413 |
---|
305 | <a name="l00414"></a>00414 <span class="comment">//-------------------- Root_Raised_Cosine -----------------------------------</span> |
---|
306 | <a name="l00415"></a>00415 |
---|
307 | <a name="l00416"></a>00416 <span class="keyword">template</span><<span class="keyword">class</span> T1> |
---|
308 | <a name="l00417"></a><a class="code" href="classitpp_1_1Root__Raised__Cosine.html#9015cc7c5c00be69fbbf42e63979ed7f">00417</a> <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#f8664a35bcb061fdb28c5db4737842ce" title="Constructor.">Root_Raised_Cosine<T1>::Root_Raised_Cosine</a>(<span class="keywordtype">double</span> roll_off_factor, <span class="keywordtype">int</span> filter_length, <span class="keywordtype">int</span> upsampling_factor) |
---|
309 | <a name="l00418"></a>00418 { |
---|
310 | <a name="l00419"></a>00419 <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#1809df167d368caf1bde6a7341934fcb" title="Set pulse_shape, roll_off_factor between 0 and 1, filter_length even.">set_pulse_shape</a>(roll_off_factor, filter_length, upsampling_factor); |
---|
311 | <a name="l00420"></a>00420 } |
---|
312 | <a name="l00421"></a>00421 |
---|
313 | <a name="l00422"></a>00422 <span class="keyword">template</span><<span class="keyword">class</span> T1> |
---|
314 | <a name="l00423"></a><a class="code" href="classitpp_1_1Root__Raised__Cosine.html#1809df167d368caf1bde6a7341934fcb">00423</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#1809df167d368caf1bde6a7341934fcb" title="Set pulse_shape, roll_off_factor between 0 and 1, filter_length even.">Root_Raised_Cosine<T1>::set_pulse_shape</a>(<span class="keywordtype">double</span> roll_off_factor_in, <span class="keywordtype">int</span> filter_length, <span class="keywordtype">int</span> upsampling_factor_in) |
---|
315 | <a name="l00424"></a>00424 { |
---|
316 | <a name="l00425"></a>00425 <a class="code" href="group__errorhandlingfunc.html#g0dfeed1c189885b05ebebe78abcc9785" title="Abort if t is true.">it_error_if</a>(roll_off_factor_in <= 0 || roll_off_factor_in > 1, |
---|
317 | <a name="l00426"></a>00426 <span class="stringliteral">"Root_Raised_Cosine: roll-off out of range"</span>); |
---|
318 | <a name="l00427"></a>00427 <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb" title="The roll off factor (i.e. alpha).">roll_off_factor</a> = roll_off_factor_in; |
---|
319 | <a name="l00428"></a>00428 |
---|
320 | <a name="l00429"></a>00429 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(<a class="code" href="group__miscfunc.html#g7fa3ce6e66b7a5cfd8a19afbaade3e07" title="Return true if x is an even integer.">is_even</a>(filter_length), |
---|
321 | <a name="l00430"></a>00430 <span class="stringliteral">"Root_Raised_Cosine: Filter length not even"</span>); |
---|
322 | <a name="l00431"></a>00431 |
---|
323 | <a name="l00432"></a>00432 <span class="keywordtype">int</span> i; |
---|
324 | <a name="l00433"></a>00433 <span class="keywordtype">double</span> t, num, den, tmp_arg; |
---|
325 | <a name="l00434"></a>00434 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#0a389c9769f5714a3f0b01039fdfa2fd" title="Samples per input symbol.">upsampling_factor</a> = upsampling_factor_in; |
---|
326 | <a name="l00435"></a>00435 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#adc84feb7843931d28b69b03595c47f9" title="Length in symbols.">pulse_length</a> = filter_length; |
---|
327 | <a name="l00436"></a>00436 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>.<a class="code" href="classitpp_1_1Vec.html#a4b02b7819e540bb3853c15e6480ada6" title="Set length of vector. if copy = true then keeping the old values.">set_size</a>(filter_length * upsampling_factor_in + 1, |
---|
328 | <a name="l00437"></a>00437 <span class="keyword">false</span>); |
---|
329 | <a name="l00438"></a>00438 |
---|
330 | <a name="l00439"></a>00439 <span class="keywordflow">for</span> (i = 0; i < this-><a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>.<a class="code" href="classitpp_1_1Vec.html#a906c893cd6184a774e4da8a47217d6a" title="The size of the vector.">size</a>(); i++) { |
---|
331 | <a name="l00440"></a>00440 <span class="comment">// delayed to be casual</span> |
---|
332 | <a name="l00441"></a>00441 t = (double)(i - filter_length * upsampling_factor_in / 2) |
---|
333 | <a name="l00442"></a>00442 / upsampling_factor_in; |
---|
334 | <a name="l00443"></a>00443 den = 1 - <a class="code" href="group__miscfunc.html#gd0a08400c5087615cb59d95c3e05ba38" title="Square of elements.">sqr</a>(4 * <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb" title="The roll off factor (i.e. alpha).">roll_off_factor</a> * t); |
---|
335 | <a name="l00444"></a>00444 <span class="keywordflow">if</span> (t == 0) { |
---|
336 | <a name="l00445"></a>00445 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>(i) = 1 + (4 * <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb" title="The roll off factor (i.e. alpha).">roll_off_factor</a> / pi) |
---|
337 | <a name="l00446"></a>00446 - <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb" title="The roll off factor (i.e. alpha).">roll_off_factor</a>; |
---|
338 | <a name="l00447"></a>00447 } |
---|
339 | <a name="l00448"></a>00448 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (den == 0) { |
---|
340 | <a name="l00449"></a>00449 tmp_arg = pi / (4 * <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb" title="The roll off factor (i.e. alpha).">roll_off_factor</a>); |
---|
341 | <a name="l00450"></a>00450 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>(i) = <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb" title="The roll off factor (i.e. alpha).">roll_off_factor</a> / <a class="code" href="group__miscfunc.html#g20af7c97287e8275db8c2b0f650310ac" title="Square root of the elements.">std::sqrt</a>(2.0) |
---|
342 | <a name="l00451"></a>00451 * ((1 + 2 / pi) * <a class="code" href="group__trifunc.html#g680fb273328ac7897cf28f6f980fe458" title="Sine function.">std::sin</a>(tmp_arg) + (1 - 2 / pi) * <a class="code" href="group__trifunc.html#g098a0025955a83d70458225324c21acf" title="Cosine function.">std::cos</a>(tmp_arg)); |
---|
343 | <a name="l00452"></a>00452 } |
---|
344 | <a name="l00453"></a>00453 <span class="keywordflow">else</span> { |
---|
345 | <a name="l00454"></a>00454 num = <a class="code" href="group__trifunc.html#g680fb273328ac7897cf28f6f980fe458" title="Sine function.">std::sin</a>(pi * (1 - <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb" title="The roll off factor (i.e. alpha).">roll_off_factor</a>) * t) |
---|
346 | <a name="l00455"></a>00455 + <a class="code" href="group__trifunc.html#g098a0025955a83d70458225324c21acf" title="Cosine function.">std::cos</a>(pi * (1 + <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb" title="The roll off factor (i.e. alpha).">roll_off_factor</a>) * t) * 4 * <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb" title="The roll off factor (i.e. alpha).">roll_off_factor</a> * t; |
---|
347 | <a name="l00456"></a>00456 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>(i) = num / (pi * t * den); |
---|
348 | <a name="l00457"></a>00457 } |
---|
349 | <a name="l00458"></a>00458 } |
---|
350 | <a name="l00459"></a>00459 |
---|
351 | <a name="l00460"></a>00460 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a> /= <a class="code" href="group__miscfunc.html#g20af7c97287e8275db8c2b0f650310ac" title="Square root of the elements.">std::sqrt</a>(<span class="keywordtype">double</span>(upsampling_factor_in)); |
---|
352 | <a name="l00461"></a>00461 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#5dcd026bd37e73f910f2c5d6c1120d41" title="The pulse shaping filter.">shaping_filter</a>.<a class="code" href="classitpp_1_1MA__Filter.html#5a8b88c583ea3d944e0fe96d2d8f236c" title="Set the filter coefficients.">set_coeffs</a>(this-><a class="code" href="classitpp_1_1Pulse__Shape.html#cd7f0b701f29ad43caf8497eee8aacce" title="The impulse resounse of the pulse shaping filter.">impulse_response</a>); |
---|
353 | <a name="l00462"></a>00462 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#5dcd026bd37e73f910f2c5d6c1120d41" title="The pulse shaping filter.">shaping_filter</a>.<a class="code" href="classitpp_1_1MA__Filter.html#fd9611f51af7dbab081188574a35ca29" title="Clears the filter memory.">clear</a>(); |
---|
354 | <a name="l00463"></a>00463 this-><a class="code" href="classitpp_1_1Pulse__Shape.html#f649289d3f21befa740b7462520c2bc7" title="Ensures that setup is called before any other member function.">setup_done</a> = <span class="keyword">true</span>; |
---|
355 | <a name="l00464"></a>00464 } |
---|
356 | <a name="l00465"></a>00465 |
---|
357 | <a name="l00466"></a>00466 <span class="keyword">template</span><<span class="keyword">class</span> T1> |
---|
358 | <a name="l00467"></a><a class="code" href="classitpp_1_1Root__Raised__Cosine.html#b14c9e22c4e9393b6c81f4add91f5c4e">00467</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#b14c9e22c4e9393b6c81f4add91f5c4e" title="Get the Roll-off factor.">Root_Raised_Cosine<T1>::get_roll_off</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span> |
---|
359 | <a name="l00468"></a>00468 <span class="keyword"></span>{ |
---|
360 | <a name="l00469"></a>00469 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(this-><a class="code" href="classitpp_1_1Pulse__Shape.html#f649289d3f21befa740b7462520c2bc7" title="Ensures that setup is called before any other member function.">setup_done</a>, <span class="stringliteral">"Pulse_Shape must be set up before using"</span>); |
---|
361 | <a name="l00470"></a>00470 <span class="keywordflow">return</span> <a class="code" href="classitpp_1_1Root__Raised__Cosine.html#7871d8432652602e6423d93224dae5cb" title="The roll off factor (i.e. alpha).">roll_off_factor</a>; |
---|
362 | <a name="l00471"></a>00471 } |
---|
363 | <a name="l00472"></a>00472 |
---|
364 | <a name="l00474"></a>00474 |
---|
365 | <a name="l00475"></a>00475 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
366 | <a name="l00476"></a>00476 <span class="comment">// Instantiations</span> |
---|
367 | <a name="l00477"></a>00477 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
368 | <a name="l00478"></a>00478 |
---|
369 | <a name="l00479"></a>00479 <span class="preprocessor">#ifdef HAVE_EXTERN_TEMPLATE</span> |
---|
370 | <a name="l00480"></a>00480 <span class="preprocessor"></span> |
---|
371 | <a name="l00481"></a>00481 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keyword">class </span><a class="code" href="classitpp_1_1Pulse__Shape.html" title="General FIR Pulse Shape.">Pulse_Shape<double, double, double></a>; |
---|
372 | <a name="l00482"></a>00482 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keyword">class </span><a class="code" href="classitpp_1_1Pulse__Shape.html" title="General FIR Pulse Shape.">Pulse_Shape < std::complex<double></a>, double, |
---|
373 | <a name="l00483"></a>00483 std::complex<double> >; |
---|
374 | <a name="l00484"></a>00484 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keyword">class </span><a class="code" href="classitpp_1_1Pulse__Shape.html" title="General FIR Pulse Shape.">Pulse_Shape < std::complex<double></a>, std::complex<double>, |
---|
375 | <a name="l00485"></a>00485 std::complex<double> >; |
---|
376 | <a name="l00486"></a>00486 |
---|
377 | <a name="l00487"></a>00487 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keyword">class </span><a class="code" href="classitpp_1_1Root__Raised__Cosine.html" title="(Square) Root Raised Cosine (RRC) Pulse Shaper">Root_Raised_Cosine<double></a>; |
---|
378 | <a name="l00488"></a>00488 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keyword">class </span><a class="code" href="classitpp_1_1Root__Raised__Cosine.html" title="(Square) Root Raised Cosine (RRC) Pulse Shaper">Root_Raised_Cosine<std::complex<double></a> >; |
---|
379 | <a name="l00489"></a>00489 |
---|
380 | <a name="l00490"></a>00490 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keyword">class </span><a class="code" href="classitpp_1_1Raised__Cosine.html" title="Raised Cosine (RC) Pulse Shaper.">Raised_Cosine<double></a>; |
---|
381 | <a name="l00491"></a>00491 <span class="keyword">extern</span> <span class="keyword">template</span> <span class="keyword">class </span><a class="code" href="classitpp_1_1Raised__Cosine.html" title="Raised Cosine (RC) Pulse Shaper.">Raised_Cosine<std::complex<double></a> >; |
---|
382 | <a name="l00492"></a>00492 |
---|
383 | <a name="l00493"></a>00493 <span class="preprocessor">#endif // HAVE_EXTERN_TEMPLATE</span> |
---|
384 | <a name="l00494"></a>00494 <span class="preprocessor"></span> |
---|
385 | <a name="l00496"></a>00496 |
---|
386 | <a name="l00497"></a>00497 } <span class="comment">// namespace itpp</span> |
---|
387 | <a name="l00498"></a>00498 |
---|
388 | <a name="l00499"></a>00499 <span class="preprocessor">#endif // #ifndef PULSE_SHAPE_H</span> |
---|
389 | </pre></div></div> |
---|
390 | <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:12 2009 for mixpp by |
---|
391 | <a href="http://www.doxygen.org/index.html"> |
---|
392 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> |
---|
393 | </body> |
---|
394 | </html> |
---|