Mercurial > hg > sv-dependency-builds
comparison src/fftw-3.3.5/doc/html/Using-Plans.html @ 127:7867fa7e1b6b
Current fftw source
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Tue, 18 Oct 2016 13:40:26 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
126:4a7071416412 | 127:7867fa7e1b6b |
---|---|
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.5, 30 July 2016). | |
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 5.2, http://www.gnu.org/software/texinfo/ --> | |
24 <head> | |
25 <title>FFTW 3.3.5: Using Plans</title> | |
26 | |
27 <meta name="description" content="FFTW 3.3.5: Using Plans"> | |
28 <meta name="keywords" content="FFTW 3.3.5: 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.smallquotation {font-size: smaller} | |
43 div.display {margin-left: 3.2em} | |
44 div.example {margin-left: 3.2em} | |
45 div.indentedblock {margin-left: 3.2em} | |
46 div.lisp {margin-left: 3.2em} | |
47 div.smalldisplay {margin-left: 3.2em} | |
48 div.smallexample {margin-left: 3.2em} | |
49 div.smallindentedblock {margin-left: 3.2em; font-size: smaller} | |
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.nocodebreak {white-space:nowrap} | |
61 span.nolinebreak {white-space:nowrap} | |
62 span.roman {font-family:serif; font-weight:normal} | |
63 span.sansserif {font-family:sans-serif; font-weight:normal} | |
64 ul.no-bullet {list-style: none} | |
65 --> | |
66 </style> | |
67 | |
68 | |
69 </head> | |
70 | |
71 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> | |
72 <a name="Using-Plans"></a> | |
73 <div class="header"> | |
74 <p> | |
75 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> [<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> | |
76 </div> | |
77 <hr> | |
78 <a name="Using-Plans-1"></a> | |
79 <h3 class="section">4.2 Using Plans</h3> | |
80 | |
81 <p>Plans for all transform types in FFTW are stored as type | |
82 <code>fftw_plan</code> (an opaque pointer type), and are created by one of the | |
83 various planning routines described in the following sections. | |
84 <a name="index-fftw_005fplan-1"></a> | |
85 An <code>fftw_plan</code> contains all information necessary to compute the | |
86 transform, including the pointers to the input and output arrays. | |
87 </p> | |
88 <div class="example"> | |
89 <pre class="example">void fftw_execute(const fftw_plan plan); | |
90 </pre></div> | |
91 <a name="index-fftw_005fexecute-1"></a> | |
92 | |
93 <p>This executes the <code>plan</code>, to compute the corresponding transform on | |
94 the arrays for which it was planned (which must still exist). The plan | |
95 is not modified, and <code>fftw_execute</code> can be called as many times as | |
96 desired. | |
97 </p> | |
98 <p>To apply a given plan to a different array, you can use the new-array execute | |
99 interface. See <a href="New_002darray-Execute-Functions.html#New_002darray-Execute-Functions">New-array Execute Functions</a>. | |
100 </p> | |
101 <p><code>fftw_execute</code> (and equivalents) is the only function in FFTW | |
102 guaranteed to be thread-safe; see <a href="Thread-safety.html#Thread-safety">Thread safety</a>. | |
103 </p> | |
104 <p>This function: | |
105 </p><div class="example"> | |
106 <pre class="example">void fftw_destroy_plan(fftw_plan plan); | |
107 </pre></div> | |
108 <a name="index-fftw_005fdestroy_005fplan-1"></a> | |
109 <p>deallocates the <code>plan</code> and all its associated data. | |
110 </p> | |
111 <p>FFTW’s planner saves some other persistent data, such as the | |
112 accumulated wisdom and a list of algorithms available in the current | |
113 configuration. If you want to deallocate all of that and reset FFTW | |
114 to the pristine state it was in when you started your program, you can | |
115 call: | |
116 </p> | |
117 <div class="example"> | |
118 <pre class="example">void fftw_cleanup(void); | |
119 </pre></div> | |
120 <a name="index-fftw_005fcleanup"></a> | |
121 | |
122 <p>After calling <code>fftw_cleanup</code>, all existing plans become undefined, | |
123 and you should not attempt to execute them nor to destroy them. You can | |
124 however create and execute/destroy new plans, in which case FFTW starts | |
125 accumulating wisdom information again. | |
126 </p> | |
127 <p><code>fftw_cleanup</code> does not deallocate your plans, however. To prevent | |
128 memory leaks, you must still call <code>fftw_destroy_plan</code> before | |
129 executing <code>fftw_cleanup</code>. | |
130 </p> | |
131 <p>Occasionally, it may useful to know FFTW’s internal “cost” metric | |
132 that it uses to compare plans to one another; this cost is | |
133 proportional to an execution time of the plan, in undocumented units, | |
134 if the plan was created with the <code>FFTW_MEASURE</code> or other | |
135 timing-based options, or alternatively is a heuristic cost function | |
136 for <code>FFTW_ESTIMATE</code> plans. (The cost values of measured and | |
137 estimated plans are not comparable, being in different units. Also, | |
138 costs from different FFTW versions or the same version compiled | |
139 differently may not be in the same units. Plans created from wisdom | |
140 have a cost of 0 since no timing measurement is performed for them. | |
141 Finally, certain problems for which only one top-level algorithm was | |
142 possible may have required no measurements of the cost of the whole | |
143 plan, in which case <code>fftw_cost</code> will also return 0.) The cost | |
144 metric for a given plan is returned by: | |
145 </p> | |
146 <div class="example"> | |
147 <pre class="example">double fftw_cost(const fftw_plan plan); | |
148 </pre></div> | |
149 <a name="index-fftw_005fcost"></a> | |
150 | |
151 <p>The following two routines are provided purely for academic purposes | |
152 (that is, for entertainment). | |
153 </p> | |
154 <div class="example"> | |
155 <pre class="example">void fftw_flops(const fftw_plan plan, | |
156 double *add, double *mul, double *fma); | |
157 </pre></div> | |
158 <a name="index-fftw_005fflops"></a> | |
159 | |
160 <p>Given a <code>plan</code>, set <code>add</code>, <code>mul</code>, and <code>fma</code> to an | |
161 exact count of the number of floating-point additions, multiplications, | |
162 and fused multiply-add operations involved in the plan’s execution. The | |
163 total number of floating-point operations (flops) is <code>add + mul + | |
164 2*fma</code>, or <code>add + mul + fma</code> if the hardware supports fused | |
165 multiply-add instructions (although the number of FMA operations is only | |
166 approximate because of compiler voodoo). (The number of operations | |
167 should be an integer, but we use <code>double</code> to avoid overflowing | |
168 <code>int</code> for large transforms; the arguments are of type <code>double</code> | |
169 even for single and long-double precision versions of FFTW.) | |
170 </p> | |
171 <div class="example"> | |
172 <pre class="example">void fftw_fprint_plan(const fftw_plan plan, FILE *output_file); | |
173 void fftw_print_plan(const fftw_plan plan); | |
174 char *fftw_sprint_plan(const fftw_plan plan); | |
175 </pre></div> | |
176 <a name="index-fftw_005ffprint_005fplan"></a> | |
177 <a name="index-fftw_005fprint_005fplan"></a> | |
178 | |
179 <p>This outputs a “nerd-readable” representation of the <code>plan</code> to | |
180 the given file, to <code>stdout</code>, or two a newly allocated | |
181 NUL-terminated string (which the caller is responsible for deallocating | |
182 with <code>free</code>), respectively. | |
183 </p> | |
184 <hr> | |
185 <div class="header"> | |
186 <p> | |
187 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> [<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> | |
188 </div> | |
189 | |
190 | |
191 | |
192 </body> | |
193 </html> |