/* -*- C -*-
Bug report (July 2004) from Martin Reinecke
< martin (AT) mpa-garching . mpg . de >:
I think I found a bug in the telafft package which can be obtained from
http://www.jjj.de/fft/fftpage.html.
The problem is that for real FFTs of many different lengths the forward
transform is broken because of a mistake during porting from Fortran to C.
The error is in line 1337 of telafft.c, which should read
idij=is-1;
instead of
idij=is;
You can reproduce the bug with the attached small test code.
I know that you are not the original author of this code (I have notified
him as well already), but I just wanted to let you know so you can put a
bug notice on your web page or fix the package as soon as possible, before
more people are bitten by that bug.
Cheers,
Martin
*/
#include "telafft.c"
int main(void)
{
const int maxlength=2000;
double work[4*maxlength+15];
double data[2*maxlength];
int m, length, problem;
for (length=1; length1e-12)
problem=1;
if (problem)
printf ("problem with real transform at length %i\n",length);
cffti(length,work);
for (m=0; m<2*length; ++m)
data[m]=m;
cfftf(length, data, work);
cfftb(length, data, work);
for (m=0; m<2*length; ++m)
data[m]/=length;
problem=0;
for (m=0; m<2*length; ++m)
if (abs(m-data[m])>1e-12)
problem=1;
if (problem)
printf ("problem with complex transform at length %i\n",length);
}
}
/* end of file */