-
-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Real-data in-place Fast Fourier Transform using FFTW3. #1185
Conversation
And the FindFFTW3 script, etc. The FFTW3 available precisions are detected and associated macro are defined: WITH_FFTW3_FLOAT, WITH_FFTW3_DOUBLE and WITH_FFTW3_LONG. Threaded FFTW3 is also checked.
Looks so cool ! |
😎 |
But should be a static member (test).
|
I'm having an issue with this simple example: https://gist.github.com/dcoeurjo/4209b140b0e5d7ba290b48dc356d507e (just adding uniform samples and computing the spatial integral contained in the (0,0,0) of the spectrum). Here is my output:
any idea ? |
BTW, would it be possible you add a documentation (new module Dox) ? |
About your error, I think that you do not have (or my cmake script does not find) the fftw3 library for double precision. The libraries name are as follow:
Check your cmake variable It is related to the However, I will see how to display a more explicit message when someone use a precision that is not installed. Concerning your example, I suggest your to initialize the spatial image since RealFFT doesn't do it for you (to avoid unnecessary performance penalty). An efficient way to do this is: Finally, it is already planned to make a module documentation dedicated to this class (a simple class description will be to short to explain how to use fftw efficiently). |
I have tried to update |
Since most users will probably use RealFFT for only a few transformations and thus ESTIMATE will be faster in that case.
I have added clear messages when using |
@@ -157,6 +157,25 @@ IF(@CGAL_FOUND_DGTAL@) | |||
SET(WITH_CGAL 1) | |||
ENDIF(@CGAL_FOUND_DGTAL@) | |||
|
|||
IF(@FFTW3_FOUND_DGTAL@) | |||
FIND_PACKAGE(FFTW3 REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you have "found" the libraries/includes, you shouldn't retry a FIND_PACKAGE in the DGtalConfig (see MAGICK section or Cairo).
Path are known and are not supposed to change between the DGtal build and the external project you're compiling.
In my system, there is no FindFFTW3.cmake in the cmake module repository so you may need to ship if with DGtal (which is not what you want).
For some deps, we force a FIND_PACKAGE because the package set specific variables..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For short: remove the find, remove the include_directories and that's it :)
Ok... Here is my FFT3W libs:
(default hombrew build). When I instantiate FFTW on and the same for "double" or "float" |
I think it is also related to the So, I see the following alternatives:
What do you think ? |
The easiest way would be to propagate the WITH_FFTW_xxxx defines to the DGtalConfig.cmake (solution 2). |
Hi @rolanddenis I'm planing a release soon. Can we merge this PR (and postpone the moduleRealFFT.dox) ? |
Ok to postpone the module page but I also want to slightly change the interface in order to ease some usages. Should I also postpone it ? |
Maybe let's postpone the new API. This feature is not critical at this point and we can schedule a quick 0.9.3 release. |
@rolanddenis can you please add a changelog entry ? |
Done |
thanks merging. |
PR Description
This adds the
RealFFT
class that features real(spatial) to complex(frequency) forward and backward Discrete Fourier Transform for any dimension, usingFFTW3
library (http://www.fftw.org/).Real to complex transformations allows us to make the transformation in-place in a memory area allocated by fftw3. This memory area is accessible through a real
ArrayImageAdapter
for the spatial image, and a complexArrayImageAdapter
for the frequency image.The class also features:
pthread
(appropriate fftw3 initialization is needed, see http://www.fftw.org/fftw3_doc/Usage-of-Multi_002dthreaded-FFTW.html#Usage-of-Multi_002dthreaded-FFTW).Future plans: classes to make convolutions and to apply diffusion operator on an image.
Checklist
Documentation module page added or updated.Small benchmark of the various planner algorithms (as an example of the importance of this choice).cmake
mode (otherwise, Travis C.I. will fail).