26#if defined (HAVE_CONFIG_H)
33#if defined (HAVE_FFTW3_H)
144#if defined (HAVE_FFTW)
146 int nargin = args.length ();
148 if (nargin < 1 || nargin > 2)
153 std::string arg0 = args(0).
xstring_value (
"fftw: first argument must be a string");
155 if (arg0 ==
"planner")
160 std::transform (arg0.begin (), arg0.end (), arg0.begin (), tolower);
162 std::string arg1 = args(1).xstring_value (
"fftw: METHOD must be a string");
164 std::transform (arg1.begin (), arg1.end (), arg1.begin (), tolower);
165 fftw_planner::FftwMethod meth
166 = fftw_planner::UNKNOWN;
167 float_fftw_planner::FftwMethod methf
168 = float_fftw_planner::UNKNOWN;
170 if (arg1 ==
"estimate")
172 meth = fftw_planner::ESTIMATE;
173 methf = float_fftw_planner::ESTIMATE;
175 else if (arg1 ==
"measure")
177 meth = fftw_planner::MEASURE;
178 methf = float_fftw_planner::MEASURE;
180 else if (arg1 ==
"patient")
182 meth = fftw_planner::PATIENT;
183 methf = float_fftw_planner::PATIENT;
185 else if (arg1 ==
"exhaustive")
187 meth = fftw_planner::EXHAUSTIVE;
188 methf = float_fftw_planner::EXHAUSTIVE;
190 else if (arg1 ==
"hybrid")
192 meth = fftw_planner::HYBRID;
193 methf = float_fftw_planner::HYBRID;
196 error (
"fftw: unrecognized planner METHOD");
198 meth = fftw_planner::method (meth);
199 float_fftw_planner::method (methf);
201 if (meth == fftw_planner::MEASURE)
203 else if (meth == fftw_planner::PATIENT)
205 else if (meth == fftw_planner::EXHAUSTIVE)
207 else if (meth == fftw_planner::HYBRID)
214 fftw_planner::FftwMethod meth
215 = fftw_planner::method ();
217 if (meth == fftw_planner::MEASURE)
219 else if (meth == fftw_planner::PATIENT)
221 else if (meth == fftw_planner::EXHAUSTIVE)
223 else if (meth == fftw_planner::HYBRID)
229 else if (arg0 ==
"dwisdom")
237 std::string arg1 = args(1).xstring_value (
"fftw: WISDOM must be a string");
239 char *str = fftw_export_wisdom_to_string ();
241 error (
"fftw: could not get current FFTW wisdom");
243 std::string wisdom_str (str);
246 if (arg1.length () < 1)
247 fftw_forget_wisdom ();
248 else if (! fftw_import_wisdom_from_string (arg1.c_str ()))
249 error (
"fftw: could not import supplied WISDOM");
255 char *str = fftw_export_wisdom_to_string ();
257 error (
"fftw: could not get current FFTW wisdom");
259 std::string wisdom_str (str);
264 else if (arg0 ==
"swisdom")
273 std::string arg1 = args(1).xstring_value (
"fftw: WISDOM must be a string");
275 char *str = fftwf_export_wisdom_to_string ();
277 error (
"fftw: could not get current FFTW wisdom");
279 std::string wisdom_str (str);
282 if (arg1.length () < 1)
283 fftwf_forget_wisdom ();
284 else if (! fftwf_import_wisdom_from_string (arg1.c_str ()))
285 error (
"fftw: could not import supplied WISDOM");
291 char *str = fftwf_export_wisdom_to_string ();
293 error (
"fftw: could not get current FFTW wisdom");
295 std::string wisdom_str (str);
300 else if (arg0 ==
"threads")
304 if (! args(1).is_real_scalar ())
305 error (
"fftw: setting threads needs one integer argument");
307 int nthreads = args(1).int_value();
309 error (
"fftw: number of threads must be >=1");
311#if defined (HAVE_FFTW3_THREADS)
312 fftw_planner::threads (nthreads);
316#if defined (HAVE_FFTW3F_THREADS)
317 float_fftw_planner::threads (nthreads);
323#if defined (HAVE_FFTW3_THREADS)
330 error (
"fftw: unrecognized argument");
336 octave_unused_parameter (args);
OCTINTERP_API std::string xstring_value(const char *fmt,...) const
#define DEFUN_DLD(name, args_name, nargout_name, doc)
Macro to define an at run time dynamically loadable builtin function.
OCTINTERP_API void print_usage(void)
void error(const char *fmt,...)
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
ColumnVector transform(const Matrix &m, double x, double y, double z)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))