comparison src/fftw-3.3.8/doc/html/Using-Plans.html @ 82:d0c2a83c1364

Add FFTW 3.3.8 source, and a Linux build
author Chris Cannam
date Tue, 19 Nov 2019 14:52:55 +0000
parents
children
comparison
equal deleted inserted replaced
81:7029a4916348 82:d0c2a83c1364
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <!-- This manual is for FFTW
4 (version 3.3.8, 24 May 2018).
5
6 Copyright (C) 2003 Matteo Frigo.
7
8 Copyright (C) 2003 Massachusetts Institute of Technology.
9
10 Permission is granted to make and distribute verbatim copies of this
11 manual provided the copyright notice and this permission notice are
12 preserved on all copies.
13
14 Permission is granted to copy and distribute modified versions of this
15 manual under the conditions for verbatim copying, provided that the
16 entire resulting derived work is distributed under the terms of a
17 permission notice identical to this one.
18
19 Permission is granted to copy and distribute translations of this manual
20 into another language, under the above conditions for modified versions,
21 except that this permission notice may be stated in a translation
22 approved by the Free Software Foundation. -->
23 <!-- Created by GNU Texinfo 6.3, http://www.gnu.org/software/texinfo/ -->
24 <head>
25 <title>FFTW 3.3.8: Using Plans</title>
26
27 <meta name="description" content="FFTW 3.3.8: Using Plans">
28 <meta name="keywords" content="FFTW 3.3.8: Using Plans">
29 <meta name="resource-type" content="document">
30 <meta name="distribution" content="global">
31 <meta name="Generator" content="makeinfo">
32 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
33 <link href="index.html#Top" rel="start" title="Top">
34 <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
35 <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
36 <link href="FFTW-Reference.html#FFTW-Reference" rel="up" title="FFTW Reference">
37 <link href="Basic-Interface.html#Basic-Interface" rel="next" title="Basic Interface">
38 <link href="Memory-Allocation.html#Memory-Allocation" rel="prev" title="Memory Allocation">
39 <style type="text/css">
40 <!--
41 a.summary-letter {text-decoration: none}
42 blockquote.indentedblock {margin-right: 0em}
43 blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
44 blockquote.smallquotation {font-size: smaller}
45 div.display {margin-left: 3.2em}
46 div.example {margin-left: 3.2em}
47 div.lisp {margin-left: 3.2em}
48 div.smalldisplay {margin-left: 3.2em}
49 div.smallexample {margin-left: 3.2em}
50 div.smalllisp {margin-left: 3.2em}
51 kbd {font-style: oblique}
52 pre.display {font-family: inherit}
53 pre.format {font-family: inherit}
54 pre.menu-comment {font-family: serif}
55 pre.menu-preformatted {font-family: serif}
56 pre.smalldisplay {font-family: inherit; font-size: smaller}
57 pre.smallexample {font-size: smaller}
58 pre.smallformat {font-family: inherit; font-size: smaller}
59 pre.smalllisp {font-size: smaller}
60 span.nolinebreak {white-space: nowrap}
61 span.roman {font-family: initial; font-weight: normal}
62 span.sansserif {font-family: sans-serif; font-weight: normal}
63 ul.no-bullet {list-style: none}
64 -->
65 </style>
66
67
68 </head>
69
70 <body lang="en">
71 <a name="Using-Plans"></a>
72 <div class="header">
73 <p>
74 Next: <a href="Basic-Interface.html#Basic-Interface" accesskey="n" rel="next">Basic Interface</a>, Previous: <a href="Data-Types-and-Files.html#Data-Types-and-Files" accesskey="p" rel="prev">Data Types and Files</a>, Up: <a href="FFTW-Reference.html#FFTW-Reference" accesskey="u" rel="up">FFTW Reference</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
75 </div>
76 <hr>
77 <a name="Using-Plans-1"></a>
78 <h3 class="section">4.2 Using Plans</h3>
79
80 <p>Plans for all transform types in FFTW are stored as type
81 <code>fftw_plan</code> (an opaque pointer type), and are created by one of the
82 various planning routines described in the following sections.
83 <a name="index-fftw_005fplan-1"></a>
84 An <code>fftw_plan</code> contains all information necessary to compute the
85 transform, including the pointers to the input and output arrays.
86 </p>
87 <div class="example">
88 <pre class="example">void fftw_execute(const fftw_plan plan);
89 </pre></div>
90 <a name="index-fftw_005fexecute-1"></a>
91
92 <p>This executes the <code>plan</code>, to compute the corresponding transform on
93 the arrays for which it was planned (which must still exist). The plan
94 is not modified, and <code>fftw_execute</code> can be called as many times as
95 desired.
96 </p>
97 <p>To apply a given plan to a different array, you can use the new-array execute
98 interface. See <a href="New_002darray-Execute-Functions.html#New_002darray-Execute-Functions">New-array Execute Functions</a>.
99 </p>
100 <p><code>fftw_execute</code> (and equivalents) is the only function in FFTW
101 guaranteed to be thread-safe; see <a href="Thread-safety.html#Thread-safety">Thread safety</a>.
102 </p>
103 <p>This function:
104 </p><div class="example">
105 <pre class="example">void fftw_destroy_plan(fftw_plan plan);
106 </pre></div>
107 <a name="index-fftw_005fdestroy_005fplan-1"></a>
108 <p>deallocates the <code>plan</code> and all its associated data.
109 </p>
110 <p>FFTW&rsquo;s planner saves some other persistent data, such as the
111 accumulated wisdom and a list of algorithms available in the current
112 configuration. If you want to deallocate all of that and reset FFTW
113 to the pristine state it was in when you started your program, you can
114 call:
115 </p>
116 <div class="example">
117 <pre class="example">void fftw_cleanup(void);
118 </pre></div>
119 <a name="index-fftw_005fcleanup"></a>
120
121 <p>After calling <code>fftw_cleanup</code>, all existing plans become undefined,
122 and you should not attempt to execute them nor to destroy them. You can
123 however create and execute/destroy new plans, in which case FFTW starts
124 accumulating wisdom information again.
125 </p>
126 <p><code>fftw_cleanup</code> does not deallocate your plans, however. To prevent
127 memory leaks, you must still call <code>fftw_destroy_plan</code> before
128 executing <code>fftw_cleanup</code>.
129 </p>
130 <p>Occasionally, it may useful to know FFTW&rsquo;s internal &ldquo;cost&rdquo; metric
131 that it uses to compare plans to one another; this cost is
132 proportional to an execution time of the plan, in undocumented units,
133 if the plan was created with the <code>FFTW_MEASURE</code> or other
134 timing-based options, or alternatively is a heuristic cost function
135 for <code>FFTW_ESTIMATE</code> plans. (The cost values of measured and
136 estimated plans are not comparable, being in different units. Also,
137 costs from different FFTW versions or the same version compiled
138 differently may not be in the same units. Plans created from wisdom
139 have a cost of 0 since no timing measurement is performed for them.
140 Finally, certain problems for which only one top-level algorithm was
141 possible may have required no measurements of the cost of the whole
142 plan, in which case <code>fftw_cost</code> will also return 0.) The cost
143 metric for a given plan is returned by:
144 </p>
145 <div class="example">
146 <pre class="example">double fftw_cost(const fftw_plan plan);
147 </pre></div>
148 <a name="index-fftw_005fcost"></a>
149
150 <p>The following two routines are provided purely for academic purposes
151 (that is, for entertainment).
152 </p>
153 <div class="example">
154 <pre class="example">void fftw_flops(const fftw_plan plan,
155 double *add, double *mul, double *fma);
156 </pre></div>
157 <a name="index-fftw_005fflops"></a>
158
159 <p>Given a <code>plan</code>, set <code>add</code>, <code>mul</code>, and <code>fma</code> to an
160 exact count of the number of floating-point additions, multiplications,
161 and fused multiply-add operations involved in the plan&rsquo;s execution. The
162 total number of floating-point operations (flops) is <code>add + mul +
163 2*fma</code>, or <code>add + mul + fma</code> if the hardware supports fused
164 multiply-add instructions (although the number of FMA operations is only
165 approximate because of compiler voodoo). (The number of operations
166 should be an integer, but we use <code>double</code> to avoid overflowing
167 <code>int</code> for large transforms; the arguments are of type <code>double</code>
168 even for single and long-double precision versions of FFTW.)
169 </p>
170 <div class="example">
171 <pre class="example">void fftw_fprint_plan(const fftw_plan plan, FILE *output_file);
172 void fftw_print_plan(const fftw_plan plan);
173 char *fftw_sprint_plan(const fftw_plan plan);
174 </pre></div>
175 <a name="index-fftw_005ffprint_005fplan"></a>
176 <a name="index-fftw_005fprint_005fplan"></a>
177
178 <p>This outputs a &ldquo;nerd-readable&rdquo; representation of the <code>plan</code> to
179 the given file, to <code>stdout</code>, or two a newly allocated
180 NUL-terminated string (which the caller is responsible for deallocating
181 with <code>free</code>), respectively.
182 </p>
183 <hr>
184 <div class="header">
185 <p>
186 Next: <a href="Basic-Interface.html#Basic-Interface" accesskey="n" rel="next">Basic Interface</a>, Previous: <a href="Data-Types-and-Files.html#Data-Types-and-Files" accesskey="p" rel="prev">Data Types and Files</a>, Up: <a href="FFTW-Reference.html#FFTW-Reference" accesskey="u" rel="up">FFTW Reference</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
187 </div>
188
189
190
191 </body>
192 </html>