39 @deftypefn {Loadable Function} {@var{method} =} fftw (\"planner\")\n\
40 @deftypefnx {Loadable Function} {} fftw (\"planner\", @var{method})\n\
41 @deftypefnx {Loadable Function} {@var{wisdom} =} fftw (\"dwisdom\")\n\
42 @deftypefnx {Loadable Function} {} fftw (\"dwisdom\", @var{wisdom})\n\
43 @deftypefnx {Loadable Function} {} fftw (\"threads\", @var{nthreads})\n\
44 @deftypefnx {Loadable Function} {@var{nthreads} =} fftw (\"threads\")\n\
46 Manage @sc{fftw} wisdom data.\n\
48 Wisdom data can be used to significantly accelerate the calculation of the\n\
49 FFTs, but implies an initial cost in its calculation. When the @sc{fftw}\n\
50 libraries are initialized, they read a system wide wisdom file (typically in\n\
51 @file{/etc/fftw/wisdom}), allowing wisdom to be shared between applications\n\
52 other than Octave. Alternatively, the @code{fftw} function can be used to\n\
53 import wisdom. For example,\n\
56 @var{wisdom} = fftw (\"dwisdom\")\n\
60 will save the existing wisdom used by Octave to the string @var{wisdom}.\n\
61 This string can then be saved to a file and restored using the @code{save}\n\
62 and @code{load} commands respectively. This existing wisdom can be\n\
63 re-imported as follows\n\
66 fftw (\"dwisdom\", @var{wisdom})\n\
69 If @var{wisdom} is an empty string, then the wisdom used is cleared.\n\
71 During the calculation of Fourier transforms further wisdom is generated.\n\
72 The fashion in which this wisdom is generated is also controlled by\n\
73 the @code{fftw} function. There are five different manners in which the\n\
74 wisdom can be treated:\n\
77 @item @qcode{\"estimate\"}\n\
78 Specifies that no run-time measurement of the optimal means of\n\
79 calculating a particular is performed, and a simple heuristic is used\n\
80 to pick a (probably sub-optimal) plan. The advantage of this method is\n\
81 that there is little or no overhead in the generation of the plan, which\n\
82 is appropriate for a Fourier transform that will be calculated once.\n\
84 @item @qcode{\"measure\"}\n\
85 In this case a range of algorithms to perform the transform is considered\n\
86 and the best is selected based on their execution time.\n\
88 @item @qcode{\"patient\"}\n\
89 Similar to @qcode{\"measure\"}, but a wider range of algorithms is\n\
92 @item @qcode{\"exhaustive\"}\n\
93 Like @qcode{\"measure\"}, but all possible algorithms that may be used to\n\
94 treat the transform are considered.\n\
96 @item @qcode{\"hybrid\"}\n\
97 As run-time measurement of the algorithm can be expensive, this is a\n\
98 compromise where @qcode{\"measure\"} is used for transforms up to the size\n\
99 of 8192 and beyond that the @qcode{\"estimate\"} method is used.\n\
102 The default method is @qcode{\"estimate\"}. The current method can\n\
106 @var{method} = fftw (\"planner\")\n\
113 fftw (\"planner\", @var{method})\n\
116 Note that calculated wisdom will be lost when restarting Octave. However,\n\
117 the wisdom data can be reloaded if it is saved to a file as described\n\
118 above. Saved wisdom files should not be used on different platforms since\n\
119 they will not be efficient and the point of calculating the wisdom is lost.\n\
121 The number of threads used for computing the plans and executing the\n\
122 transforms can be set with\n\
125 fftw (\"threads\", @var{NTHREADS})\n\
128 Note that octave must be compiled with multi-threaded @sc{fftw} support for\n\
129 this feature. The number of processors available to the current process is\n\
132 @seealso{fft, ifft, fft2, ifft2, fftn, ifftn}\n\
137 int nargin = args.
length ();
139 if (nargin < 1 || nargin > 2)
145 #if defined (HAVE_FFTW)
146 if (args(0).is_string ())
150 if (arg0 ==
"planner")
154 if (args(1).is_string ())
159 std::string arg1 = args(1).string_value ();
163 arg1.begin (), tolower);
169 if (arg1 ==
"estimate")
174 else if (arg1 ==
"measure")
179 else if (arg1 ==
"patient")
184 else if (arg1 ==
"exhaustive")
189 else if (arg1 ==
"hybrid")
195 error (
"fftw: unrecognized planner METHOD");
216 error (
"fftw: planner expects a string value as METHOD");
235 else if (arg0 ==
"dwisdom")
239 if (args(1).is_string ())
244 std::string arg1 = args(1).string_value ();
247 char *str = fftw_export_wisdom_to_string ();
249 if (arg1.length () < 1)
250 fftw_forget_wisdom ();
251 else if (! fftw_import_wisdom_from_string (arg1.c_str ()))
252 error (
"fftw: could not import supplied WISDOM");
263 char *str = fftw_export_wisdom_to_string ();
268 else if (arg0 ==
"swisdom")
273 if (args(1).is_string ())
278 std::string arg1 = args(1).string_value ();
281 char *str = fftwf_export_wisdom_to_string ();
283 if (arg1.length () < 1)
284 fftwf_forget_wisdom ();
285 else if (! fftwf_import_wisdom_from_string (arg1.c_str ()))
286 error (
"fftw: could not import supplied WISDOM");
297 char *str = fftwf_export_wisdom_to_string ();
302 else if (arg0 ==
"threads")
306 if (args(1).is_real_scalar ())
308 int nthreads = args(1).int_value();
311 #if defined (HAVE_FFTW3_THREADS)
316 #if defined (HAVE_FFTW3F_THREADS)
323 error (
"fftw: number of threads must be >=1");
326 error (
"fftw: setting threads needs one integer argument");
329 #if defined (HAVE_FFTW3_THREADS)
336 error (
"fftw: unrecognized argument");
339 error (
"fftw: unrecognized argument");
OCTINTERP_API void print_usage(void)
void error(const char *fmt,...)
static FftwMethod method(void)
static FftwMethod method(void)
std::string string_value(bool force=false) const
void gripe_disabled_feature(const std::string &func, const std::string &feature, const std::string &pkg)
octave_idx_type length(void) const
ColumnVector transform(const Matrix &m, double x, double y, double z)
#define DEFUN_DLD(name, args_name, nargout_name, doc)
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))