File: complexFFT_8H-source.html

package info (click to toggle)
mffm-fftw 1.4-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,204 kB
  • ctags: 295
  • sloc: cpp: 704; makefile: 88
file content (111 lines) | stat: -rw-r--r-- 10,052 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>complexFFT.H Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.18 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="examples.html">Examples</a> &nbsp; </center>
<hr><h1>complexFFT.H</h1><div class="fragment"><pre>00001 <span class="comment">/* Copyright 2001,2002 Matt Flax &lt;flatmax@ieee.org&gt;</span>
00002 <span class="comment">   This file is part of the MFFM FFTw Wrapper library.</span>
00003 <span class="comment"></span>
00004 <span class="comment">   MFFM MFFM FFTw Wrapper library is free software; you can </span>
00005 <span class="comment">   redistribute it and/or modify</span>
00006 <span class="comment">   it under the terms of the GNU General Public License as published by</span>
00007 <span class="comment">   the Free Software Foundation; either version 2 of the License, or</span>
00008 <span class="comment">   (at your option) any later version.</span>
00009 <span class="comment">   </span>
00010 <span class="comment">   MFFM FFTw Wrapper library is distributed in the hope that it will be useful,</span>
00011 <span class="comment">   but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
00012 <span class="comment">   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
00013 <span class="comment">   GNU General Public License for more details.</span>
00014 <span class="comment">   </span>
00015 <span class="comment">   You have received a copy of the GNU General Public License</span>
00016 <span class="comment">   along with the MFFM FFTw Wrapper library</span>
00017 <span class="comment">*/</span>
00018 <span class="preprocessor">#ifndef COMPLEXFFT_H_</span>
00019 <span class="preprocessor"></span><span class="preprocessor">#define COMPLEXFFT_H_</span>
00020 <span class="preprocessor"></span>
00021 <span class="preprocessor">#include &lt;fftw3.h&gt;</span>
00022 
00023 <span class="preprocessor">#ifndef fftw_real</span>
00024 <span class="preprocessor"></span><span class="preprocessor">#define fftw_real double</span>
00025 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00026 <span class="preprocessor"></span><span class="preprocessor">#define c_re(c) ((c)[0])</span>
00027 <span class="preprocessor"></span><span class="preprocessor">#define c_im(c) ((c)[1])</span>
00028 <span class="preprocessor"></span>
00029 <span class="preprocessor">#include &lt;iomanip&gt;</span>
00030 <span class="keyword">using</span> <span class="keyword">namespace </span>std;
00031 
00032 <span class="preprocessor">#define PLANTYPE FFTW_ESTIMATE</span>
00033 <span class="preprocessor"></span><span class="comment"></span>
00034 <span class="comment">/// class complexFFTData controls and manipulates complex fft data</span>
<a name="l00035"></a><a class="code" href="classcomplexFFTData.html">00035</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="classcomplexFFTData.html">complexFFTData</a> {
00036 <span class="keyword">public</span>:<span class="comment"></span>
00037 <span class="comment">  /// Specifies the size of the data array</span>
<a name="l00038"></a><a class="code" href="classcomplexFFTData.html#m0">00038</a> <span class="comment"></span>  <span class="keywordtype">int</span> <a class="code" href="classcomplexFFTData.html#m0">size</a>;<span class="comment"></span>
00039 <span class="comment">  /// the input and output arrays</span>
<a name="l00040"></a><a class="code" href="classcomplexFFTData.html#m2">00040</a> <span class="comment"></span>  fftw_complex *<a class="code" href="classcomplexFFTData.html#m1">in</a>, *<a class="code" href="classcomplexFFTData.html#m2">out</a>;<span class="comment"></span>
00041 <span class="comment">  /// the power_spectrum array</span>
<a name="l00042"></a><a class="code" href="classcomplexFFTData.html#m3">00042</a> <span class="comment"></span>  fftw_real *<a class="code" href="classcomplexFFTData.html#m3">power_spectrum</a>;<span class="comment"></span>
00043 <span class="comment">  /// The total power (summed) of the power spectrum as used in the method compPowerSpec</span>
<a name="l00044"></a><a class="code" href="classcomplexFFTData.html#m4">00044</a> <span class="comment"></span>  <span class="keywordtype">double</span> <a class="code" href="classcomplexFFTData.html#m4">totalPower</a>;
00045 <span class="comment"></span>
00046 <span class="comment">  /// Constructor with all memory to be allocated internally</span>
00047 <span class="comment"></span>  <a class="code" href="classcomplexFFTData.html#a0">complexFFTData</a>(<span class="keywordtype">int</span> sz);<span class="comment"></span>
00048 <span class="comment">  /// Deconstructor</span>
00049 <span class="comment"></span>  <a class="code" href="classcomplexFFTData.html#a1">~complexFFTData</a>(<span class="keywordtype">void</span>);
00050 <span class="comment"></span>
00051 <span class="comment">  /// Use this to change associated fft data (for fft'ing)</span>
00052 <span class="comment"></span>  <span class="keywordtype">void</span> <a class="code" href="classcomplexFFTData.html#a2">switchData</a>(<a class="code" href="classcomplexFFTData.html">complexFFTData</a> *d);
00053 <span class="comment"></span>
00054 <span class="comment">  /// Limits the maximum to 'lim' and returns the last fft bin with max  </span>
00055 <span class="comment"></span>  <span class="keywordtype">int</span> <a class="code" href="classcomplexFFTData.html#a3">limitHalfPowerSpec</a>(<span class="keywordtype">double</span> lim);
00056 <span class="comment"></span>
00057 <span class="comment">  /// Returns the number of elements in the input and output arrays</span>
<a name="l00058"></a><a class="code" href="classcomplexFFTData.html#a4">00058</a> <span class="comment"></span>  <span class="keywordtype">int</span> <a class="code" href="classcomplexFFTData.html#a4">getSize</a>(){<span class="keywordflow">return</span> <a class="code" href="classcomplexFFTData.html#m0">size</a>;}
00059   <span class="comment">//  int getHalfSize(){ if (!(size%2)) return size/2; else return size/2+1;}</span>
00060 <span class="comment"></span>
00061 <span class="comment">  /// This function computes the power spectrum and returns the max bin</span>
00062 <span class="comment"></span>  <span class="keywordtype">int</span> <a class="code" href="classcomplexFFTData.html#a5">compPowerSpec</a>();
00063   <span class="comment">//  int powerSpecDeriv(); // Find the derivative of the power spectrum</span>
00064 };
00065 <span class="comment"></span>
00066 <span class="comment">///class complexFFT controls fftw plans and executes fwd/inv transforms</span>
<a name="l00067"></a><a class="code" href="classcomplexFFT.html">00067</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="classcomplexFFT.html">complexFFT</a> {<span class="comment"></span>
00068 <span class="comment">  /// The fwd/inv plans</span>
00069 <span class="comment"></span>  fftw_plan fwdPlan, invPlan;<span class="comment"></span>
00070 <span class="comment">  /// Method to create the plans</span>
00071 <span class="comment"></span>  <span class="keywordtype">void</span> createPlan(<span class="keywordtype">void</span>);<span class="comment"></span>
00072 <span class="comment">  /// Method to destroy the plans</span>
00073 <span class="comment"></span>  <span class="keywordtype">void</span> destroyPlan(<span class="keywordtype">void</span>);
00074 <span class="keyword">protected</span>:
00075   <span class="comment">//  int size;</span><span class="comment"></span>
00076 <span class="comment">  /// The pointer to the relevant data</span>
<a name="l00077"></a><a class="code" href="classcomplexFFT.html#n0">00077</a> <span class="comment"></span>  complexFFTData *data;
00078 <span class="keyword">public</span>:
00079 
00080   <span class="comment">//  complexFFT(int sz, char *ws=NULL);</span><span class="comment"></span>
00081 <span class="comment">  /// fft init ... data pointed to by 'd'</span>
00082 <span class="comment"></span>  complexFFT(complexFFTData *d);<span class="comment"></span>
00083 <span class="comment">  /// fft deconstructor</span>
00084 <span class="comment"></span>  ~complexFFT();
00085 <span class="comment"></span>
00086 <span class="comment">  /// Use this to change associated fft data (for fft'ing)</span>
00087 <span class="comment"></span>  <span class="keywordtype">void</span> <a class="code" href="classcomplexFFT.html#a2">switchData</a>(<a class="code" href="classcomplexFFTData.html">complexFFTData</a> *d);
00088 <span class="comment"></span>
00089 <span class="comment">  /// Forward transform the data (in to out)</span>
00090 <span class="comment"></span>  <span class="keywordtype">void</span> <a class="code" href="classcomplexFFT.html#a3">fwdTransform</a>(); <span class="comment">// Forward fft</span><span class="comment"></span>
00091 <span class="comment">  /// Inverse transform the data (out to in)</span>
00092 <span class="comment"></span>  void invTransform(); // Inverse fft
00093 };<span class="comment"></span>
00094 <span class="comment">/** \example complexFFTExample.cc</span>
00095 <span class="comment"> * This is an example of how to use the class.</span>
00096 <span class="comment"> */</span>
00097 <span class="preprocessor">#endif // COMPLEXFFT_H_</span>
</pre></div><hr><address style="align: right;"><small>Generated on Sun Aug 10 20:34:00 2003 for MFFM FFTw Wrapper by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.18 </small></address>
</body>
</html>