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