bugGNU Octave - Bugs: bug #45171, isequal fails for large sparse...


bug #45171: isequal fails for large sparse matrices (subscript indixes too large)

Submitted by:  Marco Caliari <caliari>
Submitted on:  Sat 23 May 2015 11:26:25 AM UTC  
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: Patch SubmittedAssigned to: Marco Caliari <caliari>
Originator Name: Open/Closed: Open
Release: 4.2.0Operating System: GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

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


(Jump to the original submission Jump to the original submission)

Fri 18 Nov 2016 07:15:18 PM UTC, comment #6:

I would venture to say that numel() is preferred over length() in the Octave code base these days even when it is guaranteed that the variable references a vector.

Mike Miller <mtmiller>
Project Administrator
Thu 17 Nov 2016 08:38:43 AM UTC, comment #5:

Hi, now that 4.2 is out I'd like to apply this change.
Can it be pushed as is or should I replace length by numel?

Carlo de Falco <cdf>
Project Member
Wed 28 Sep 2016 02:54:51 PM UTC, comment #4:

x is the result of

so even if the original x was a matrix after this call
it will be a vector.

similarly for y below in the code

nonetheless I see no problem in using numel instead of length if you prefer ...

Carlo de Falco <cdf>
Project Member
Wed 28 Sep 2016 02:49:52 PM UTC, comment #3:

I agree that in the original code, length is OK because it is applied to the result of the find function. But in the modified version it is applied to X. Can that be a matrix?

John W. Eaton <jwe>
Project Administrator
Wed 28 Sep 2016 11:05:32 AM UTC, comment #2:

This patch was being discussed on IRC yesterday,
when my connection went suddenly off, I'll
continue the discussion here.

Just before communication was interrupted jwe asked:

My answer would have been:

I would say length is equivalent to numel in this context because find should always return vectors, as noted in its

But if you prefer it I see no problem in replacing length by numel in the patch.

Also note that the use of length was there before this change.

Carlo de Falco <cdf>
Project Member
Thu 22 Sep 2016 09:04:36 AM UTC, comment #1:

This report is quite old, but by browsing for "__isequal__" it got my attention. Your problem does not exist, if you are using 64-bit indices, as you are touching the critical border:

What prevents you from applying your patch before the 4.2 release?

Kai Torben Ohlhus <siko1056>
Project Member
Sat 23 May 2015 11:26:25 AM UTC, original submission:

Dear all,

the following code

fails with

It is the already seen problem of linear indexing of large sparse matrices. On the other hand, I was able to fix this case with the enclosed patch, still preserving the 26 tests in isequal.m.



Marco Caliari <caliari>
Project MemberIn charge of this item.


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

Attach File(s):

Attached Files
file #34084:  __isequal__.m.patch added by caliari (673B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by cdf (Posted a comment)
  • -unavailable- added by cdf
  • -unavailable- added by siko1056 (Posted a comment)
  • -unavailable- added by caliari (Submitted the item)

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

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 17 Nov 2016 04:03:40 AM UTCmtmillerRelease4.2.0-rc2=>4.2.0
    Wed 28 Sep 2016 11:05:32 AM UTCcdfCarbon-Copy-=>Added -unavailable-
    Thu 22 Sep 2016 09:04:36 AM UTCsiko1056Item GroupNone=>Incorrect Result
      StatusNone=>Patch Submitted
      Assigned toNone=>caliari
    Sat 23 May 2015 11:27:14 AM UTCcaliariSummaryisequal fails for large sparse matrices (subscript indices too large)=>isequal fails for large sparse matrices (subscript indixes too large)
    Sat 23 May 2015 11:26:25 AM UTCcaliariAttached File-=>Added _isequal_.m.patch, #34084

    Back to the top

    Powered by Savane 3.1-cleanup1