Re: [eigen] FFT for Eigen

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Ricard Marxer Piñón wrote:
I have been using fftw as well [1], and by doing so I also end up
copying the data, which is a pity, so I would also very much
appreciate such a module.

There are several tricky points I have been bumping into:

1- If I recall correctly, when creating a plan, you pass it two
pointers (or optionally when done inplace, only one) that have been
allocated by fftw.  This way fftw assures they are aligned, etc.
Maybe there is lower level API fftw which might let you apply plans to
pointers you have allocated on your own, otherwise, I don't know how a
copy could be avoided.
You can reuse the FFTW plan on other buffers rather than those the plan was created for, e.g. via the fftw_execute_dft_r2c There are a few things that need to be the same as in the planning buffers, such as 16 bit alignment (for SIMD) ,and the choice of in-place vs out-of-place FFTs.


2- The complex type matrices in Eigen are still somewhat basic.  I
think they are just a Matrix with data type std::complex (real and
imaginary components are interleaved).  Which for some use cases is
not great.  For example if I am going to do a lot of vector operations
with the real and imaginary part separately, these operations cannot
be easily vectorized (correct me if I'm wrong).  On the other hand it
is true that this storage might be the one used by most external
libraries.
It has been already a long time since I told Benoit I would write a
wiki page for this discussion, but still haven't.  Sorry for that.
This seems like a worthwhile discussion, but one that is orthogonal (no pun intended) to the subject of FFTs. I will say that most (all?) modern FFT routines work with interleaved real,imag components. I agree it would be easier to vectorize some operations if real, imag were stored separately. It is still quite possible to vectorize interleaved complex. Starting with SSE3 , intel introduced SIMD instructions aimed at complex math. The Intel Performance Primitives make good use of these to create some really good complex-by-complex vector math routines. I'm sure AMD has similar stuff in ACML.

-- Mark

P.S. The question of "why not just use FFTW?" has come up in this discussion. FFTW is GPL, not LGPL. It is incompatible with the Eigen dual license.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/