d@0
|
1 <html lang="en">
|
d@0
|
2 <head>
|
d@0
|
3 <title>Using Plans - 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="FFTW-Reference.html#FFTW-Reference" title="FFTW Reference">
|
d@0
|
9 <link rel="prev" href="Data-Types-and-Files.html#Data-Types-and-Files" title="Data Types and Files">
|
d@0
|
10 <link rel="next" href="Basic-Interface.html#Basic-Interface" title="Basic Interface">
|
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="Using-Plans"></a>
|
d@0
|
51 Next: <a rel="next" accesskey="n" href="Basic-Interface.html#Basic-Interface">Basic Interface</a>,
|
d@0
|
52 Previous: <a rel="previous" accesskey="p" href="Data-Types-and-Files.html#Data-Types-and-Files">Data Types and Files</a>,
|
d@0
|
53 Up: <a rel="up" accesskey="u" href="FFTW-Reference.html#FFTW-Reference">FFTW Reference</a>
|
d@0
|
54 <hr>
|
d@0
|
55 </div>
|
d@0
|
56
|
d@0
|
57 <h3 class="section">4.2 Using Plans</h3>
|
d@0
|
58
|
d@0
|
59 <p>Plans for all transform types in FFTW are stored as type
|
d@0
|
60 <code>fftw_plan</code> (an opaque pointer type), and are created by one of the
|
d@0
|
61 various planning routines described in the following sections.
|
d@0
|
62 <a name="index-fftw_005fplan-146"></a>An <code>fftw_plan</code> contains all information necessary to compute the
|
d@0
|
63 transform, including the pointers to the input and output arrays.
|
d@0
|
64
|
d@0
|
65 <pre class="example"> void fftw_execute(const fftw_plan plan);
|
d@0
|
66 </pre>
|
d@0
|
67 <p><a name="index-fftw_005fexecute-147"></a>
|
d@0
|
68 This executes the <code>plan</code>, to compute the corresponding transform on
|
d@0
|
69 the arrays for which it was planned (which must still exist). The plan
|
d@0
|
70 is not modified, and <code>fftw_execute</code> can be called as many times as
|
d@0
|
71 desired.
|
d@0
|
72
|
d@0
|
73 <p>To apply a given plan to a different array, you can use the new-array execute
|
d@0
|
74 interface. See <a href="New_002darray-Execute-Functions.html#New_002darray-Execute-Functions">New-array Execute Functions</a>.
|
d@0
|
75
|
d@0
|
76 <p><code>fftw_execute</code> (and equivalents) is the only function in FFTW
|
d@0
|
77 guaranteed to be thread-safe; see <a href="Thread-safety.html#Thread-safety">Thread safety</a>.
|
d@0
|
78
|
d@0
|
79 <p>This function:
|
d@0
|
80 <pre class="example"> void fftw_destroy_plan(fftw_plan plan);
|
d@0
|
81 </pre>
|
d@0
|
82 <p><a name="index-fftw_005fdestroy_005fplan-148"></a>deallocates the <code>plan</code> and all its associated data.
|
d@0
|
83
|
d@0
|
84 <p>FFTW's planner saves some other persistent data, such as the
|
d@0
|
85 accumulated wisdom and a list of algorithms available in the current
|
d@0
|
86 configuration. If you want to deallocate all of that and reset FFTW
|
d@0
|
87 to the pristine state it was in when you started your program, you can
|
d@0
|
88 call:
|
d@0
|
89
|
d@0
|
90 <pre class="example"> void fftw_cleanup(void);
|
d@0
|
91 </pre>
|
d@0
|
92 <p><a name="index-fftw_005fcleanup-149"></a>
|
d@0
|
93 After calling <code>fftw_cleanup</code>, all existing plans become undefined,
|
d@0
|
94 and you should not attempt to execute them nor to destroy them. You can
|
d@0
|
95 however create and execute/destroy new plans, in which case FFTW starts
|
d@0
|
96 accumulating wisdom information again.
|
d@0
|
97
|
d@0
|
98 <p><code>fftw_cleanup</code> does not deallocate your plans; you should still
|
d@0
|
99 call <code>fftw_destroy_plan</code> for this purpose.
|
d@0
|
100
|
d@0
|
101 <p>The following two routines are provided purely for academic purposes
|
d@0
|
102 (that is, for entertainment).
|
d@0
|
103
|
d@0
|
104 <pre class="example"> void fftw_flops(const fftw_plan plan,
|
d@0
|
105 double *add, double *mul, double *fma);
|
d@0
|
106 </pre>
|
d@0
|
107 <p><a name="index-fftw_005fflops-150"></a>
|
d@0
|
108 Given a <code>plan</code>, set <code>add</code>, <code>mul</code>, and <code>fma</code> to an
|
d@0
|
109 exact count of the number of floating-point additions, multiplications,
|
d@0
|
110 and fused multiply-add operations involved in the plan's execution. The
|
d@0
|
111 total number of floating-point operations (flops) is <code>add + mul +
|
d@0
|
112 2*fma</code>, or <code>add + mul + fma</code> if the hardware supports fused
|
d@0
|
113 multiply-add instructions (although the number of FMA operations is only
|
d@0
|
114 approximate because of compiler voodoo). (The number of operations
|
d@0
|
115 should be an integer, but we use <code>double</code> to avoid overflowing
|
d@0
|
116 <code>int</code> for large transforms; the arguments are of type <code>double</code>
|
d@0
|
117 even for single and long-double precision versions of FFTW.)
|
d@0
|
118
|
d@0
|
119 <pre class="example"> void fftw_fprint_plan(const fftw_plan plan, FILE *output_file);
|
d@0
|
120 void fftw_print_plan(const fftw_plan plan);
|
d@0
|
121 </pre>
|
d@0
|
122 <p><a name="index-fftw_005ffprint_005fplan-151"></a><a name="index-fftw_005fprint_005fplan-152"></a>
|
d@0
|
123 This outputs a “nerd-readable” representation of the <code>plan</code> to
|
d@0
|
124 the given file or to <code>stdout</code>, respectively.
|
d@0
|
125
|
d@0
|
126 <!-- -->
|
d@0
|
127 </body></html>
|
d@0
|
128
|