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

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

[Octave-bug-tracker] [bug #45622] Sparsity of sparse matrix when assigni


From: Rik
Subject: [Octave-bug-tracker] [bug #45622] Sparsity of sparse matrix when assigning all elements
Date: Sat, 25 Jul 2015 15:42:09 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0

Follow-up Comment #1, bug #45622 (project octave):

I don't think we want to mimic this behavior.  The expression M(:) refers to
all elements in an array, but it appears that Matlab is interpreting this to
mean the matrix itself.  In pseudo-code,


M(:) = 1;
=>
M = repmat (1, size (M));


which takes its characteristics (full or sparse) from the first argument to
repmat.

What does Matlab do for the following?


M = uint8 (zeros (2,2));
M(:) = 1.1;
class (M)


If they are consistent, then class of M will change to double, but that is
most definitely not what you want.  Another test, just for fun.


M = sparse (4,4);
M(:) = sparse (1);
issparse (M)


Does that preserve sparsity?

Octave also supports the sparse_auto_mutate variable which will convert sparse
matrices to full ones when the storage is smaller as a full matrix.  It is off
by default, but try


help sparse_auto_mutate




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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