annotate src/fftw-3.3.3/doc/html/Multi_002dDimensional-DFTs-of-Real-Data.html @ 95:89f5e221ed7b

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