Reply by Steven G. Johnson●September 10, 20092009-09-10
On Sep 9, 2:17�am, "chiraag" <sinara...@gmail.com> wrote:
> I am relatively new to usingFFTW.. I have been usingFFTWto take fft for
> a few complex matrices. My problem is that I am not gettign the same values
> in Matlab and C++, the values seem to be differing after the sixth or
> seventh significant bit.
The sixth significand "bit"? That would be a huge error. Do you mean
the sixth or seventh significant decimal digit? Although even that
would be a huge error.
Both Matlab (which uses FFTW) and FFTW are double precision in the
ordinary interface, and normally they should differ only in the
14th-15th significant decimal digit. If you are getting much bigger
differences than this then you are probably calling one or the other
incorrectly.
> When we use fftw_plan are we using double
> precision by default or do we have to use fftwl_plan[so on for all thefftw
> calls]?? I have been trying to use fftwl_plan, but my code seems to get
> hung. The error that i get is Unhanded exception in the libfftw3l.dll.
fftw_* is double precision, fftwf_* is single precision, and fftwl_*
is long double precision. This is documented in the FFTW manual in
the section titled (not surprisingly) "Precision":
http://fftw.org/doc/Precision.html
However, you may have trouble with fftwl_* on Windows because
Microsoft Visual C++ does not support extended precision. In Visual C+
+, "long double" is the same as double. The libfftw3l library from
the FFTW site, on the other hand, was compiled with gcc which does
support extended precision, so you can only use it with other
compilers that support extended precision (gcc or the Intel
compiler). This is probably why it hangs if you try to call the
fftwl_* functions, because you are passing data of the wrong size.
See also:
http://en.wikipedia.org/wiki/Long_double
In any case, it is unlikely that you need long double -- double should
be enough for almost any application. Even for an extremely large
FFT, the accumulation of roundoff errors in FFTW (and other floating-
point FFTs) is extremely slow, so usually you will get nearly machine
precision. See fftw.org/accuracy
Regards,
Steven G. Johnson
Reply by Dale Dalrymple●September 10, 20092009-09-10
On Sep 8, 11:17 pm, "chiraag" <sinara...@gmail.com> wrote:
> Hi all,
>...
> 2.What other factors should I be considering inorder to make my values in
> matlab and C++ the same??
>
Exactly what calls are you making and how are you comparing the
results?
Dale B. Dalrymple
Reply by Paul Russell●September 10, 20092009-09-10
chiraag wrote:
> Hi all,
>
> I am relatively new to using FFTW.. I have been using FFTW to take fft for
> a few complex matrices. My problem is that I am not gettign the same values
> in Matlab and C++, the values seem to be differing after the sixth or
> seventh significant bit. When we use fftw_plan are we using double
> precision by default or do we have to use fftwl_plan[so on for all the fftw
> calls]?? I have been trying to use fftwl_plan, but my code seems to get
> hung. The error that i get is Unhanded exception in the libfftw3l.dll.
>
> 1.Can someone tell me the default precision used in FFTW??
> 2.What other factors should I be considering inorder to make my values in
> matlab and C++ the same??
>
> Thank you in advance.
>
Default precision for FFTW is double. You have to explicitly build a
single precision version if you want to work with floats. I don't know
off-hand if FFTW supoorts long double precision but I would imagine that
this kind of thing is covvered in the documentation.
Paul
Reply by chiraag●September 9, 20092009-09-09
>Hi all,
>
>I am relatively new to using FFTW.. I have been using FFTW to take fft
for
>a few complex matrices. My problem is that I am not gettign the same
values
>in Matlab and C++, the values seem to be differing after the sixth or
>seventh significant bit. When we use fftw_plan are we using double
>precision by default or do we have to use fftwl_plan[so on for all the
fftw
>calls]?? I have been trying to use fftwl_plan, but my code seems to get
>hung. The error that i get is Unhanded exception in the libfftw3l.dll.
>
>1.Can someone tell me the default precision used in FFTW??
>2.What other factors should I be considering inorder to make my values
in
>matlab and C++ the same??
>
>Thank you in advance.
>
>Hi all,
I am trying to use long double precision...I have issues when i run
libfftw3l.dll.. I cannot seem to understand what else could have gone wrong
for the values in Matlab and C++ to differ. This seems to happen only for
huge complex matrices. Could someone please help me with this problem of
mine. I have been with this problem for quite a while now..
thank you.
Reply by chiraag●September 9, 20092009-09-09
Hi all,
I am relatively new to using FFTW.. I have been using FFTW to take fft for
a few complex matrices. My problem is that I am not gettign the same values
in Matlab and C++, the values seem to be differing after the sixth or
seventh significant bit. When we use fftw_plan are we using double
precision by default or do we have to use fftwl_plan[so on for all the fftw
calls]?? I have been trying to use fftwl_plan, but my code seems to get
hung. The error that i get is Unhanded exception in the libfftw3l.dll.
1.Can someone tell me the default precision used in FFTW??
2.What other factors should I be considering inorder to make my values in
matlab and C++ the same??
Thank you in advance.