Question

Is it OK to pass NULL instead of array to a FFTW plan routine when using FFTW_ESTIMATE?

The FFTW documentation says:

...Technically, FFTW_ESTIMATE does not touch your arrays...

Of course, this makes sense only when new-array execution functions are used link.

Was it helpful?

Solution

The recommended approach when creating FFTW plans is to create the plan before you fill your input array with data (since the use of FFTW_MEASURE will "touch" your data and might change it). The documentation you quote just says that if you decided not to take the recommended approach and have data stored in the input array before creating the plan, everything should be fine if you FFTW_ESTIMATE.

Indeed, it only makes sense to use a NULL pointer if your are using FFTW_ESTIMATE and, thereafter, fftw_execute_* with valid pointers. Whether FFTW accepts a NULL when creating the plan you can just try and see...I agree that logically it is not needed at the time of planning.

OTHER TIPS

When you create a plan, it looks to see if input and output are different, and adjusts the plan accordingly:

From the docs:

If in == out, the transform is in-place and the input array is overwritten. If in != out, the two arrays must not overlap (but FFTW does not check for this condition).

So you definitely can't pass 2 NULLS if you are not going to transform in-place. And vice-versa.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top