Reply by Michel Rouzic May 20, 20052005-05-20
oh damn, yeah, another newbie error. i saw the free'ing thing in the
tutorial but i guess the code example was meant for a main function.
anyways yeah i know it's not where to debug C code but at first i
thought it was some error due to FFT

Reply by May 20, 20052005-05-20
You free the arrays at the end of your function, even though they are
malloc'ed elsewhere.  This is probably wrong; for one thing, it means
that you have no way of accessing the output of your transform outside
your function.  (Note that your code snippet is not self-contained, so
it is impossible for anyone else to evaluate it.)

Anyway, comp.dsp is not really the best forum for helping you to debug
your code.

Reply by Michel Rouzic May 19, 20052005-05-19
ok, i did the make check thing, and it said "FFTW transforms passed
basic tests!"

now, here's the function i use for transforming an array. in and out
arent being malloc'ed because they have already been in the main
function

void dftfunction(double *in, double *out, uint32_t N)
{
	fftw_plan p;
	fftw_r2r_kind kind;

	printf("dftfunction...\n");

	p = fftw_plan_r2r_1d(N, in, out, FFTW_DHT, FFTW_ESTIMATE);

	fftw_execute(p);

	fftw_destroy_plan(p);
	fftw_free(in);
	fftw_free(out);
}

anything wrong with my code?

Reply by Steven G. Johnson May 19, 20052005-05-19
Michel Rouzic wrote:
> I found out something weird today, when computing r2r DFT's with FFTW > 3.0.1 in C, it works with arrays with 4806 elements or more, but stays > stuck into an infinite loop if the array has 4805 elements or less.
You have a bug in your code, most likely. See also the FFTW FAQ: Question 3.5. An FFTW routine is crashing when I call it. Did the FFTW test programs pass (make check, or cd tests; make bigcheck if you want to be paranoid)? If so, you almost certainly have a bug in your own code. For example, you could be passing invalid arguments (such as wrongly-sized arrays) to FFTW, or you could simply have memory corruption elsewhere in your program that causes random crashes later on. Please don't complain to us unless you can come up with a minimal program (preferably under 30 lines) that illustrates the problem.
Reply by Bhaskar Thiagarajan May 19, 20052005-05-19
"Michel Rouzic" <Michel0528@yahoo.fr> wrote in message
news:1116520914.076186.180200@z14g2000cwz.googlegroups.com...
> I found out something weird today, when computing r2r DFT's with FFTW > 3.0.1 in C, it works with arrays with 4806 elements or more, but stays > stuck into an infinite loop if the array has 4805 elements or less. > > Anyone knows where this strange limit is coming from? Or am I the only > one to experience such a bug?
Almost surely just you (or one among few). For one the boundary seems rather odd (pun unintended) and I've used it for 8 point DFTs (if memory serves me right). Cheers Bhaskar
Reply by Michel Rouzic May 19, 20052005-05-19
I found out something weird today, when computing r2r DFT's with FFTW
3.0.1 in C, it works with arrays with 4806 elements or more, but stays
stuck into an infinite loop if the array has 4805 elements or less.

Anyone knows where this strange limit is coming from? Or am I the only
one to experience such a bug?