d@0: d@0: d@0: Using Plans - FFTW 3.2.1 d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0:
d@0:

d@0: d@0: Next: , d@0: Previous: Data Types and Files, d@0: Up: FFTW Reference d@0:


d@0:
d@0: d@0:

4.2 Using Plans

d@0: d@0:

Plans for all transform types in FFTW are stored as type d@0: fftw_plan (an opaque pointer type), and are created by one of the d@0: various planning routines described in the following sections. d@0: An fftw_plan contains all information necessary to compute the d@0: transform, including the pointers to the input and output arrays. d@0: d@0:

     void fftw_execute(const fftw_plan plan);
d@0: 
d@0:

d@0: This executes the plan, to compute the corresponding transform on d@0: the arrays for which it was planned (which must still exist). The plan d@0: is not modified, and fftw_execute can be called as many times as d@0: desired. d@0: d@0:

To apply a given plan to a different array, you can use the new-array execute d@0: interface. See New-array Execute Functions. d@0: d@0:

fftw_execute (and equivalents) is the only function in FFTW d@0: guaranteed to be thread-safe; see Thread safety. d@0: d@0:

This function: d@0:

     void fftw_destroy_plan(fftw_plan plan);
d@0: 
d@0:

deallocates the plan and all its associated data. d@0: d@0:

FFTW's planner saves some other persistent data, such as the d@0: accumulated wisdom and a list of algorithms available in the current d@0: configuration. If you want to deallocate all of that and reset FFTW d@0: to the pristine state it was in when you started your program, you can d@0: call: d@0: d@0:

     void fftw_cleanup(void);
d@0: 
d@0:

d@0: After calling fftw_cleanup, all existing plans become undefined, d@0: and you should not attempt to execute them nor to destroy them. You can d@0: however create and execute/destroy new plans, in which case FFTW starts d@0: accumulating wisdom information again. d@0: d@0:

fftw_cleanup does not deallocate your plans; you should still d@0: call fftw_destroy_plan for this purpose. d@0: d@0:

The following two routines are provided purely for academic purposes d@0: (that is, for entertainment). d@0: d@0:

     void fftw_flops(const fftw_plan plan,
d@0:                      double *add, double *mul, double *fma);
d@0: 
d@0:

d@0: Given a plan, set add, mul, and fma to an d@0: exact count of the number of floating-point additions, multiplications, d@0: and fused multiply-add operations involved in the plan's execution. The d@0: total number of floating-point operations (flops) is add + mul + d@0: 2*fma, or add + mul + fma if the hardware supports fused d@0: multiply-add instructions (although the number of FMA operations is only d@0: approximate because of compiler voodoo). (The number of operations d@0: should be an integer, but we use double to avoid overflowing d@0: int for large transforms; the arguments are of type double d@0: even for single and long-double precision versions of FFTW.) d@0: d@0:

     void fftw_fprint_plan(const fftw_plan plan, FILE *output_file);
d@0:      void fftw_print_plan(const fftw_plan plan);
d@0: 
d@0:

d@0: This outputs a “nerd-readable” representation of the plan to d@0: the given file or to stdout, respectively. d@0: d@0: d@0: d@0: