bugGNU Octave - Bugs: bug #34173, Unary negative casts permutation...

 
 

bug #34173: Unary negative casts permutation matrices into full matrices

Submitted by:  Mikael <mandolin>
Submitted on:  Tue 30 Aug 2011 11:03:40 AM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: ConfirmedAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating 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)

Thu 08 Dec 2016 04:23:01 AM UTC, comment #14:

this behavior still exists in 4.2.0

the comment #12 commands just seem to produce full matrices in Matlab 2016b. I'm unaware if matlab stores 'permutation matrices' through any other method or not to address Lachlan's question.

Nicholas Jankowski <nrjank>
Wed 15 Jun 2016 08:31:19 AM UTC, comment #13:

Is this really a bug?

In terms of Matlab compatibility, is there any sequence of instruction that produces a permutation matrix where Matlab doesn't produce a full matrix? If not, then the behaviour is entirely up to us.

If the programmer wants a sparse matrix, it is easy to convert to sparse before negating. They can't want a permutation matrix if it is negative.

Unless there is a Matlab compatibility issue, I would vote for documenting this behaviour and leaving it as-is.

Lachlan Andrew <lachlan>
Project Member
Tue 24 Nov 2015 12:50:18 AM UTC, comment #12:

The behavior of unary minus converting a Permutation Matrix to a Full Matrix has been re-introduced to solve bug #44316. I am re-opening this bug report as it is now present on the development branch. Test code

Rik <rik5>
Project Administrator
Wed 31 Aug 2011 06:33:17 AM UTC, comment #11:

Thank you.

I'll be waiting for the next release, since I'll be waiting for other updates as well (which I have read about).

I thought I report a bug when I found one.

Mikael <mandolin>
Tue 30 Aug 2011 11:46:09 PM UTC, comment #10:

This changeset fixes the problem for me:

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

It's a fairly large change I'm not 100% sure about and it's fixing a relatively minor and workaroundable bug, so I pushed it on the default branch.

To see this change, you will need to build from the development sources or wait for our next major stable release.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Tue 30 Aug 2011 03:51:33 PM UTC, comment #9:

Btw, this is enough to reproduce it:

It appears that Qq is a permutation matrix, which is stored sparsely, and attempting to make it negative tries to cast it from a permutation matrix to a full matrix, which is why you run out of memory.

The fix seems to be to make permutation matrices (an internal Octave type) first attempt a cast into sparse matrices into full matrices. I'll look into making this fix.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Tue 30 Aug 2011 03:43:32 PM UTC, comment #8:

Thank you. I can reproduce the problem now. I'll investigate and attempt a fix if someone else doesn't beat me to it.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Tue 30 Aug 2011 02:15:11 PM UTC, comment #7:

and the file... ziped...

(file #23909)

Mikael <mandolin>
Tue 30 Aug 2011 02:13:48 PM UTC, comment #6:

Ok, I'll try again :P

hopefully both are in this file..

Mikael <mandolin>
Tue 30 Aug 2011 02:05:38 PM UTC, comment #5:

Sorry to be such a bother, but you seem to have only saved the Y vector...

The save command should be:

and that should produce a rather large file. You should be able to compress it with gzip or similar (please, no rar).

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Tue 30 Aug 2011 01:06:18 PM UTC, comment #4:

Oh sorry about that...

I have saved the J and Y in attached files, saved them as -binary hope I did it right..

(file #23908)

Mikael <mandolin>
Tue 30 Aug 2011 12:35:55 PM UTC, comment #3:

You don't mean "crash". A crash is when the operating system sends a signal to a program to termminate immediately, because, for example, the program requested to use memory that the operating system hadn't assigned to it yet. You simply mean "Octave reports an error" or something like that.

The information contained in Q is crucial, because I need to know how much memory it's using, and I also need to know how much memory is available in your system. Please attempt to reproduce this problem with data that you can show me.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Tue 30 Aug 2011 12:13:49 PM UTC, comment #2:

I saw that I forgot the error message..
Can't post all the code and all data sorry, but this is the basics:

[L,U,Pp,Qq,Rr]=lu(J);

Y = ... (a vector)
z1 = Rr\Y;
z2 = L\(Pp*z1);
z3 = U\z2;
dY =-(Qq*z3); (this is the step where it crashes)

without ()
dY =-Qq*z3;
the following message is posted
error: memory exhausted or requested size too large for range of Octave's index type -- trying to return to prompt

I have a sparce matrix J (have a spy as attachment) tried to use just
[L,U]=lu(J);
Y = ...
dY=-U\(L\Y);

this does not work good since octave gives
warning: matrix singular to machine precision, rcond = 1
warning: attempting to find minimum norm solution

(file #23907)

Mikael <mandolin>
Tue 30 Aug 2011 11:57:43 AM UTC, comment #1:

I can't reproduce the problem.

Can you show the actual code that is producing this? What are Q and x?

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Tue 30 Aug 2011 11:03:40 AM UTC, original submission:

I have found a strange problem.

I have a big sparse matrix Q (43750 43750) and a vector x

then
Y = -Q*x;

gives the error message:

but with
Y = -(Q*x);
or
Z = Q*x;
Y = -Z;

works fine.. should give same results.

//Mandolin

Mikael <mandolin>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #23909:  parameters.zip added by mandolin (1MiB - application/x-zip-compressed)
file #23908:  vector added by mandolin (276KiB - application/octet-stream)
file #23907:  spy.jpg added by mandolin (15KiB - image/jpeg)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by ttl (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by mandolin (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 17 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 25 Nov 2015 06:40:10 PM UTCttlCategoryGUI=>Libraries
    Tue 24 Nov 2015 12:50:18 AM UTCrik5StatusFixed=>Confirmed
      Open/ClosedClosed=>Open
      Release3.4.2=>dev
      Carbon-Copy-=>Added jwe
    Mon 06 Apr 2015 12:20:30 AM UTCrik5Dependencies-=>bugs #44316 is dependent
    Wed 31 Aug 2011 02:02:08 AM UTCjordighSummaryPossible bug with multiplification with matrices and "-" sign=>Unary negative casts permutation matrices into full matrices
    Tue 30 Aug 2011 11:46:09 PM UTCjordighStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
      SummaryUnary negative casts permutation matrices into full matrices=>Possible bug with multiplification with matrices and "-" sign
    Tue 30 Aug 2011 04:18:24 PM UTCjordighSummaryPossible bug with multiplification with matrices and "-" sign=>Unary negative casts permutation matrices into full matrices
    Tue 30 Aug 2011 03:43:32 PM UTCjordighStatusWorks For Me=>Confirmed
    Tue 30 Aug 2011 02:15:11 PM UTCmandolinAttached File-=>Added parameters.zip, #23909
    Tue 30 Aug 2011 01:06:18 PM UTCmandolinAttached File-=>Added vector, #23908
    Tue 30 Aug 2011 12:13:49 PM UTCmandolinAttached File-=>Added spy.jpg, #23907
    Tue 30 Aug 2011 11:57:43 AM UTCjordighItem GroupSegfault, Bus Error, etc.=>Incorrect Result
      StatusNone=>Works For Me

    Back to the top


    Powered by Savane 3.1-cleanup1