[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, a
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse |
Date: |
Fri, 24 Jun 2016 19:26:24 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0 |
Follow-up Comment #13, bug #43098 (project octave):
Poor Lachlan, endless code review. But, the code is definitely getting
cleaner and tighter. I had a question about testing for NaN values.
+bool
+Sparse<T>::SparseRep::any_element_is_nan (void) const
+{
+ octave_idx_type nz = nnz ();
+
+ for (octave_idx_type i = 0; i < nz; i++)
+ if (d[i] != d[i])
+ return true;
+
+ return false;
+}
You're relying on an IEEE floating point trick that NaN != NaN. This works,
but it is a little unclear. Would it not be better to use
octave::math::isnan() as is done elsewhere in the codebase?
Second, does it make sense to add a specialization for SparseBool matrices for
this any_element_is_nan function? For SparseBool, the element type T is bool
which can never be NaN and therefore the function could return false
immediately.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?43098>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, (continued)
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, Lachlan Andrew, 2016/06/12
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, Colin Macdonald, 2016/06/13
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, Lachlan Andrew, 2016/06/22
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, Colin Macdonald, 2016/06/23
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, John W. Eaton, 2016/06/23
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, Lachlan Andrew, 2016/06/23
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, Lachlan Andrew, 2016/06/23
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, Rik, 2016/06/23
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, Lachlan Andrew, 2016/06/24
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, Colin Macdonald, 2016/06/24
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse,
Rik <=
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, Lachlan Andrew, 2016/06/25
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, Rik, 2016/06/29
- [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse, Lachlan Andrew, 2016/06/29