annotate fft/fftw/fftw-3.3.4/doc/html/Using-Plans.html @ 40:223f770b5341 kissfft-double tip

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