bugGNU Octave - Bugs: bug #58661, tril does not work on empty...

 
 

bug #58661: tril does not work on empty matrices

Submitter:  Johannes Pfeifer <jpfeifer>
Submitted:  Sat 27 Jun 2020 05:59:45 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 30 Jun 2020 04:06:34 PM UTC, comment #3: 

I generally agree that Octave should perform thorough argument validation but in this case I can also see an argument for returning a value when the requested diagonal is out of range.  Since changeset a86d608c413c, we have allowed the diag function to behave similarly.  I recently encountered this issue with tril and triu when making some code written for Matlab run in Octave.  At that time, I made the following change on the default branch:

http://hg.savannah.gnu.org/hgweb/octave/rev/91f245908132

So I think we can mark this issue as fixed.

John W. Eaton <jwe>
Group administrator
Tue 30 Jun 2020 02:53:55 PM UTC, comment #2: 

Octave generally checks its inputs more strictly than Matlab.  This is to prevent Garbage In / Garbage Out calculations.  Matlab often goes the other direction and will return something, often without even a warning that the input was unexpected or out of range.

This is a philosophical difference, rather than just Matlab compatibility, so I'm marking this as "Won't Fix".


Rik <rik5>
Group administrator
Sat 27 Jun 2020 06:01:17 PM UTC, comment #1: 

Of course, the same applies to

triu([],-1)


Johannes Pfeifer <jpfeifer>
Sat 27 Jun 2020 05:59:45 PM UTC, original submission:  

Running

tril([],-1)


on Octave returns an error

error: tril: requested diagonal out of range

while it returns an empty matrix on Matlab. As far as I can see, this is also the root of the bug https://savannah.gnu.org/bugs/?55779

Johannes Pfeifer <jpfeifer>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jpfeifer (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-06-30 jwe Priority3 - Low 5 - Normal
        StatusWont Fix Fixed
    2020-06-30 rik5 Priority5 - Normal 3 - Low
        StatusNone Wont Fix
        Open/ClosedOpen Closed
        Release5.2.0 dev
        Operating SystemMicrosoft Windows Any

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code