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.

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 asis.

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

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.

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.

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.

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

and the file... ziped...
(file #23909)

Ok, I'll try again :P
hopefully both are in this file..

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).

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)

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.

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)

I can't reproduce the problem.
Can you show the actual code that is producing this? What are Q and x?

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
