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

[Octave-bug-tracker] [bug #36562] Sparse matrix operations with NaN do n

 From: Rik Subject: [Octave-bug-tracker] [bug #36562] Sparse matrix operations with NaN do not follow IEEE standard Date: Thu, 31 May 2012 20:43:27 +0000 User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/12.0

```Update of bug #36562 (project octave):

Status:                    None => Confirmed
Summary: NaN/Inf behaviour unexpected in sparse rdivide =>
Sparse matrix operations with NaN do not follow IEEE standard

_______________________________________________________

Follow-up Comment #1:

Confirmed on a recent (5/31/12) development tip.

The issue is more general than just divide so I have changed the bug Summary.

At present, I can verify that multiply and divide are affected while addition
and subtraction behaves correctly.

The issue appears to be a side effect of the way that sparse matrices improve
calculation performance.  In general, math operations like multiply and divide
only need to be performed on the non-zero elements of a sparse matrix.
However, a NaN is different and should affect all elements of the matrix.

Below is some simple code to illustrate the problem.

Mfull = [1 0; 0 3];
Msparse = sparse (Mfull);

NaN .* Mfull
ans =

NaN   NaN
NaN   NaN

NaN .* Msparse
ans =

Compressed Column Sparse (rows = 2, cols = 2, nnz = 2 [50%])

(1, 1) -> NaN
(2, 2) -> NaN

NaN ./ Mfull
ans =

NaN   NaN
NaN   NaN

NaN ./ Msparse

ans =

NaN  -Inf
-Inf   NaN

_______________________________________________________

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

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

```