changeset 8181:1ebcb9872ced

fix sparse-matrix bool/cmp op instantiation problem
author John W. Eaton <jwe@octave.org>
date Mon, 06 Oct 2008 11:07:54 -0400
parents da48d2ca096f
children 1b2256d6e01d
files liboctave/ChangeLog liboctave/Sparse-op-defs.h liboctave/Sparse.h
diffstat 3 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Mon Oct 06 14:02:36 2008 +0200
+++ b/liboctave/ChangeLog	Mon Oct 06 11:07:54 2008 -0400
@@ -2,6 +2,13 @@
 
 	* oct-lookup.h: Mark functions inline. Add missing std:: qualifiers.
 
+2008-10-06  John W. Eaton  <jwe@octave.org>
+
+	* Sparse.h (Sparse<T>::elt_type): New typedef.
+	* Sparse-op-defs.h (SPARSE_SMSM_BOOL_OP, SPARSE_MSM_CMP_OP):
+	Use it to call sparse-matrix/scalar operator instead of attempting
+	to instantiate mixed-type sparse-matrix/scalar operators.
+
 2008-10-03  Jaroslav Hajek  <highegg@gmail.com>
 
 	* Array.h (Array<T>::maybe_delete_elements): Remove rfv argument from
--- a/liboctave/Sparse-op-defs.h	Mon Oct 06 14:02:36 2008 +0200
+++ b/liboctave/Sparse-op-defs.h	Mon Oct 06 11:07:54 2008 -0400
@@ -749,15 +749,11 @@
     \
     if (m1_nr == 1 && m1_nc == 1) \
       { \
-        extern OCTAVE_API SparseBoolMatrix F (const double&, const M2&); \
-        extern OCTAVE_API SparseBoolMatrix F (const Complex&, const M2&); \
-        r = F (m1.elem(0,0), m2); \
+        r = F (m1.elem(0,0) != M1::elt_type (), m2); \
       } \
     else if (m2_nr == 1 && m2_nc == 1) \
       { \
-        extern OCTAVE_API SparseBoolMatrix F (const M1&, const double&); \
-        extern OCTAVE_API SparseBoolMatrix F (const M1&, const Complex&); \
-        r = F (m1, m2.elem(0,0)); \
+        r = F (m1, m2.elem(0,0) != M2::elt_type ()); \
       } \
     else if (m1_nr == m2_nr && m1_nc == m2_nc) \
       { \
@@ -883,15 +879,11 @@
     \
     if (m1_nr == 1 && m1_nc == 1) \
       { \
-        extern OCTAVE_API SparseBoolMatrix F (const double&, const M2&); \
-        extern OCTAVE_API SparseBoolMatrix F (const Complex&, const M2&); \
-        r = F (m1.elem(0,0), m2); \
+        r = F (m1.elem(0,0) != M1::elt_type (), m2); \
       } \
     else if (m2_nr == 1 && m2_nc == 1) \
       { \
-        extern OCTAVE_API SparseBoolMatrix F (const M1&, const double&); \
-        extern OCTAVE_API SparseBoolMatrix F (const M1&, const Complex&); \
-        r = F (m1, m2.elem(0,0)); \
+        r = F (m1, m2.elem(0,0) != M2::elt_type ()); \
       } \
     else if (m1_nr == m2_nr && m1_nc == m2_nc) \
       { \
--- a/liboctave/Sparse.h	Mon Oct 06 14:02:36 2008 +0200
+++ b/liboctave/Sparse.h	Mon Oct 06 11:07:54 2008 -0400
@@ -46,6 +46,10 @@
 class
 Sparse
 {
+public:
+
+  typedef T elt_type;
+
 protected:
   //--------------------------------------------------------------------
   // The real representation of all Sparse arrays.