changeset 10107:fd262afea1d1

optimize bsxfun for chars
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 14 Jan 2010 13:16:09 +0100
parents edbe47bc0f88
children 06e11df4592d
files liboctave/ChangeLog liboctave/chNDArray.cc liboctave/chNDArray.h src/ChangeLog src/DLD-FUNCTIONS/bsxfun.cc
diffstat 5 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Thu Jan 14 10:17:37 2010 +0100
+++ b/liboctave/ChangeLog	Thu Jan 14 13:16:09 2010 +0100
@@ -1,3 +1,8 @@
+2010-01-14  Jaroslav Hajek  <highegg@gmail.com>
+
+	* chNDArray.h: Declare relational bsxfun ops.
+	* chNDArray.cc: Define them.
+
 2010-01-14  John W. Eaton  <jwe@octave.org>
 
 	* CMatrix.cc: Fix prototype for zherk.
--- a/liboctave/chNDArray.cc	Thu Jan 14 10:17:37 2010 +0100
+++ b/liboctave/chNDArray.cc	Thu Jan 14 13:16:09 2010 +0100
@@ -32,6 +32,8 @@
 #include "lo-mappers.h"
 #include "mx-op-defs.h"
 
+#include "bsxfun-defs.cc"
+
 // FIXME -- this is not quite the right thing.
 
 boolNDArray
@@ -161,6 +163,8 @@
 NDND_CMP_OPS (charNDArray, charNDArray)
 NDND_BOOL_OPS (charNDArray, charNDArray)
 
+BSXFUN_STDREL_DEFS_MXLOOP (charNDArray)
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/liboctave/chNDArray.h	Thu Jan 14 10:17:37 2010 +0100
+++ b/liboctave/chNDArray.h	Thu Jan 14 13:16:09 2010 +0100
@@ -28,6 +28,7 @@
 
 #include "mx-defs.h"
 #include "mx-op-decl.h"
+#include "bsxfun-decl.h"
 
 class
 OCTAVE_API
@@ -111,6 +112,8 @@
 
 MARRAY_FORWARD_DEFS (MArrayN, charNDArray, char)
 
+BSXFUN_STDREL_DECLS (charNDArray, OCTAVE_API)
+
 #endif
 
 /*
--- a/src/ChangeLog	Thu Jan 14 10:17:37 2010 +0100
+++ b/src/ChangeLog	Thu Jan 14 13:16:09 2010 +0100
@@ -1,3 +1,8 @@
+2010-01-14  Jaroslav Hajek  <highegg@gmail.com>
+
+	* DLD-FUNCTIONS/bsxfun.cc (maybe_fill_table): register relational
+	handlers for char arrays.
+
 2010-01-14  Jaroslav Hajek  <highegg@gmail.com>
 
 	* ov-class.cc (octave_class::numel (const octave_value_list&)): Don't
--- a/src/DLD-FUNCTIONS/bsxfun.cc	Thu Jan 14 10:17:37 2010 +0100
+++ b/src/DLD-FUNCTIONS/bsxfun.cc	Thu Jan 14 13:16:09 2010 +0100
@@ -175,6 +175,14 @@
   REGISTER_OP_HANDLER (bsxfun_builtin_power, btyp_complex, ComplexNDArray, bsxfun_pow);
   REGISTER_OP_HANDLER (bsxfun_builtin_power, btyp_float_complex, FloatComplexNDArray, bsxfun_pow);
 
+  // For chars, we want just relational handlers.
+  REGISTER_REL_HANDLER (bsxfun_builtin_eq, btyp_char, charNDArray, bsxfun_eq);
+  REGISTER_REL_HANDLER (bsxfun_builtin_ne, btyp_char, charNDArray, bsxfun_ne);
+  REGISTER_REL_HANDLER (bsxfun_builtin_lt, btyp_char, charNDArray, bsxfun_lt);
+  REGISTER_REL_HANDLER (bsxfun_builtin_le, btyp_char, charNDArray, bsxfun_le);
+  REGISTER_REL_HANDLER (bsxfun_builtin_gt, btyp_char, charNDArray, bsxfun_gt);
+  REGISTER_REL_HANDLER (bsxfun_builtin_ge, btyp_char, charNDArray, bsxfun_ge);
+
   filled = true;
 }