bugGNU Octave - Bugs: bug #44316, eq () between two permutation...

 
 

bug #44316: eq () between two permutation matrices is not element-wise

Submitter:  Carnë Draug <carandraug>
Submitted:  Thu 19 Feb 2015 09:52:16 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
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
   

Jump to the original submission

Tue 24 Nov 2015 12:46:48 AM UTC, comment #7: 

Marking as fixed, and closing report.  I will re-open the linked bug #34173 which is now valid again.

Rik <rik5>
Group administrator
Sun 05 Apr 2015 04:30:09 PM UTC, comment #6: 

I found it, bug #34173.

Jordi Gutiérrez Hermoso <jordigh>
Group Member
Sun 05 Apr 2015 04:18:53 PM UTC, comment #5: 

I regret not being more thorough with my commit messages back then, because I am almost certain that removing the sparse conversions reintroduces some bug I cannot find now. The bug, as I remember it, was that seemingly innocent-looking computations would fill up memory because of the lack of conversion into sparse matrices.

I can't promise that I'll be able to work on this, but I really wish I could. :-(

Jordi Gutiérrez Hermoso <jordigh>
Group Member
Wed 01 Apr 2015 08:28:56 PM UTC, comment #4: 

I checked in the following changeset to remove the special operators that generated sparse matrices.  We may want to do that, but I think we need a more consistent approach that also treats diagonal matrices in a similar way.

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

John W. Eaton <jwe>
Group administrator
Tue 31 Mar 2015 08:56:21 PM UTC, comment #3: 

From a marketing perspective, it's nice that Octave has cool features above and beyond Matlab like space-saving diagonal and permutation matrix implementations.  However, I also think we need to favor correctness over memory or speed.  If the equality operator doesn't work then that's a problem.

Rik <rik5>
Group administrator
Fri 27 Mar 2015 02:27:44 PM UTC, comment #2: 

Jordi:

In http://hg.savannah.gnu.org/hgweb/octave/rev/b646413c3d0e you added operators !, unary + and -, ==, !=, &, and | for permutation matrices.  For == and !=, using the sparse matrix == and != operators instead of mx_el_eq and mx_el_ne is what is causing the result to be a scalar instead of a matrix.  If we use the mx_el_eq and mx_el_ne functions the results will be sparse matrices the way things are defined now.  That's space efficient but causes some other possible problems.  For example the sparse matrix unary - operator will not generate -0, so it seems to me that generating sparse matrices should maybe not happen implicitly.

Should we even have these operators?  If we omit them, the operations will succeed but they will generate full matrices.  If we define them, then we should probably also define the corresponding operators for diagonal matrices in the same way so that we get consistent results for both permutation and diagonal matrices.

I'm not sure whether the permutation and diagonal matrix types are really worth the trouble.

If you think this is worth having more discussion about, maybe we should do so on the maintainers list.

John W. Eaton <jwe>
Group administrator
Fri 20 Feb 2015 01:11:34 AM UTC, comment #1: 

Confirmed.  And it really is just Permutation <-> Permutation matrices.  Even Diagonal matrices, which are similar, work.


p = eye(3)([1 3 2], :)
p =

Permutation Matrix

   1   0   0
   0   0   1
   0   1   0

d = eye(3)
d =

Diagonal Matrix

   1   0   0
   0   1   0
   0   0   1

p == d
ans =

   1   1   1
   1   0   0
   1   0   0




Rik <rik5>
Group administrator
Thu 19 Feb 2015 09:52:16 PM UTC, original submission:  

If two matrices are of permutation matrix datatype, the equal comparison returns a scalar instead of an element-wise operation.

Example:


octave> [~, ~, P] = lu (magic (3))
P =

Permutation Matrix

   1   0   0
   0   0   1
   0   1   0

octave> P == P
ans =  1
octave> P != P
ans =  0
octave> typeinfo (P)
ans = permutation matrix


instead, it should return a 3x3 matrix. This bug was already present in Octave 3.8. It works properly as soon as one of the arguments is not a permutation matrix.


Carnë Draug <carandraug>
Group Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by jwe
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by carandraug (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
    2015-11-24 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2015-04-06 rik5 Dependencies- Depends on bugs #34173
    2015-04-01 jwe StatusConfirmed Ready For Test
    2015-03-27 jwe Carbon-Copy- Added jordigh
    2015-02-20 rik5 StatusNone Confirmed
    2015-02-19 carandraug Summaryeq () between two permutations is not element-wise eq () between two permutation matrices is not element-wise

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code