Blitz logo

Blitz Support :

From: Xavier WARIN(Compte LOCAL) - I23 (xavier.warin_at_[hidden])
Date: 2004-09-02 05:52:47


Hi Othmar,

Have you tried the direct way :

#include <complex>
#include <fftw3.h>
#include <blitz/array.h>

using namespace blitz ;

.....

Array< complex< double > , 1 > psi(N) ;

fftw_plan p;

p = fftw_plan_dft_1d(N, reinterpret_cast<fftw_complex*>(psi.data()),
reinterpret_cast<fftw_complex*>(psi_fft.data()), FFTW_FORWARD,
FFTW_MEASURE);

In FFTW manual it is written :
" You can allocate your data in any way that you like, from malloc to
new (in C++) to a static array declaration. If the array happens not to
be properly aligned, FFTW will not use the SIMD extensions. "

Is this simple solution as fast as your special solution on your cases?
That would mean that SIMD extension is activated.

Xavier

Othmar Frey wrote:
> Hi.
>
> I am using (or rather trying to use) the fftw library in combination
> with Blitz++.
>
> I've learned that the arrays of complex data passed to fftw must be
> 16-byte aligned
> to exploit the "Single Instruction Multiple Data" support of fftw.
>
> Is there a way to make a Vector<complex<double> > be 16-byte aligned in
> memory?
>
> Until now, I used the fftw++ wrapper class by John C. Bowman in
> combination with his
> Array class (http://www.math.ualberta.ca/~bowman/Array.h) then created a
> blitz::Vector
> from preexisting memory by passing a pointer to an array of Bowman's
> Array class.
> But I am not that happy with this kind of "solution".
>
> Any suggestions?
>
> Best regards
>
> Othmar
>