bugGNU Octave - Bugs: bug #54144, Why can't issorted() work on...


bug #54144: Why can't issorted() work on sparse matrices?

Submitted by:  Dan Sebald <sebald>
Submitted on:  Mon 18 Jun 2018 07:49:25 PM UTC  
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  Open
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 19 Jun 2018 01:33:14 AM UTC, comment #2:

One thing that appears to be missing is support in liboctave/array/Sparse.h for issorted. Only Array.h and Range.h have the issorted routine. It could be that issorted has not been implemented for sparse matrices in liboctave. sort() for Sparse matrices is declared in Sparse.h and this is valid

Rik <rik5>
Project Administrator
Mon 18 Jun 2018 11:04:47 PM UTC, comment #1:

Actually, sorting on sparse matrices might work, while bug #54143 is covering up this fact:

If that is the case, then the attached changeset is all that is needed.

There is another use of the phrase "support sparse" in this file:

I was going to remove that, but in this case that statement still holds. Furthermore, there is a FIXME question about whether this routine is even used anymore, so maybe investigating and removing that routine is the better route. It appears that the script file sortrows() uses the above routine, and for the sparse case it implements a row-by-row sort via a script sort_rows_idx_generic(). Apparently, the sorting method of the sort_rows_idx_generic() accepts sparse matrices. For sparse matrices, the generic script-based sort probably doesn't have the cost that full matrices do. I wonder if the better solution here is to move what is in sortrows.m into the built-in routine _sort_rows_idx_ and call that routine "sortrows".

(file #44394)

Dan Sebald <sebald>
Mon 18 Jun 2018 07:49:25 PM UTC, original submission:

The issorted() documentation states

yet sort() works on sparse matrices:

As with the previous bug report, issorted() should be able to work on anything that the sort() routine produces.

Dan Sebald <sebald>


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

Attach Files:

Attached Files


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 sebald (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-06-19 rik5 StatusNone => Confirmed
    2018-06-18 sebald Attached File- => Added octave-issorted_doc-djs2018jun18.patch, #44394

    Back to the top

    Powered by Savane 3.4