32
32
Section 3. Using FFTW
33
33
Q3.1 FFTW seems really slow.
34
Q3.2 FFTW gives results different from my old FFT.
35
Q3.3 Can I save FFTW's plans?
36
Q3.4 Why does your inverse transform return a scaled result?
37
Q3.5 How can I make FFTW put the origin (zero frequency) at the center
38
Q3.6 How do I FFT an image/audio file in *foobar* format?
39
Q3.7 My program does not link (on Unix).
34
Q3.2 FFTW slows down after repeated calls.
35
Q3.3 An FFTW routine is crashing when I call it.
36
Q3.4 My Fortran program crashes when calling FFTW.
37
Q3.5 FFTW gives results different from my old FFT.
38
Q3.6 Your in-place transform gives incorrect results.
39
Q3.7 Can I save FFTW's plans?
40
Q3.8 Why does your inverse transform return a scaled result?
41
Q3.9 How can I make FFTW put the origin (zero frequency) at the center
42
Q3.10 How do I FFT an image/audio file in *foobar* format?
43
Q3.11 My program does not link (on Unix).
44
Q3.12 My program crashes, complaining about stack space.
41
46
Section 4. Internals of FFTW
42
47
Q4.1 How does FFTW work?
55
60
Q5.8 FFTW 2.1.1's MPI test programs crash with MPICH.
56
61
Q5.9 FFTW 2.1.2's multi-threaded transforms don't work on AIX.
57
62
Q5.10 FFTW 2.1.2's complex transforms give incorrect results for large p
63
Q5.11 FFTW 2.1.3 crashes on AIX
59
65
===============================================================================
157
163
successful compilations of FFTW using Borland's C/C++ compilers on
166
The Portland Group PGCC compiler, version 4.0 for Linux/x86, reportedly
167
produces incorrect code for FFTW 2.1.3.
160
169
Visual C++ 4.0 crashes when compiling FFTW 1.2 with all optimizations
161
170
turned on. Visual C++ 5.0 reportedly produces incorrect code for the real
162
171
transforms in FFTW 2.x when the option "Maximize speed" is set. We are
174
183
-xO5 option in Sun's SC4.0 C compiler. egcs 1.0.2 produced incorrect code
175
184
for FFTW on the PowerPC (corrected in egcs 1.1).
186
The DEC C compiler, V5.8-009 on Digital UNIX V4.0 (Rev. 1091) is known to
187
have bugs with its EV6 tuning. Specifically, compiling FFTW with -arch
188
host (the default) or -arch ev6 on an Alpha EV6 can cause FFTW (e.g.
189
fftw_test -s 256) to crash.
177
191
-------------------------------------------------------------------------------
179
193
Question 2.4. FFTW does not compile on Solaris, complaining about const.
227
241
code, documented in the FFTW manual, is included with FFTW (versions 1.3
244
By default, FFTW configures its wrapper routines to work with the first
245
compiler it finds, e.g. g77. To configure for a different, incompatible
246
Fortran compiler foobar, use ./configure F77=foobar when installing FFTW.
230
248
-------------------------------------------------------------------------------
232
250
Question 2.7. Can I call FFTW from C++?
253
271
Section 3. Using FFTW
255
273
Q3.1 FFTW seems really slow.
256
Q3.2 FFTW gives results different from my old FFT.
257
Q3.3 Can I save FFTW's plans?
258
Q3.4 Why does your inverse transform return a scaled result?
259
Q3.5 How can I make FFTW put the origin (zero frequency) at the center
260
Q3.6 How do I FFT an image/audio file in *foobar* format?
261
Q3.7 My program does not link (on Unix).
274
Q3.2 FFTW slows down after repeated calls.
275
Q3.3 An FFTW routine is crashing when I call it.
276
Q3.4 My Fortran program crashes when calling FFTW.
277
Q3.5 FFTW gives results different from my old FFT.
278
Q3.6 Your in-place transform gives incorrect results.
279
Q3.7 Can I save FFTW's plans?
280
Q3.8 Why does your inverse transform return a scaled result?
281
Q3.9 How can I make FFTW put the origin (zero frequency) at the center
282
Q3.10 How do I FFT an image/audio file in *foobar* format?
283
Q3.11 My program does not link (on Unix).
284
Q3.12 My program crashes, complaining about stack space.
263
286
-------------------------------------------------------------------------------
275
298
is significant, you have two options. First, you can use the
276
299
FFTW_ESTIMATE option in the planner, which uses heuristics instead of
277
300
runtime measurements and produces a good plan in a short time. Second,
278
you can use the wisdom feature to precompute the plan; see Q3.3 `Can I
301
you can use the wisdom feature to precompute the plan; see Q3.7 `Can I
279
302
save FFTW's plans?'
281
304
-------------------------------------------------------------------------------
283
Question 3.2. FFTW gives results different from my old FFT.
306
Question 3.2. FFTW slows down after repeated calls.
308
Probably, NaNs or similar are creeping into your data, and the slowdown is
309
due to the resulting floating-point exceptions. For example, be aware
310
that repeatedly FFTing the same array is a diverging process (because FFTW
311
computes the unnormalized transform).
313
-------------------------------------------------------------------------------
315
Question 3.3. An FFTW routine is crashing when I call it.
317
You almost certainly have a bug in your code. For example, you could be
318
passing invalid arguments (such as wrongly-sized arrays) to FFTW, or you
319
could simply have memory corruption elsewhere in your program that causes
320
random crashes later on. Learn to debug, and don't complain to us unless
321
you can come up with a minimal program (preferably under 30 lines) that
322
illustrates the problem.
324
-------------------------------------------------------------------------------
326
Question 3.4. My Fortran program crashes when calling FFTW.
328
As described in the manual, on 64-bit machines you must store the plans in
329
variables large enough to hold a pointer, for example integer*8.
331
-------------------------------------------------------------------------------
333
Question 3.5. FFTW gives results different from my old FFT.
285
335
People follow many different conventions for the DFT, and you should be
286
336
sure to know the ones that we use (described in the FFTW manual). In
291
341
You should also know that we compute an unnormalized transform. In
292
342
contrast, Matlab is an example of program that computes a normalized
293
transform. See Q3.4 `Why does your inverse transform return a scaled
343
transform. See Q3.8 `Why does your inverse transform return a scaled
296
-------------------------------------------------------------------------------
298
Question 3.3. Can I save FFTW's plans?
346
Finally, note that floating-point arithmetic is not exact, so different
347
FFT algorithms will give slightly different results (on the order of the
348
numerical accuracy; typically a fractional difference of 1e-15 or so).
350
-------------------------------------------------------------------------------
352
Question 3.6. Your in-place transform gives incorrect results.
354
As described in the FFTW manual, the output array argument has a special
355
meaning for FFTW_INPLACE transforms; you should not pass the input array
358
-------------------------------------------------------------------------------
360
Question 3.7. Can I save FFTW's plans?
300
362
Yes. Starting with version 1.2, FFTW provides the wisdom mechanism for
301
363
saving plans. See Q4.3 `What is this wisdom thing?' and the FFTW manual.
303
365
-------------------------------------------------------------------------------
305
Question 3.4. Why does your inverse transform return a scaled result?
367
Question 3.8. Why does your inverse transform return a scaled result?
307
369
Computing the forward transform followed by the backward transform (or
308
370
vice versa) yields the original array scaled by the size of the array.
319
381
-------------------------------------------------------------------------------
321
Question 3.5. How can I make FFTW put the origin (zero frequency) at the center of its output?
383
Question 3.9. How can I make FFTW put the origin (zero frequency) at the center of its output?
323
385
For human viewing of a spectrum, it is often convenient to put the origin
324
386
in frequency space at the center of the output array, rather than in the
331
393
-------------------------------------------------------------------------------
333
Question 3.6. How do I FFT an image/audio file in *foobar* format?
395
Question 3.10. How do I FFT an image/audio file in *foobar* format?
335
397
FFTW performs an FFT on an array of floating-point values. You can
336
398
certainly use it to compute the transform of an image or audio stream, but
340
402
-------------------------------------------------------------------------------
342
Question 3.7. My program does not link (on Unix).
404
Question 3.11. My program does not link (on Unix).
344
406
Please use the exact order in which libraries are specified by the FFTW
345
407
manual (e.g. -lrfftw -lfftw -lm). Also, note that the libraries must be
347
409
*A* uses *B*, then *A* must be listed before *B* in the link command.).
348
410
For example, switching the order to -lfftw -lrfftw -lm will fail.
412
-------------------------------------------------------------------------------
414
Question 3.12. My program crashes, complaining about stack space.
416
You cannot declare large arrays statically; you should use malloc (or
417
equivalent) to allocate the arrays you want to transform if they are
418
larger than a few hundred elements.
350
420
===============================================================================
352
422
Section 4. Internals of FFTW
426
496
Q5.8 FFTW 2.1.1's MPI test programs crash with MPICH.
427
497
Q5.9 FFTW 2.1.2's multi-threaded transforms don't work on AIX.
428
498
Q5.10 FFTW 2.1.2's complex transforms give incorrect results for large p
499
Q5.11 FFTW 2.1.3 crashes on AIX
430
501
-------------------------------------------------------------------------------
508
579
that caused incorrect results for many primes greater than 32768 (on
509
580
32-bit machines). (Sizes without large prime factors are not affected.)
582
-------------------------------------------------------------------------------
584
Question 5.11. FFTW 2.1.3 crashes on AIX
586
The FFTW 2.1.3 configure script picked incorrect compiler flags for the
587
xlc compiler on newer IBM processors. This is fixed in FFTW 2.1.4.