octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #64733] IFFT returns wrong data for dNDArray i


From: Hg200
Subject: [Octave-bug-tracker] [bug #64733] IFFT returns wrong data for dNDArray input
Date: Mon, 2 Oct 2023 14:02:53 -0400 (EDT)

Follow-up Comment #6, bug #64733 (project octave):

Okay i have just finished testing the first patch
"bug64733-fft-planner-inplace.patch". I haven't checked the second patch yet.
I will do this afterwards, but here is an intermediate result.

Seems everything to be correct. There is only one question for the case "R2C +
MEASURE + Inplace Transform". The FFTW documentation is not very specific for
R2C but it states that inplace transform is possible for R2C. You run the
planner with the input pointing to "itmp" and the output pointing to "otmp".
However, since this is an Inplace Transform case, I suspect "in" and "out"
should point to the same address. In this case, it probably needs to be the
address for the complex output buffer array "otmp", since the data will
inflate (get larger due to the conversion from real to complex) during the
transform. I had to modify some Octave code to test this case, but it seems to
work. The code is executed correctly and it gives the correct result. Any
comments on this?

OCTAVE_LOCAL_BUFFER (Complex, otmp, nn * howmany + 32);
otmp = reinterpret_cast<Complex *>
       (((reinterpret_cast<std::ptrdiff_t> (otmp) + 15) & ~ 0xF) +
       ((reinterpret_cast<std::ptrdiff_t> (out)) & 0xF));
*cur_plan_p
     = fftw_plan_many_dft_r2c (rank, tmp, howmany, reinterpret_cast<double *>
(otmp),
                               nullptr, stride, dist,
                               reinterpret_cast<fftw_complex *> (otmp),
                               nullptr, stride, dist, plan_flags);

Maybe it is also helpful to rename "plan_destroys_in" to
"plan_destroys_arrays" or s.th. similar.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64733>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]