Mercurial > octave-nkf
diff liboctave/fMatrix.cc @ 11008:3622db30ff05
simplify some array tests in liboctave
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 21 Sep 2010 13:09:12 +0200 |
parents | 2c2d4a2f1047 |
children | 9478b216752e |
line wrap: on
line diff
--- a/liboctave/fMatrix.cc Tue Sep 21 03:51:02 2010 -0400 +++ b/liboctave/fMatrix.cc Tue Sep 21 13:09:12 2010 +0200 @@ -2629,11 +2629,7 @@ return true; } else - { - for (octave_idx_type i = 0; i < nel; i++) - if (elem (i) < 0) - return true; - } + return do_mx_check<float> (*this, mx_inline_any_negative); return false; } @@ -2641,31 +2637,13 @@ bool FloatMatrix::any_element_is_nan (void) const { - octave_idx_type nel = nelem (); - - for (octave_idx_type i = 0; i < nel; i++) - { - float val = elem (i); - if (xisnan (val)) - return true; - } - - return false; + return do_mx_check<float> (*this, mx_inline_any_nan); } bool FloatMatrix::any_element_is_inf_or_nan (void) const { - octave_idx_type nel = nelem (); - - for (octave_idx_type i = 0; i < nel; i++) - { - float val = elem (i); - if (xisinf (val) || xisnan (val)) - return true; - } - - return false; + return ! do_mx_check<float> (*this, mx_inline_all_finite); } bool