bugGNU Octave - Bugs: bug #37774, Slicing sparse matrix gives wrong...

 
 

bug #37774: Slicing sparse matrix gives wrong result

Submitted by:  Kim Rydhof Thor Hansen <kimhanse>
Submitted on:  Mon 19 Nov 2012 06:36:39 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: David Bateman <dbateman>
Originator Name: Open/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Sat 22 Jun 2013 10:11:54 AM UTC, comment #1:

The two index version of the Sparse<T>:index for column vectors calls the single index method. In the case of a scalar stored as a sparse matrix the single index version of Sparse<T>::index specialised the method, and some information on the form of the desired return matrix was lost when handing the two index version happen the problem off to the single index version.

This is not the first bug report for the special cases of scalars stored as sparse matrices and I'm inclined to just treat this case the same way the octave treats the indexing of scalars, that is it casts them to matrices and then index them. In this manner the results will be automatically consistent between sparse and full matrices

As a scalar stored as a sparse matrx takes significantly more memory than a scalar stored in a matrix, we're probably better off just densifying the matrix and calling the dense index function on it and resparsifying the returned matrix in any case in terms of performance.

See the changeset

http://hg.savannah.gnu.org/hgweb/octave/rev/f4eef73b6e90

D.

David Bateman <dbateman>
Project MemberIn charge of this item.
Mon 19 Nov 2012 06:36:39 PM UTC, original submission:

"sparse(zeros(1))(false,:)" gives a 0x0 matrix, I think this it should give a 0x1 matrix.

Running the following:

gives this result on newest octave:

Kim Rydhof Thor Hansen <kimhanse>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dbateman (Posted a comment)
  • -unavailable- added by jordigh (Updated the item)
  • -unavailable- added by kimhanse (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 22 Jun 2013 10:11:54 AM UTCdbatemanStatusConfirmed=>Fixed
      Assigned toNone=>dbateman
      Open/ClosedOpen=>Closed
    Mon 19 Nov 2012 06:50:27 PM UTCjordighStatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup