Mercurial > hg > sv-dependency-builds
comparison src/fftw-3.3.3/doc/html/Multi_002dDimensional-DFTs-of-Real-Data.html @ 10:37bf6b4a2645
Add FFTW3
author | Chris Cannam |
---|---|
date | Wed, 20 Mar 2013 15:35:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:c0fb53affa76 | 10:37bf6b4a2645 |
---|---|
1 <html lang="en"> | |
2 <head> | |
3 <title>Multi-Dimensional DFTs of Real Data - FFTW 3.3.3</title> | |
4 <meta http-equiv="Content-Type" content="text/html"> | |
5 <meta name="description" content="FFTW 3.3.3"> | |
6 <meta name="generator" content="makeinfo 4.13"> | |
7 <link title="Top" rel="start" href="index.html#Top"> | |
8 <link rel="up" href="Tutorial.html#Tutorial" title="Tutorial"> | |
9 <link rel="prev" href="One_002dDimensional-DFTs-of-Real-Data.html#One_002dDimensional-DFTs-of-Real-Data" title="One-Dimensional DFTs of Real Data"> | |
10 <link rel="next" href="More-DFTs-of-Real-Data.html#More-DFTs-of-Real-Data" title="More DFTs of Real Data"> | |
11 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> | |
12 <!-- | |
13 This manual is for FFTW | |
14 (version 3.3.3, 25 November 2012). | |
15 | |
16 Copyright (C) 2003 Matteo Frigo. | |
17 | |
18 Copyright (C) 2003 Massachusetts Institute of Technology. | |
19 | |
20 Permission is granted to make and distribute verbatim copies of | |
21 this manual provided the copyright notice and this permission | |
22 notice are preserved on all copies. | |
23 | |
24 Permission is granted to copy and distribute modified versions of | |
25 this manual under the conditions for verbatim copying, provided | |
26 that the entire resulting derived work is distributed under the | |
27 terms of a permission notice identical to this one. | |
28 | |
29 Permission is granted to copy and distribute translations of this | |
30 manual into another language, under the above conditions for | |
31 modified versions, except that this permission notice may be | |
32 stated in a translation approved by the Free Software Foundation. | |
33 --> | |
34 <meta http-equiv="Content-Style-Type" content="text/css"> | |
35 <style type="text/css"><!-- | |
36 pre.display { font-family:inherit } | |
37 pre.format { font-family:inherit } | |
38 pre.smalldisplay { font-family:inherit; font-size:smaller } | |
39 pre.smallformat { font-family:inherit; font-size:smaller } | |
40 pre.smallexample { font-size:smaller } | |
41 pre.smalllisp { font-size:smaller } | |
42 span.sc { font-variant:small-caps } | |
43 span.roman { font-family:serif; font-weight:normal; } | |
44 span.sansserif { font-family:sans-serif; font-weight:normal; } | |
45 --></style> | |
46 </head> | |
47 <body> | |
48 <div class="node"> | |
49 <a name="Multi-Dimensional-DFTs-of-Real-Data"></a> | |
50 <a name="Multi_002dDimensional-DFTs-of-Real-Data"></a> | |
51 <p> | |
52 Next: <a rel="next" accesskey="n" href="More-DFTs-of-Real-Data.html#More-DFTs-of-Real-Data">More DFTs of Real Data</a>, | |
53 Previous: <a rel="previous" accesskey="p" href="One_002dDimensional-DFTs-of-Real-Data.html#One_002dDimensional-DFTs-of-Real-Data">One-Dimensional DFTs of Real Data</a>, | |
54 Up: <a rel="up" accesskey="u" href="Tutorial.html#Tutorial">Tutorial</a> | |
55 <hr> | |
56 </div> | |
57 | |
58 <h3 class="section">2.4 Multi-Dimensional DFTs of Real Data</h3> | |
59 | |
60 <p>Multi-dimensional DFTs of real data use the following planner routines: | |
61 | |
62 <pre class="example"> fftw_plan fftw_plan_dft_r2c_2d(int n0, int n1, | |
63 double *in, fftw_complex *out, | |
64 unsigned flags); | |
65 fftw_plan fftw_plan_dft_r2c_3d(int n0, int n1, int n2, | |
66 double *in, fftw_complex *out, | |
67 unsigned flags); | |
68 fftw_plan fftw_plan_dft_r2c(int rank, const int *n, | |
69 double *in, fftw_complex *out, | |
70 unsigned flags); | |
71 </pre> | |
72 <p><a name="index-fftw_005fplan_005fdft_005fr2c_005f2d-59"></a><a name="index-fftw_005fplan_005fdft_005fr2c_005f3d-60"></a><a name="index-fftw_005fplan_005fdft_005fr2c-61"></a> | |
73 as well as the corresponding <code>c2r</code> routines with the input/output | |
74 types swapped. These routines work similarly to their complex | |
75 analogues, except for the fact that here the complex output array is cut | |
76 roughly in half and the real array requires padding for in-place | |
77 transforms (as in 1d, above). | |
78 | |
79 <p>As before, <code>n</code> is the logical size of the array, and the | |
80 consequences of this on the the format of the complex arrays deserve | |
81 careful attention. | |
82 <a name="index-r2c_002fc2r-multi_002ddimensional-array-format-62"></a>Suppose that the real data has dimensions n<sub>0</sub> × n<sub>1</sub> × n<sub>2</sub> × … × n<sub>d-1</sub> (in row-major order). | |
83 Then, after an r2c transform, the output is an n<sub>0</sub> × n<sub>1</sub> × n<sub>2</sub> × … × (n<sub>d-1</sub>/2 + 1) array of | |
84 <code>fftw_complex</code> values in row-major order, corresponding to slightly | |
85 over half of the output of the corresponding complex DFT. (The division | |
86 is rounded down.) The ordering of the data is otherwise exactly the | |
87 same as in the complex-DFT case. | |
88 | |
89 <p>For out-of-place transforms, this is the end of the story: the real | |
90 data is stored as a row-major array of size n<sub>0</sub> × n<sub>1</sub> × n<sub>2</sub> × … × n<sub>d-1</sub> and the complex | |
91 data is stored as a row-major array of size n<sub>0</sub> × n<sub>1</sub> × n<sub>2</sub> × … × (n<sub>d-1</sub>/2 + 1). | |
92 | |
93 <p>For in-place transforms, however, extra padding of the real-data array | |
94 is necessary because the complex array is larger than the real array, | |
95 and the two arrays share the same memory locations. Thus, for | |
96 in-place transforms, the final dimension of the real-data array must | |
97 be padded with extra values to accommodate the size of the complex | |
98 data—two values if the last dimension is even and one if it is odd. | |
99 <a name="index-padding-63"></a>That is, the last dimension of the real data must physically contain | |
100 2 * (n<sub>d-1</sub>/2+1)<code>double</code> values (exactly enough to hold the complex data). | |
101 This physical array size does not, however, change the <em>logical</em> | |
102 array size—only | |
103 n<sub>d-1</sub>values are actually stored in the last dimension, and | |
104 n<sub>d-1</sub>is the last dimension passed to the plan-creation routine. | |
105 | |
106 <p>For example, consider the transform of a two-dimensional real array of | |
107 size <code>n0</code> by <code>n1</code>. The output of the r2c transform is a | |
108 two-dimensional complex array of size <code>n0</code> by <code>n1/2+1</code>, where | |
109 the <code>y</code> dimension has been cut nearly in half because of | |
110 redundancies in the output. Because <code>fftw_complex</code> is twice the | |
111 size of <code>double</code>, the output array is slightly bigger than the | |
112 input array. Thus, if we want to compute the transform in place, we | |
113 must <em>pad</em> the input array so that it is of size <code>n0</code> by | |
114 <code>2*(n1/2+1)</code>. If <code>n1</code> is even, then there are two padding | |
115 elements at the end of each row (which need not be initialized, as they | |
116 are only used for output). | |
117 | |
118 <p>The following illustration depicts the input and output arrays just | |
119 described, for both the out-of-place and in-place transforms (with the | |
120 arrows indicating consecutive memory locations): | |
121 <img src="rfftwnd-for-html.png" alt="rfftwnd-for-html.png"> | |
122 | |
123 <p>These transforms are unnormalized, so an r2c followed by a c2r | |
124 transform (or vice versa) will result in the original data scaled by | |
125 the number of real data elements—that is, the product of the | |
126 (logical) dimensions of the real data. | |
127 <a name="index-normalization-64"></a> | |
128 | |
129 <p>(Because the last dimension is treated specially, if it is equal to | |
130 <code>1</code> the transform is <em>not</em> equivalent to a lower-dimensional | |
131 r2c/c2r transform. In that case, the last complex dimension also has | |
132 size <code>1</code> (<code>=1/2+1</code>), and no advantage is gained over the | |
133 complex transforms.) | |
134 | |
135 <!-- --> | |
136 </body></html> | |
137 |