Mercurial > hg > octave-lyh
diff liboctave/CMatrix.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 | 7c573eb981eb |
line wrap: on
line diff
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -3052,35 +3052,13 @@ bool ComplexMatrix::any_element_is_nan (void) const { - octave_idx_type nr = rows (); - octave_idx_type nc = cols (); - - for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = 0; i < nr; i++) - { - Complex val = elem (i, j); - if (xisnan (val)) - return true; - } - - return false; + return do_mx_check<Complex> (*this, mx_inline_any_nan); } bool ComplexMatrix::any_element_is_inf_or_nan (void) const { - octave_idx_type nr = rows (); - octave_idx_type nc = cols (); - - for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = 0; i < nr; i++) - { - Complex val = elem (i, j); - 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. @@ -3088,7 +3066,7 @@ bool ComplexMatrix::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