bugGNU Octave - Bugs: bug #61907, interpn gives wrong results for...

 
 

bug #61907: interpn gives wrong results for complex matrices

Submitted by:  Christof Kaufmann <christofkaufmann>
Submitted on:  Mon 24 Jan 2022 11:04:02 AM UTC
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

( Jump to the original submission )

Sun 30 Jan 2022 10:13:07 PM UTC, comment #8: 

Looks good.  Marking as Fixed and closing report.

Rik <rik5>
Project Administrator
Sun 30 Jan 2022 11:59:26 AM UTC, comment #7: 

Pushed the C++ code fix to the default branch here:
https://hg.savannah.gnu.org/hgweb/octave/rev/d1fe2cb16d95

Marking as ready for test.

Markus Mützel <mmuetzel>
Project Member
Sat 29 Jan 2022 06:00:51 AM UTC, comment #6: 

Thanks!

Christof Kaufmann <christofkaufmann>
Fri 28 Jan 2022 06:15:28 PM UTC, comment #5: 

I pushed your .m file fix to the stable branch here:
https://hg.savannah.gnu.org/hgweb/octave/rev/92cda11fb171

I'll try to review the "proper" fix during the weekend.

Markus Mützel <mmuetzel>
Project Member
Thu 27 Jan 2022 08:43:00 PM UTC, comment #4: 

I rebased both patches:

  • interpn_workaround_complex4.patch
    • This is rebased onto stable, since I assume you want to apply it there.
    • This m-file patch is a simple fix, easy to review.
  • Then you probably want to merge stable into default.
  • interpn_fix_complex5.patch
    • This is rebased onto the above patch. Unfortunately it is still on the stable branch, although you want to apply it on the default branch, I guess. Would there have been any better way of exporting it?
    • It fixes _lin_interpn_ and removes the corresponding part of the m-file patch again.

(file #52761, file #52762)

Christof Kaufmann <christofkaufmann>
Thu 27 Jan 2022 02:37:57 PM UTC, comment #3: 

Here an updated patch with prepended asterisk in front of the bug id of the test.

(file #52751)

Christof Kaufmann <christofkaufmann>
Wed 26 Jan 2022 01:51:20 PM UTC, comment #2: 

Following the discussion in #bug 61863, I made a new patch. It fixes `interpn()` (proper NA value) and `__lin_interpn__()` (do not ignore imaginary part and also use proper NA value).

(file #52743)

Christof Kaufmann <christofkaufmann>
Mon 24 Jan 2022 11:11:40 AM UTC, comment #1: 

Sorry, missed the wrong file path in the patch. Again the same patch, but with correct file path attached.

(file #52716)

Christof Kaufmann <christofkaufmann>
Mon 24 Jan 2022 11:04:02 AM UTC, original submission:  

Interpolating complex matrices gives a default extrapolation value of NA + 0i instead of NA + NAi. Example:

interpn (i*eye(2), 1, 0:1, "nearest")
ans =

    NA +   0i     0 +   1i

Additionally "linear" ignores the imaginary part:

interpn (i*eye(2), 1, 0:1, "linear")
ans =

    NA     0

The appended patch fixes interpn for complex matrices.

Christof Kaufmann <christofkaufmann>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #52761:  interpn_workaround_complex4.patch added by christofkaufmann (2KiB - text/x-patch - Fix interpn for complex matrices - v4/v5 (rebased onto stable))
file #52762:  interpn_fix_complex5.patch added by christofkaufmann (6KiB - text/x-patch - Fix interpn for complex matrices - v4/v5 (rebased onto stable))
file #52751:  interpn_fix_complex3.patch added by christofkaufmann (7KiB - text/x-patch - Fix interpn for complex matrices - v3 (now with asterisk))
file #52743:  interpn_fix_complex2.patch added by christofkaufmann (7KiB - text/x-patch - Fix interpn for complex matrices - v2 (fix also C++ code for linear interpolation))
file #52716:  interpn_fix_complex1.diff added by christofkaufmann (2KiB - text/x-patch - Fix interpn for complex matrices - v1 (with correct file path))
file #52715:  interpn_fix_complex1.diff added by christofkaufmann (2KiB - text/x-patch - Fix interpn for complex matrices - v1)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by christofkaufmann (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

     

     

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-01-30 rik5 StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2022-01-30 mmuetzel StatusIn Progress => Ready For Test
    2022-01-28 mmuetzel StatusNone => In Progress
    2022-01-27 christofkaufmann Attached File- => Added interpn_workaround_complex4.patch, #52761
        Attached File- => Added interpn_fix_complex5.patch, #52762
    2022-01-27 christofkaufmann Attached File- => Added interpn_fix_complex3.patch, #52751
    2022-01-26 christofkaufmann Attached File- => Added interpn_fix_complex2.patch, #52743
    2022-01-24 christofkaufmann Attached File- => Added interpn_fix_complex1.diff, #52716
    2022-01-24 christofkaufmann Attached File- => Added interpn_fix_complex1.diff, #52715

    Back to the top


    Powered by Savane 3.9