Mercurial > hg > octave-lyh
diff liboctave/CNDArray.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 | b47ab50a6aa8 |
children | 7c573eb981eb |
line wrap: on
line diff
--- a/liboctave/CNDArray.cc +++ b/liboctave/CNDArray.cc @@ -508,29 +508,13 @@ bool ComplexNDArray::any_element_is_nan (void) const { - octave_idx_type nel = nelem (); - - for (octave_idx_type i = 0; i < nel; i++) - { - Complex val = elem (i); - if (xisnan (val)) - return true; - } - return false; + return do_mx_check<Complex> (*this, mx_inline_any_nan); } bool ComplexNDArray::any_element_is_inf_or_nan (void) const { - octave_idx_type nel = nelem (); - - for (octave_idx_type i = 0; i < nel; i++) - { - Complex val = elem (i); - if (xisinf (val) || xisnan (val)) - return true; - } - return false; + return ! do_mx_check<Complex> (*this, mx_inline_all_finite); } // Return true if no elements have imaginary components. @@ -538,7 +522,7 @@ bool ComplexNDArray::all_elements_are_real (void) const { - return mx_inline_all_real (numel (), data ()); + return do_mx_check<Complex> (*this, mx_inline_all_real); } // Return nonzero if any element of CM has a non-integer real or