[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[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: |
Mon, 21 Nov 2016 19:42:22 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0 |
Follow-up Comment #7, bug #36562 (project octave):
At least we understand what behavior needs to be implemented. At a minimum,
Octave needs to check whether each operand contains a NaN and it needs to
specifically guarantee that those locations result in NaN at the output. The
subsequent decision, about whether to convert to full if it would save space,
should probably be left up to Octave, or to the sparse_auto_mutate code.
Pseudo-code which might work for Z = X op Y:
list1 = isnan (X);
list2 = isnan (Y);
tmp = X op Y;
tmp(list1) = NaN;
tmp(list2) = NaN;
Z = tmp;
Of course, all of that would need to be in C++.
Another choice would be to look carefully at the code which performs the
operation 'op'. For sparse matrices, I believe the code is equivalent to
nonzero1 = nonzeros (X);
nonzero2 = nonzeros (Y);
elements_to_operate_on = intersection (nonzero1, nonzero2);
Z = X(elements_to_operate_on) op Y(elements_to_operate_on);
The "intersection" function for sparse matrices in C++ could be changed to
include elements where only one of the matrices had a NaN.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?36562>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/