diff liboctave/fCNDArray.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/fCNDArray.cc	Tue Sep 21 03:51:02 2010 -0400
+++ b/liboctave/fCNDArray.cc	Tue Sep 21 13:09:12 2010 +0200
@@ -503,29 +503,13 @@
 bool
 FloatComplexNDArray::any_element_is_nan (void) const
 {
-  octave_idx_type nel = nelem ();
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    {
-      FloatComplex val = elem (i);
-      if (xisnan (val))
-        return true;
-    }
-  return false;
+  return do_mx_check<FloatComplex> (*this, mx_inline_any_nan);
 }
 
 bool
 FloatComplexNDArray::any_element_is_inf_or_nan (void) const
 {
-  octave_idx_type nel = nelem ();
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    {
-      FloatComplex val = elem (i);
-      if (xisinf (val) || xisnan (val))
-        return true;
-    }
-  return false;
+  return ! do_mx_check<FloatComplex> (*this, mx_inline_all_finite);
 }
 
 // Return true if no elements have imaginary components.
@@ -533,7 +517,7 @@
 bool
 FloatComplexNDArray::all_elements_are_real (void) const
 {
-  return mx_inline_all_real (numel (), data ());
+  return do_mx_check<FloatComplex> (*this, mx_inline_all_real);
 }
 
 // Return nonzero if any element of CM has a non-integer real or