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

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

[Octave-bug-tracker] [bug #61863] interp2 gives wrong results for comple


From: Christof Kaufmann
Subject: [Octave-bug-tracker] [bug #61863] interp2 gives wrong results for complex matrices
Date: Tue, 25 Jan 2022 11:35:44 -0500 (EST)

Follow-up Comment #12, bug #61863 (project octave):

I set up the tools and prepared the attached patch to fix `interp1()` and
`interp2()` for complex inputs, since both functions are affected by modifying
`__pchip_deriv__()`. I will fix `interpn()` in bug #61907.

Regarding the handling of the complex matrices in `__pchip_deriv__()`, I would
like to hear your opinion. To avoid copies, I used
`reinterpret_cast<T*>(mat.data ())` for the real part and
`reinterpret_cast<T*>(mat.data ()) + 1` for the imaginary part. This seems a
bit hacky, but the standard covers it:
https://en.cppreference.com/w/cpp/numeric/complex#Array-oriented_access

The alternative way would be to split up `ymat` into `ymat_real` and
`ymat_imag` and similarly for `dmat`. The splitting required a copy. So, if
you prefer this, let me know.

(file #52729)
    _______________________________________________________

Additional Item Attachment:

File name: interp1_interp2_complex_fix.patch Size:18 KB
   
<https://file.savannah.gnu.org/file/interp1_interp2_complex_fix.patch?file_id=52729>



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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