From: Jorge on
Hello,

I'm having some trouble to use FFTw library...

I'm using two plans like this:

fftw_plan fftw_plan_r2r_1d(SIZE_OF_IN, in, out, R2HC, FFTW_FORWARD);

fftw_plan fftw_plan_r2r_1d(2*SIZE_OF_IN +2, out, originalInput, HC2R,
FFTW_BACKWARD);

If i'm not wrong, i should be getting, after executing those two
plans, the same as 'in' array, in 'originalInput'. But all i get is
noise.

What's wrong ???. I know for sure it's something really easy... but i
can't figure it out.....

Thank you!!!

From: Steven G. Johnson on
On Apr 16, 9:26 am, "Jorge" <jleandrope...(a)gmail.com> wrote:
> fftw_plan fftw_plan_r2r_1d(SIZE_OF_IN, in, out, R2HC, FFTW_FORWARD);
>
> fftw_plan fftw_plan_r2r_1d(2*SIZE_OF_IN +2, out, originalInput, HC2R,
> FFTW_BACKWARD);
>
> If i'm not wrong, i should be getting, after executing those two
> plans, the same as 'in' array, in 'originalInput'. But all i get is
> noise.

You should be passing the same size (SIZE_OF_IN) for creating both
plans. This is the order of the transform to be computed, regardless
of the format of the data. Note also that both in[] and out[] should
be arrays of length SIZE_OF_IN.

Regards,
Steven G. Johnson

PS. After you do that, the result should be the original data scaled
by SIZE_OF_IN, since FFTW computes an unnormalized DFT.

From: Hendrik van der Heijden on
Jorge wrote:
> I'm having some trouble to use FFTw library...
>
> fftw_plan fftw_plan_r2r_1d(SIZE_OF_IN, in, out, R2HC, FFTW_FORWARD);
>
> [...] all i get is noise.

Yous should give the FFTW_ESTIMATE flag, otherwise your array
contents may get overwritten by garbage during planning.


Hendrik vdH
From: Jorge on
Thanks you both... but i'm still having trouble. Basically, my code is
like this (simplified,of course)

#define SIZE_OF_IN 32

forward = fftwf_plan_r2r_1d(SIZE_OF_IN, in, out, FFTW_R2HC,
FFTW_FORWARD | FFTW_ESTIMATE );
backwards = fftwf_plan_r2r_1d(SIZE_OF_IN, out, out2, FFTW_HC2R,
FFTW_BACKWARD | FFTW_ESTIMATE );

fftwf_execute(forward);
fftwf_execute(backwards);


I get WAY too much noise. *ANY* idea will be very welcome.

Thanks a lot!!
regards


On 16 abr, 15:23, Hendrik van der Heijden <h...(a)gmx.de> wrote:
> Jorge wrote:
> > I'm having some trouble to use FFTw library...
>
> > fftw_plan fftw_plan_r2r_1d(SIZE_OF_IN, in, out, R2HC, FFTW_FORWARD);
>
> > [...] all i get is noise.
>
> Yous should give the FFTW_ESTIMATE flag, otherwise your array
> contents may get overwritten by garbage during planning.
>
> Hendrik vdH


From: Jorge on
SOLVED !!!!!

"Recall that these transforms are unnormalized, so r2hc followed by
hc2r will result in the original data multiplied by n"....

so... all i had to do is divide every element of 'out2' array (ouput
of forward-backwards) by SIZE_OF_IN.

Thanks!



On 16 abr, 19:01, "Jorge" <jleandrope...(a)gmail.com> wrote:
> Thanks you both... but i'm still having trouble. Basically, my code is
> like this (simplified,of course)
>
> #define SIZE_OF_IN 32
>
> forward = fftwf_plan_r2r_1d(SIZE_OF_IN, in, out, FFTW_R2HC,
> FFTW_FORWARD | FFTW_ESTIMATE );
> backwards = fftwf_plan_r2r_1d(SIZE_OF_IN, out, out2, FFTW_HC2R,
> FFTW_BACKWARD | FFTW_ESTIMATE );
>
> fftwf_execute(forward);
> fftwf_execute(backwards);
>
> I get WAY too much noise. *ANY* idea will be very welcome.
>
> Thanks a lot!!
> regards
>
> On 16 abr, 15:23, Hendrik van der Heijden <h...(a)gmx.de> wrote:
>
>
>
> > Jorge wrote:
> > > I'm having some trouble to use FFTw library...
>
> > > fftw_plan fftw_plan_r2r_1d(SIZE_OF_IN, in, out, R2HC, FFTW_FORWARD);
>
> > > [...] all i get is noise.
>
> > Yous should give the FFTW_ESTIMATE flag, otherwise your array
> > contents may get overwritten by garbage during planning.
>
> > Hendrik vdH- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -