diff liboctave/boolNDArray.cc @ 9550:3d6a9aea2aea

refactor binary & bool ops in liboctave
author Jaroslav Hajek <highegg@gmail.com>
date Wed, 19 Aug 2009 22:55:15 +0200
parents e5f7aee2ab8c
children 7dafdb8b062f
line wrap: on
line diff
--- a/liboctave/boolNDArray.cc
+++ b/liboctave/boolNDArray.cc
@@ -38,12 +38,7 @@
 boolNDArray
 boolNDArray::operator ! (void) const
 {
-  boolNDArray b (dims ());
-
-  for (octave_idx_type i = 0; i < length (); i++)
-    b.elem (i) = ! elem (i);
-
-  return b;
+  return do_mx_unary_op<boolNDArray> (*this, mx_inline_not);
 }
 
 // FIXME -- this is not quite the right thing.
@@ -146,13 +141,13 @@
   return ArrayN<bool>::diag (k);
 }
 
-NDND_BOOL_OPS (boolNDArray, boolNDArray, false)
+NDND_BOOL_OPS (boolNDArray, boolNDArray)
 NDND_CMP_OPS (boolNDArray, , boolNDArray, )
 
-NDS_BOOL_OPS (boolNDArray, bool, false)
+NDS_BOOL_OPS (boolNDArray, bool)
 NDS_CMP_OPS (boolNDArray, , bool, )
 
-SND_BOOL_OPS (bool, boolNDArray, false)
+SND_BOOL_OPS (bool, boolNDArray)
 SND_CMP_OPS (bool, , boolNDArray, )
 
 boolNDArray&