diff liboctave/fNDArray.cc @ 9827:c15a5ed0da58

optimize bsxfun (@power, ...)
author Jaroslav Hajek <highegg@gmail.com>
date Wed, 18 Nov 2009 12:03:07 +0100
parents f80c566bc751
children 829e69ec3110
line wrap: on
line diff
--- a/liboctave/fNDArray.cc	Wed Nov 18 11:17:54 2009 +0100
+++ b/liboctave/fNDArray.cc	Wed Nov 18 12:03:07 2009 +0100
@@ -514,11 +514,7 @@
 	  return true;
     }
   else
-    {
-      for (octave_idx_type i = 0; i < nel; i++)
-	if (elem (i) < 0)
-	  return true;
-    }
+    return mx_inline_any_negative (numel (), data ());
 
   return false;
 }
@@ -631,6 +627,22 @@
 }
 
 bool
+FloatNDArray::all_integers (void) const
+{
+  octave_idx_type nel = nelem ();
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    {
+      double val = elem (i);
+
+      if (D_NINT (val) != val)
+	return false;
+    }
+
+  return true;
+}
+
+bool
 FloatNDArray::too_large_for_float (void) const
 {
   octave_idx_type nel = nelem ();
@@ -1074,6 +1086,10 @@
 BSXFUN_STDOP_DEFS_MXLOOP (FloatNDArray)
 BSXFUN_STDREL_DEFS_MXLOOP (FloatNDArray)
 
+BSXFUN_OP_DEF_MXLOOP (pow, FloatNDArray, mx_inline_pow)
+BSXFUN_OP2_DEF_MXLOOP (pow, FloatComplexNDArray, FloatComplexNDArray, 
+                       FloatNDArray, mx_inline_pow)
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***