annotate src/fftw-3.3.8/doc/html/Using-Plans.html @ 167:bd3cc4d1df30

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