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

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

[Octave-bug-tracker] [bug #60968] "plus" does not expand sparse matrices


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #60968] "plus" does not expand sparse matrices
Date: Mon, 26 Jul 2021 10:55:30 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Follow-up Comment #4, bug #60968 (project octave):

Broadcasting is currently only implemented for full matrices.

In addition to sparse matrices, Octave also uses special representation for
diagonal (the value returned by eye is stored this way) and permutation
matrices (like the permutation matrix returned by the lu function) and ranges.
 Broadcasting is also not fully implemented for those types.

You can disable these special types by using the functions
disable_diagonal_matrix, disable_permutation_matrix, and disable_range or by
starting Octave with the --traditional option.

The reason (a+0) + b works in your example is that adding zero to the diagonal
matrix forces it to be full.  Even though the conversion is not necessary when
adding zero, it happens because there is no special case for adding zero.

For the permutation matrix, diagonal matrix, and range types, we should
probably just convert to full for any of these operations so that broadcasting
will work and then add special cases to perserve the memory savings of the
special types where possible and as developer time and interest permits.

I don't think it is reasonable to do the same thing for sparse matrices
because Matlab compatibility requires that the results be sparse in most
(all?) cases.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60968>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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