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


bug #58661: tril does not work on empty matrices

Submitted by:  Johannes Pfeifer <jpfeifer>
Submitted on:  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

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


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:


So I think we can mark this issue as fixed.

John W. Eaton <jwe>
Project 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>
Project Administrator
Sat 27 Jun 2020 06:01:17 PM UTC, comment #1: 

Of course, the same applies to


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



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:

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)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project 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.5