File: complexFFTExample_8cc-example.html

package info (click to toggle)
mffm-fftw 1.6-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,212 kB
  • ctags: 295
  • sloc: cpp: 711; makefile: 89
file content (68 lines) | stat: -rw-r--r-- 4,285 bytes parent folder | download | duplicates (7)
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
<!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>Example Documentation</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>complexFFTExample.cc</h1> This is an example of how to use the class.
<p>
<div class="fragment"><pre><span class="comment">/* Copyright 2001,2002 Matt Flax &lt;flatmax@ieee.org&gt;</span>
<span class="comment">   This file is part of the MFFM FFTw Wrapper library.</span>
<span class="comment"></span>
<span class="comment">   MFFM MFFM FFTw Wrapper library is free software; you can </span>
<span class="comment">   redistribute it and/or modify</span>
<span class="comment">   it under the terms of the GNU General Public License as published by</span>
<span class="comment">   the Free Software Foundation; either version 2 of the License, or</span>
<span class="comment">   (at your option) any later version.</span>
<span class="comment">   </span>
<span class="comment">   MFFM FFTw Wrapper library is distributed in the hope that it will be useful,</span>
<span class="comment">   but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="comment">   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<span class="comment">   GNU General Public License for more details.</span>
<span class="comment">   </span>
<span class="comment">   You have received a copy of the GNU General Public License</span>
<span class="comment">   along with the MFFM FFTw Wrapper library</span>
<span class="comment">*/</span>
<span class="preprocessor">#include &lt;fstream&gt;</span>
<span class="preprocessor">#include &lt;iomanip&gt;</span>

<span class="preprocessor">#include "complexFFT.H"</span>
<span class="preprocessor">#include &lt;iomanip.h&gt;</span>

<span class="keywordtype">int</span> main (){
  <span class="keywordtype">int</span> count =8;
  <a name="_a0"></a><a class="code" href="classcomplexFFTData.html">complexFFTData</a> fftData(count);
  <a name="_a1"></a><a class="code" href="classcomplexFFT.html">complexFFT</a> fft(&amp;fftData);

  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0;i&lt;count;i++){
    c_re(fftData.<a name="a2"></a><a class="code" href="classcomplexFFTData.html#m1">in</a>[i])=(double)i;
    <span class="comment">//    fftData.in[i].im=(double)-i;</span>
    c_im(fftData.<a class="code" href="classcomplexFFTData.html#m1">in</a>[i])=(double)i+5.0;
  }

  fftw_real *temp=&amp;c_re(fftData.<a class="code" href="classcomplexFFTData.html#m1">in</a>[0]);
  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;count; i++)
    cout &lt;&lt; temp[i]&lt;&lt;endl;
  

  <span class="comment">// forward transform :</span>
  fft.<a name="a3"></a><a class="code" href="classcomplexFFT.html#a3">fwdTransform</a>();
  <span class="comment">// inverse transform :</span>
  fft.<a name="a4"></a><a class="code" href="classcomplexFFT.html#a4">invTransform</a>();

  <span class="comment">//  for (int i=0; i&lt;count; i++)</span>
  <span class="comment">//  cout &lt;&lt; fftData.in[i].re&lt;&lt;' '&lt;&lt;fftData.in[i].im&lt;&lt;endl;</span>

  <span class="comment">// Find the power spectrum ...</span>
  fftData.<a name="a5"></a><a class="code" href="classcomplexFFTData.html#a5">compPowerSpec</a>();
  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;count; i++)
    cout &lt;&lt; fftData.<a name="a6"></a><a class="code" href="classcomplexFFTData.html#m3">power_spectrum</a>[i]&lt;&lt;endl;
}
</pre></div><hr><address style="align: right;"><small>Generated on Thu Jun 19 11:21:56 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>