[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] FFT question
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Tue, 16 Feb 2010 02:13:32 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=cM54qsPk7xSESJRjhCvReuvo/wgkxiEaTAWuAuiqGAs=; b=xTZWrT2SqRmRO0eP2cJsAQCYivwivRVnq7rVkIMtCfhdIxhR88dy62pYWtAnc7bj+M uSAAYBift92xYUVJl99r1ojjXhsmY+h9rGMiFbWkNH69d3KMC5GJGz2XSVhKEtmLEsdV 82t5+LdvSUtW9y7NWEbfCTHI78KZsBkwKsmyU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=nSSXFyagvi5wHu84b6gyehkjSIndiBwRC36u4kO/ssqkVy7BbUARrMQ9g77WuKrTnD 4zepxN/bNIT6Fay9XY7cnaU22xM0OD6j3WlnO7olw2ETdE93+GALUbUAjmpwUhKU0Jjw sSHLUw74zhUl4yoaBgxFVQnX4MdorYHR/SYt8=
This has got to be a bug in Eigen (possibly in KissFFT). Indeed,
you're getting a memory error without doing any explicity memory
management yourself.
Could you compile your program with -g3, paste a backtrace (obtained
with GDB), and also valgrind your program,
valgrind ./myprogram
and paste the output here?
Benoit
2010/2/15 Trevor Irons <trevorirons@xxxxxxxxx>:
> Mark and others:
>
> I'm trying to get the KISS FFT working for me, but am struggling a little
> with the Real to Complex and back case. I suspect I'm misusing it somehow, I
> based this off the tests. The Complex to Complex fwd and inv (Full Spectrum)
> are working with similar logic.
>
> The forward operation seems to be accurate, but how do I do the inverse on
> 1/2 spectrum. If I don't remove the flag, I get a lot of errors at runtime
> (compiles fine):
>
> g++ on 64 bit linux
> *** glibc detected *** ./min: free(): invalid next size (normal):
> 0x0000000000da6790 ***
> ======= Backtrace: =========
> /lib/libc.so.6[0x7fc8a700cdd6]
> /lib/libc.so.6(cfree+0x6c)[0x7fc8a701174c]
>
> If I do remove the flag, thinking that maybe since the buffer is double, it
> will know it is a complex to real transform, but the answer is wrong.
>
> If a do a full spectrum all is happy.
>
> What am I doing wrong? If possible I'd like to just use the 1/2 spectrum.
> Thanks for any insight, really glad to have this out of the box like this..
>
> #include "Eigen/Core"
> #include "unsupported/Eigen/FFT"
> #include <complex>
>
> typedef std::complex<double> Complex;
>
> using namespace Eigen;
> using namespace std;
>
> int main() {
>
> FFT<double> fft;
> double dt(1e-3);
>
> VectorXd timeseries(200);
> VectorXcd fd(200);
>
> for (int i=0; i<200; ++i) {
> timeseries[i] = std::sin((double)(i)*dt*95.);
> }
>
> fft.SetFlag(fft.HalfSpectrum );
> fft.fwd(fd, timeseries);
> VectorXd out;
>
> // faults if I don't remove, wrong answer if I do
> fft.ClearFlag(fft.HalfSpectrum );
> fft.inv(out, fd);
>
> for (int i=0; i< out.size(); ++i) {
> cout << timeseries[i] << "\t" << out[i] << endl;
> }
> }
>