Re: FFTW versus NRC FFT
- From: stevenj@xxxxxxxxxxxx
- Date: 4 Jan 2007 12:57:40 -0800
stevenj@xxxxxxxxxxxx wrote:
In particular, if I remember correctly, the "sinft" transform that NRC
introduces corresponds to the type-I DST, or RODFT00 in FFTW (as
defined by the above link). In your code, however, you are calling
RODFT10, corresponding to a type-II DST.
Another thing to watch out for is that there is a difference in the
definition of "n" in Numerical Recipes compared to FFTW for RODFT00.
In Numerical Recipes, the input to sinft(y, n) is an array y[1...n] of
length n. However, y[1] is set to zero in the routine --- that is, the
input contains a "superfluous" value corresponding to the zeroth input
of the odd-symmetry DFT (this input is always zero for an odd
function).
In FFTW, the input to RODFT00 (DST-I) does not contain this superfluous
zero input..i.e., it corresponds to the NR input starting at y[2].
FFTW's arrays are also zero-based. Thus, FFTW calls corresponding to
to Numerical Recipes' sinft(y, n) should be:
fftw_plan plan = fftw_plan_r2r_1d(n-1, y-2, y-2, RODFT00,
FFTW_ESTIMATE);
fftw_execute(plan);
Note the n-1 to give the number of (non-zero) inputs, and the y-2 to
give a zero-based array starting at y[2]. Note also that FFTW's
normalization differs by an overall scale factor of 2 from Numerical
Recipes'.
Regards,
Steven G. Johnson
.
- Follow-Ups:
- Re: FFTW versus NRC FFT
- From: Bruce Scott TOK
- Re: FFTW versus NRC FFT
- References:
- FFTW versus NRC FFT
- From: Blacky
- Re: FFTW versus NRC FFT
- From: stevenj
- FFTW versus NRC FFT
- Prev by Date: Tutoring & Homework Help
- Next by Date: Re: composite numerical analysis formula again..
- Previous by thread: Re: FFTW versus NRC FFT
- Next by thread: Re: FFTW versus NRC FFT
- Index(es):
Relevant Pages
|