bugGNU Octave - Bugs: bug #66563, ezplot of constant fcn fails:...

 
 

bug #66563: ezplot of constant fcn fails: error: error: XX(0): subscripts must be either integers 1 to (2^63)-1 or logicals

Submitter:  Colin Macdonald <cbm>
Submitted:  Sat 14 Dec 2024 06:17:25 PM UTC
   
 
Category:  Octave Function Severity:  2 - Minor
Priority:  3 - Low Item Group:  Unexpected Error or Warning
Status:  Patch Submitted Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  10.1.0 (current default) Planned Release:  10.1.0 (current default)
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 14 Jan 2025 04:34:12 PM UTC, comment #6: 

@Colin: See https://octave.discourse.group/t/need-matlab-test-of-constant-functions/6082

I asked for verification of Matlab behavior.  You are correct that feval() returns a single value of the constant function for multiple inputs.  So, for Matlab compatibility we can't change that.  See the attached changeset which expands ezplot to do polar or 2-D plots of constant functions.  I found the same solution you did independently.

Given that Matlab doesn't handle constant functions for contour plots, do we really need Octave to do so?  I would probably vote no.

Rik <rik5>
Group administrator
Tue 31 Dec 2024 10:11:18 PM UTC, comment #5: 

@Colin: Attached is a patch which fixes ezplot and ezpolar when called with constant functions.  I added the BIST test you wrote to this proto-changeset.  I'm not that motivated to do more since Matlab doesn't plot contours of constant functions (See https://octave.discourse.group/t/need-matlab-test-of-constant-functions/6082/2).

If you do want to do more then the third patch (replacing feval with local version that does constant expansion) is a good approach.  However, for performance it would need to be vectorized.  A for loop will be too slow.

Rik <rik5>
Group administrator
Sun 29 Dec 2024 10:24:22 AM UTC, comment #4: 

Rik, I've attached my WIP patches for this, probably not ready for merging yet.

(file #56721, file #56722, file #56723)

Colin Macdonald <cbm>
Sat 28 Dec 2024 10:43:19 PM UTC, comment #3: 

Great!  I've been hacking on it too so ping me and I'll review.

I'm also working on the 3-d plots, ezsurf et al.

Colin Macdonald <cbm>
Sat 28 Dec 2024 10:36:05 PM UTC, comment #2: 

I marked this as in progress.  I have a fix in ezplot.m that works for constant regular and polar plots.  I've asked on Octave Discourse for some tests to be run to see how constant inputs to ezcontour() are handled.

Rik <rik5>
Group administrator
Sat 14 Dec 2024 11:01:28 PM UTC, comment #1: 

I traced this to the behaviour of `feval(@(x) 21, 0:5)` which returns the scalar `21`.  I believe that is compatible with at least old versions of Matlab that also had this behaviour.

So I will try to workaround this in `__ezplot__.m` and submit a patch.

Colin Macdonald <cbm>
Sat 14 Dec 2024 06:17:25 PM UTC, original submission:  


ezplot (@(x) 2)
error: XX(0): subscripts must be either integers 1 to (2^63)-1 or logicals
error: called from
    __ezplot__>find_valid_domain at line 508 column 7
    __ezplot__ at line 396 column 11
    ezplot at line 84 column 4


Observed on 0.8.4 and dev tip from a few weeks ago.

- - - -

This is sort of a dupe of https://savannah.gnu.org/bugs/?func=detailitem&item_id=49766
which was closed fixed but taking a closer look, there were 2 ways it could fail and we fixed only one of them,

It is downstream issue: https://github.com/gnu-octave/symbolic/issues/1318



Colin Macdonald <cbm>

 

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

Attach Files:
   
   
Comment:
   

 

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 cbm (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 group members can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-12-31 rik5 StatusIn Progress Patch Submitted
        Fixed ReleaseNone 10.1.0 (current default)
    2024-12-29 cbm Attached File- Added 0001-ezplot-fix-plotting-of-constant-fcns-Bug-66563.patch, #56721
        Attached File- Added 0002-ezsurf-fix-flat-border-detection-for-constant-fcn.patch, #56722
        Attached File- Added 0003-ezplot-ezsurf-et-al-general-fixes-for-constant-fcns.patch, #56723
    2024-12-28 rik5 Severity3 - Normal 2 - Minor
        Priority5 - Normal 3 - Low
        StatusNone In Progress
        Planned ReleaseNone 10.1.0 (current default)

    Back to the top

    Powered by Savane 3.14-708e.
    Corresponding source code