diff src/data.cc @ 8756:d0755c9db5ed

implement fast logical sum (counting)
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 16 Feb 2009 12:41:55 +0100
parents 767ed8cc6634
children ea76466605ba
line wrap: on
line diff
--- a/src/data.cc	Mon Feb 16 10:53:46 2009 +0100
+++ b/src/data.cc	Mon Feb 16 12:41:55 2009 +0100
@@ -1335,7 +1335,13 @@
                       else if NATIVE_REDUCTION_1 (FCN, int16, dim) \
                       else if NATIVE_REDUCTION_1 (FCN, int32, dim) \
                       else if NATIVE_REDUCTION_1 (FCN, int64, dim) \
-                      else if NATIVE_REDUCTION_1 (FCN, bool, dim) \
+                      else if (arg.is_bool_type ()) \
+                        { \
+                          boolNDArray tmp = arg. bool_array_value (); \
+                          if (! error_state) \
+                            retval = tmp.any (dim); \
+                        } \
+                      \
                       else if (arg.is_char_matrix ()) \
                         { \
 			  error (#FCN, ": invalid char type"); \
@@ -1378,6 +1384,12 @@
 		          return retval; \
 		        } \
                     } \
+                  else if (arg.is_bool_type ()) \
+                    { \
+                      boolNDArray tmp = arg.bool_array_value (); \
+                      if (! error_state) \
+                        retval = tmp.FCN (dim); \
+                    } \
 		  else if (!isdouble && arg.is_single_type ()) \
 		    { \
 	              if (arg.is_real_type ()) \