Sign in

username:

password:



Not a member?

Search compdsp



Search tips

comp.dsp by Keywords

Adaptive Filter | ADPCM | ADSP | ADSP-2181 | Aliasing | AMR | Anti-Aliasing | ARMA | Autocorrelation | AutoCovariance | Beamforming | Bessel | Blackfin | Butterworth | C6713 | CCS | Chebyshev | CIC Filter | Circular Convolution | Code Composer Studio | Comb Filter | Compression | Convolution | Cross Correlation | DCT | Decimation | Deconvolution | Demodulation | DM642 | DSP Boards | DSP/BIOS | DTMF | Echo Cancellation | Equalization | Equalizer | ETSI | EZLITE (Ez-kit Lite) | FFT | FFTW | FIR Filter | Fixed Point | FSK | G.711 | G.723 | G.729 | Gaussian Noise | Goertzel | GPIO | Hilbert Transform | IFFT | IIR Filter | Interpolation | Invariance | JTAG | Kalman | Laplace Transform | Levinson | LPC | McBSP | MIPS | Modulation | MPEG | Multirate | Notch Filter | Nyquist | OFDM | Oversampling | Pink Noise | Pitch | PLL | Polyphase | QAM | QDMA | Quantization | Quantizer | Radar | Random Noise | Reed Solomon | Remez | Resampling | RTDX | Sampling | Sharc | TI C6711 | Undersampling | Viterbi | Wavelets | White Noise | Wiener Filter | Windowing | XDS510PP | Z Transform

Sponsor

Industry's highest performing at the lowest power DSPs now as low as $5.00*
Start development today!
*volume pricing for 10ku

Discussion Groups

Free Online Books

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | Comp.DSP | Double precision in FFTW

There are 5 messages in this thread.

You are currently looking at messages 0 to 5.


Double precision in FFTW - chiraag - 2009-09-09 02:17:00

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.

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Double precision in FFTW - chiraag - 2009-09-09 02:47:00



>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.
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Double precision in FFTW - Paul Russell - 2009-09-10 04:38:00

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
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Double precision in FFTW - Dale Dalrymple - 2009-09-10 05:58:00

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

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Double precision in FFTW - Steven G. Johnson - 2009-09-10 15:07:00

On Sep 9, 2:17=A0am, "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 valu=
es
> 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 thefft=
w
> 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
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.