mr_jnrdve
mr_jnrdve

Reputation: 21

fftw3 floating point FFT yields only zeros

I want to use FFTW3 with FP32 precision for a R2C FFT. I reconfigured the library with ./configure --enable-float --enable-type-prefix, then make and make install. Then I linked with -L/path/to/fftw_f/.libs/ -lfftw3f -lm and changed all used function prefixes to fftwf_. Here is the code snipped I'm using:

#include "path/to/fftw3/api/fftw3.h"
typedef std::complex<float> complexf;

int N0 = some_int;
size_t N1 = some_int2;
float *input = input_data_array;
complexf *out = (complexf *) fftwf_malloc(sizeof(complexf) * size_of_output);


fftwf_plan plan;
plan = fftwf_plan_dft_r2c_2d(N0, N1, input, reinterpret_cast<fftwf_complex *>(&out), FFTW_ESTIMATE);
fftwf_execute(plan);
fftwf_destroy_plan(plan);

Somehow this does just yield zeros in the output, which is not correct when comparing it to working FFTW3 FP64 version of the algorithm.

I already checked that the input is casted correctly to FP32. Is there anything else I'm missing? Thanks in advance!

Upvotes: 0

Views: 72

Answers (0)

Related Questions