octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #47415] out of memory negating a permutation m


From: Rik
Subject: [Octave-bug-tracker] [bug #47415] out of memory negating a permutation matrix
Date: Thu, 24 Mar 2016 18:21:52 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Follow-up Comment #24, bug #47415 (project octave):

I don't see an easy solution to perfect Matlab compatibility and also having
Octave language extensions.  Actually, there is an easy solution which is to
disable extensions when perfect compatibility is required, but jwe wasn't keen
on that.

If we require exact compatibility, then we might want to just get rid of both
Permutation and Diagonal matrices entirely.  They do add a lot of code in
terms of files, operators between P & D matrices and every other type, and in
switch statements where we have to decode the matrix type.

But we would be losing a lot in time and memory.  For example,


octave:28> x = rand (1e3);
octave:29> P = eye (1e3)(1000:-1:1, :);
octave:30> Ps = sparse (P);
octave:31> Pf = full (P);
octave:32> tic; y = P*x; toc
Elapsed time is 0.00626493 seconds.
octave:33> tic; ys = Ps*x; toc
Elapsed time is 0.0852761 seconds.
octave:34> tic; yf = Pf*x; toc
Elapsed time is 0.114365 seconds.
octave:35> whos P*
Variables in the current scope:

   Attr Name        Size                     Bytes  Class
   ==== ====        ====                     =====  ===== 
        P        1000x1000                    4000  double
        Pf       1000x1000                 8000000  double
        Ps       1000x1000                   16004  double


The Permutation matrix is the smallest by far, and executes 13X faster then
the Sparse matrix implementation.  The full matrix implementation is not only
tremendously wasteful of space, it also is another 30% slower than the Sparse
implementation.

I suppose if it was super important to preserve '-0' then we could add a
signbit flag to Permutation and Diagonal matrices to record that fact as
suggested by Lachlan.



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?47415>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]