changeset 4508:2bc437206787

[project @ 2003-09-11 01:06:43 by jwe]
author jwe
date Thu, 11 Sep 2003 01:06:44 +0000
parents 65f47f8a92a2
children 9ec494b3eb5f
files liboctave/MArrayN.cc liboctave/MArrayN.h liboctave/NDArray.cc liboctave/NDArray.h src/ChangeLog src/OPERATORS/op-cs-cs.cc src/OPERATORS/op-cs-m.cc src/OPERATORS/op-cs-s.cc src/OPERATORS/op-m-cs.cc src/OPERATORS/op-s-cs.cc src/OPERATORS/op-s-s.cc src/ov-typeinfo.cc
diffstat 12 files changed, 503 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/MArrayN.cc	Thu Sep 11 01:06:44 2003 +0000
@@ -0,0 +1,163 @@
+/*
+
+Copyright (C) 1996, 1997 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
+#if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
+#pragma implementation
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "MArrayN.h"
+#include "ArrayN-idx.h"
+#include "lo-error.h"
+
+#include "MArray-defs.h"
+
+// Two dimensional array with math ops.
+
+// Element by element MArrayN by scalar ops.
+
+
+#if 0
+template <class T>
+MArrayN<T>&
+operator += (MArrayN<T>& a, const T& s)
+{
+  DO_VS_OP2 (+=)
+  return a;
+}
+
+template <class T>
+MArrayN<T>&
+operator -= (MArrayN<T>& a, const T& s)
+{
+  DO_VS_OP2 (-=)
+  return a;
+}
+
+
+#define MARRAYN_NDS_OP(OP) \
+  template <class T> \
+  MArrayN<T> \
+  operator OP (const MArrayN<T>& a, const T& s) \
+    { \
+      MArrayN<T> result (a.dims ()); \
+      T *r = result.fortran_vec (); \
+      int l = a.length (); \
+      const T *v = a.data (); \
+      DO_VS_OP (r, l, v, OP, s); \
+      return result; \
+    }
+
+MARRAYN_NDS_OP (+)
+MARRAYN_NDS_OP (-)
+MARRAYN_NDS_OP (*)
+MARRAYN_NDS_OP (/)
+
+// Element by element MArrayN by scalar ops.
+
+#define MARRAYN_SND_OP(OP) \
+  template <class T> \
+  MArrayN<T> \
+  operator OP (const T& s, const MArrayN<T>& a) \
+  { \
+    MArrayN<T> result (a.dims ()); \
+    T *r = result.fortran_vec (); \
+    int l = a.length (); \
+    const T *v = a.data (); \
+    DO_SV_OP (r, l, s, OP, v); \
+    return result; \
+  }
+
+MARRAYN_SND_OP (+)
+MARRAYN_SND_OP (-)
+MARRAYN_SND_OP (*)
+MARRAYN_SND_OP (/)
+
+#define MARRAY_NDND_OP(FCN, OP) \
+template <class T> \
+MArrayN<T> \
+FCN (const MArrayN<T>& a, const MArrayN<T>& b) \
+{ \
+Array<int> a_dims = a.dims (); \
+Array<int> b_dims = b.dims (); \
+int dims_ok = 1; \
+int any_dims_zero = 0; \
+if (a_dims.length () != b_dims.length ()) \
+ dims_ok = 0; \
+ else \
+   { \
+     for (int i = 0; i < a_dims.length (); i++) \
+       { \
+	 if (a_dims (i) != b_dims (i)) \
+	   { dims_ok = 0; break; } \
+	 if (a_dims (i) == 0) \
+	   any_dims_zero = 1; \
+       } \
+   } \
+ if (!dims_ok) \
+   { \
+     gripe_nonconformant (#FCN, a_dims, b_dims); \
+     return MArrayN<T> (); \
+   } \
+ if (any_dims_zero) \
+   return MArrayN<T> (a_dims); \
+ int l = a.length (); \
+ MArrayN<T> result (a_dims); \
+ T* r = result.fortran_vec (); \
+ const T *x = a.data (); \
+ const T *y = b.data (); \
+ DO_VV_OP (r, l, x, OP, y); \
+ return result; \
+}
+
+MARRAY_NDND_OP (operator +, +)
+MARRAY_NDND_OP (operator -, -)
+
+template <class T>
+MArrayN<T>
+operator + (const MArrayN<T>& a)
+{
+  return a;
+}
+
+template <class T>
+MArrayN<T>
+operator - (const MArrayN<T>& a)
+{
+  int l = a.length ();
+  MArrayN<T> result (a.dims ());
+  T *r = result.fortran_vec ();
+  const T *x = a.data ();
+  NEG_V (r, l, x);
+  return result;
+}
+
+#endif
+ 
+/*
+;;; Local Variables: ***
+;;; mode: C++ ***
+;;; End: ***
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/MArrayN.h	Thu Sep 11 01:06:44 2003 +0000
@@ -0,0 +1,82 @@
+// Template array classes with like-type math ops
+/*
+
+Copyright (C) 1996, 1997 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
+#if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
+#pragma interface
+#endif
+
+#if !defined (octave_MArrayN_h)
+#define octave_MArrayN_h 1
+
+#include "ArrayN.h"
+// Two dimensional array with math ops.
+
+// But first, some preprocessor abuse...
+
+#include "MArray-defs.h"
+
+class Matrix;
+
+MARRAY_OPS_FORWARD_DECLS (MArrayN)
+
+template <class T>
+class
+MArrayN : public ArrayN<T>
+{
+ protected:
+
+  MArrayN (T *d, const Array<int>& dims) : ArrayN<T> (d, dims)
+    { }
+
+ public:
+  
+  MArrayN (void) : ArrayN<T> () {}
+  
+  MArrayN (const Array<int>& dims) : ArrayN<T> (dims)
+    { }
+  
+  MArrayN (const Array<int>& dims, const T& val) 
+    : ArrayN<T> (dims, val) { }
+
+  MArrayN (const ArrayN<T>& a) : ArrayN<T> (a) { }
+
+  //MArrayN (const Array<T>& a) : ArrayN<T> (a) { }
+
+  MArrayN (const MArrayN<T>& a) : ArrayN<T> (a) { }
+
+  MArrayN (const Matrix& m) : ArrayN<T> (m) { }
+
+  ~MArrayN (void) { }
+
+  MArrayN<T>& operator = (const MArrayN<T>& a)
+    {
+      ArrayN<T>::operator = (a);
+      return *this;
+    }
+
+};
+
+extern void
+gripe_nonconformant (const char *op, Array<int>& op1_dims, Array<int>& op2_dims);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/NDArray.cc	Thu Sep 11 01:06:44 2003 +0000
@@ -0,0 +1,84 @@
+//N-D Array  manipulations.
+/*
+
+Copyright (C) 1996, 1997 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
+#if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
+#pragma implementation
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "NDArray.h"
+#include "mx-base.h"
+#include "lo-ieee.h"
+
+bool
+NDArray::any_element_is_negative (bool neg_zero) const
+{
+  int n = length (); 
+  if (neg_zero)
+    {
+      for (int i = 0; i < n; i++)
+	if (lo_ieee_signbit (Array<double>::elem (i)))
+	  return true;
+    }
+  else
+    {
+      for (int i = 0; i < n; i++)
+	if (Array<double>::elem (i) < 0)
+	  return true;
+    }
+ 
+ return false;
+}
+
+bool
+NDArray::all_integers (double& max_val, double& min_val) const
+{
+  int n = length ();
+
+  if (n > 0)
+    {
+      max_val = Array<double>::elem (0);
+      min_val = Array<double>::elem (0);
+    }
+  else 
+    return false;
+
+  for (int i = 0; i < n; i++)
+    {
+      double val = Array<double>::elem (0);
+      
+      if (val > max_val)
+	max_val = val;
+
+      if (val < min_val)
+	min_val = val;
+
+      if (D_NINT (val) != val)
+	return false;
+    }
+
+  return true;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/NDArray.h	Thu Sep 11 01:06:44 2003 +0000
@@ -0,0 +1,82 @@
+/*
+
+Copyright (C) 1996, 1997 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
+#if !defined (octave_NDArray_int_h)
+#define octave_NDArray_int_h 1
+
+#if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
+#pragma interface
+#endif
+
+#include "MArrayN.h"
+//#include "mx-base.h"
+
+#include "mx-defs.h"
+#include "mx-op-defs.h"
+
+#include "data-conv.h"
+#include "mach-info.h"
+
+class NDArray : public MArrayN<double>
+{
+ public:
+  
+  NDArray (void) : MArrayN<double> () { }
+
+  NDArray (Array<int>& dims) : MArrayN<double> (dims) { }
+
+  NDArray (Array<int>& dims, double val) : MArrayN<double> (dims, val) { }
+  
+  NDArray (const NDArray& a): MArrayN<double> (a) { }
+
+  NDArray (const MArrayN<double>& a) : MArrayN<double> (a) { }
+
+  NDArray (const Matrix& m) : MArrayN<double> (m) { }
+
+  NDArray (const ArrayN<double>& a) : MArrayN<double> (a) { }
+
+  //NDArray (const Array<double>& a) : MArrayN<double> (a) { }
+
+  NDArray& operator = (const NDArray& a)
+    {
+      MArrayN<double>::operator = (a);
+      return *this;
+    }
+
+  // i/o
+
+  // friend std::ostream& operator << (std::ostream& os, const NDArray& a);
+  // friend std::istream& operator >> (std::istream& is, NDArray& a);
+
+  static double resize_fill_value (void) { return 0; }
+
+  bool any_element_is_negative (bool = false) const;
+  bool all_integers (double& max_val, double& min_val) const;
+
+ private:
+
+  NDArray (double *d, Array<int>& dims) : MArrayN<double> (d, dims) { }
+};
+
+MARRAY_FORWARD_DEFS (MArrayN, NDArray, double)
+
+#endif
--- a/src/ChangeLog	Wed Sep 10 15:48:08 2003 +0000
+++ b/src/ChangeLog	Thu Sep 11 01:06:44 2003 +0000
@@ -1,3 +1,29 @@
+2003-09-10  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* OPERATORS/op-m-cs.cc (complex_matrix_conv): Delete function.
+	(install_m_cs_ops): Don't install complex_matrix_conv here.
+
+	* OPERATORS/op-s-cs.cc (complex_matrix_conv): Delete function.
+	(install_s_cs_ops): Don't install complex_matrix_conv here.
+
+	* OPERATORS/op-s-s.cc (matrix_conv): Delete function.
+	(install_s_s_ops): Don't install matrix_conv here.
+
+	* OPERATORS/op-cs-s.cc (complex_matrix_conv): Delete function.
+	(install_cs_s_ops): Don't install complex_matrix_conv here.
+
+	* OPERATORS/op-cs-m.cc (complex_matrix_conv): Delete function.
+	(install_cs_m_ops): Don't install complex_matrix_conv here.
+
+	* OPERATORS/op-cs-cs.cc (complex_matrix_conv): Delete function.
+	(install_cs_cs_ops): Don't install complex_matrix_conv here.
+
+	* ov-typeinfo.cc (do_register_unary_op,
+	do_register_non_const_unary_op, do_register_binary_op,
+	do_register_assign_op, do_register_assignany_op,
+	do_register_pref_assign_conv, do_register_widening_op):
+	Print warning if installing a duplicate function.
+
 2003-09-10  Petter Risholm  <risholm@stud.ntnu.no>
 
 	* data.cc, ov-base.cc, ov-base.h, ov.h, ov.cc, ov-re-mat.h,
--- a/src/OPERATORS/op-cs-cs.cc	Wed Sep 10 15:48:08 2003 +0000
+++ b/src/OPERATORS/op-cs-cs.cc	Thu Sep 11 01:06:44 2003 +0000
@@ -176,13 +176,6 @@
   return v1.complex_value () != 0.0 || v2.complex_value () != 0.0;
 }
 
-DEFCONV (complex_matrix_conv, complex, complex_matrix)
-{
-  CAST_CONV_ARG (const octave_complex&);
-
-  return new octave_complex_matrix (v.complex_matrix_value ());
-}
-
 void
 install_cs_cs_ops (void)
 {
@@ -214,8 +207,6 @@
   INSTALL_BINOP (op_el_or, octave_complex, octave_complex, el_or);
 
   INSTALL_ASSIGNCONV (octave_complex, octave_complex, octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_complex, octave_complex_matrix, complex_matrix_conv);
 }
 
 /*
--- a/src/OPERATORS/op-cs-m.cc	Wed Sep 10 15:48:08 2003 +0000
+++ b/src/OPERATORS/op-cs-m.cc	Thu Sep 11 01:06:44 2003 +0000
@@ -98,13 +98,6 @@
 DEFBINOP_FN (el_and, complex, matrix, mx_el_and)
 DEFBINOP_FN (el_or, complex, matrix, mx_el_or)
 
-DEFCONV (complex_matrix_conv, complex, complex_matrix)
-{
-  CAST_CONV_ARG (const octave_complex&);
-
-  return new octave_complex_matrix (v.complex_matrix_value ());
-}
-
 void
 install_cs_m_ops (void)
 {
@@ -128,8 +121,6 @@
   INSTALL_BINOP (op_el_or, octave_complex, octave_matrix, el_or);
 
   INSTALL_ASSIGNCONV (octave_complex, octave_matrix, octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_complex, octave_complex_matrix, complex_matrix_conv);
 }
 
 /*
--- a/src/OPERATORS/op-cs-s.cc	Wed Sep 10 15:48:08 2003 +0000
+++ b/src/OPERATORS/op-cs-s.cc	Thu Sep 11 01:06:44 2003 +0000
@@ -155,13 +155,6 @@
   return v1.complex_value () != 0.0 || v2.double_value ();
 }
 
-DEFCONV (complex_matrix_conv, complex, complex_matrix)
-{
-  CAST_CONV_ARG (const octave_complex&);
-
-  return new octave_complex_matrix (v.complex_matrix_value ());
-}
-
 void
 install_cs_s_ops (void)
 {
@@ -185,8 +178,6 @@
   INSTALL_BINOP (op_el_or, octave_complex, octave_scalar, el_or);
 
   INSTALL_ASSIGNCONV (octave_complex, octave_scalar, octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_complex, octave_complex_matrix, complex_matrix_conv);
 }
 
 /*
--- a/src/OPERATORS/op-m-cs.cc	Wed Sep 10 15:48:08 2003 +0000
+++ b/src/OPERATORS/op-m-cs.cc	Thu Sep 11 01:06:44 2003 +0000
@@ -105,13 +105,6 @@
 DEFBINOP_FN (el_and, matrix, complex, mx_el_and)
 DEFBINOP_FN (el_or, matrix, complex, mx_el_or)
 
-DEFCONV (complex_matrix_conv, matrix, complex_matrix)
-{
-  CAST_CONV_ARG (const octave_matrix&);
-
-  return new octave_complex_matrix (ComplexMatrix (v.matrix_value ()));
-}
-
 void
 install_m_cs_ops (void)
 {
@@ -135,8 +128,6 @@
   INSTALL_BINOP (op_el_or, octave_matrix, octave_complex, el_or);
 
   INSTALL_ASSIGNCONV (octave_matrix, octave_complex, octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_matrix, octave_complex_matrix, complex_matrix_conv);
 }
 
 /*
--- a/src/OPERATORS/op-s-cs.cc	Wed Sep 10 15:48:08 2003 +0000
+++ b/src/OPERATORS/op-s-cs.cc	Thu Sep 11 01:06:44 2003 +0000
@@ -155,13 +155,6 @@
   return octave_value (v1.double_value () || (v2.complex_value () != 0.0));
 }
 
-DEFCONV (complex_matrix_conv, scalar, complex_matrix)
-{
-  CAST_CONV_ARG (const octave_scalar&);
-
-  return new octave_complex_matrix (v.complex_matrix_value ());
-}
-
 void
 install_s_cs_ops (void)
 {
@@ -185,8 +178,6 @@
   INSTALL_BINOP (op_el_or, octave_scalar, octave_complex, el_or);
 
   INSTALL_ASSIGNCONV (octave_scalar, octave_complex, octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_scalar, octave_complex_matrix, complex_matrix_conv);
 }
 
 /*
--- a/src/OPERATORS/op-s-s.cc	Wed Sep 10 15:48:08 2003 +0000
+++ b/src/OPERATORS/op-s-s.cc	Thu Sep 11 01:06:44 2003 +0000
@@ -118,13 +118,6 @@
 DEFBINOP_OP (el_and, scalar, scalar, &&)
 DEFBINOP_OP (el_or, scalar, scalar, ||)
 
-DEFCONV (matrix_conv, scalar, matrix)
-{
-  CAST_CONV_ARG (const octave_scalar&);
-
-  return new octave_matrix (v.matrix_value ());
-}
-
 void
 install_s_s_ops (void)
 {
@@ -156,8 +149,6 @@
   INSTALL_BINOP (op_el_or, octave_scalar, octave_scalar, el_or);
 
   INSTALL_ASSIGNCONV (octave_scalar, octave_scalar, octave_matrix);
-
-  INSTALL_WIDENOP (octave_scalar, octave_matrix, matrix_conv);
 }
 
 /*
--- a/src/ov-typeinfo.cc	Wed Sep 10 15:48:08 2003 +0000
+++ b/src/ov-typeinfo.cc	Thu Sep 11 01:06:44 2003 +0000
@@ -193,6 +193,15 @@
 octave_value_typeinfo::do_register_unary_op (octave_value::unary_op op,
 					     int t, unary_op_fcn f)
 {
+  if (lookup_unary_op (op, t))
+    {
+      std::string op_name = octave_value::unary_op_as_string (op);
+      std::string type_name = types(t);
+
+      warning ("duplicate unary operator `%s' for type `%s'",
+	       op_name.c_str (), type_name.c_str ());
+    }
+
   unary_ops.checkelem (static_cast<int> (op), t) = f;
 
   return false;
@@ -202,6 +211,15 @@
 octave_value_typeinfo::do_register_non_const_unary_op
   (octave_value::unary_op op, int t, non_const_unary_op_fcn f)
 {
+  if (lookup_non_const_unary_op (op, t))
+    {
+      std::string op_name = octave_value::unary_op_as_string (op);
+      std::string type_name = types(t);
+
+      warning ("duplicate unary operator `%s' for type `%s'",
+	       op_name.c_str (), type_name.c_str ());
+    }
+
   non_const_unary_ops.checkelem (static_cast<int> (op), t) = f;
 
   return false;
@@ -212,6 +230,16 @@
 					      int t1, int t2,
 					      binary_op_fcn f)
 {
+  if (lookup_binary_op (op, t1, t2))
+    {
+      std::string op_name = octave_value::binary_op_as_string (op);
+      std::string t1_name = types(t1);
+      std::string t2_name = types(t2);
+
+      warning ("duplicate binary operator `%s' for types `%s' and `%s'",
+	       op_name.c_str (), t1_name.c_str (), t1_name.c_str ());
+    }
+
   binary_ops.checkelem (static_cast<int> (op), t1, t2) = f;
 
   return false;
@@ -222,6 +250,16 @@
 					      int t_lhs, int t_rhs,
 					      assign_op_fcn f)
 {
+  if (lookup_assign_op (op, t_lhs, t_rhs))
+    {
+      std::string op_name = octave_value::assign_op_as_string (op);
+      std::string t_lhs_name = types(t_lhs);
+      std::string t_rhs_name = types(t_rhs);
+
+      warning ("duplicate assignment operator `%s' for types `%s' and `%s'",
+	       op_name.c_str (), t_lhs_name.c_str (), t_rhs_name.c_str ());
+    }
+
   assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs) = f;
 
   return false;
@@ -229,8 +267,17 @@
 
 bool
 octave_value_typeinfo::do_register_assignany_op (octave_value::assign_op op,
-						  int t_lhs, assign_op_fcn f)
+						 int t_lhs, assign_op_fcn f)
 {
+  if (lookup_assignany_op (op, t_lhs))
+    {
+      std::string op_name = octave_value::assign_op_as_string (op);
+      std::string t_lhs_name = types(t_lhs);
+
+      warning ("duplicate assignment operator `%s' for types `%s'",
+	       op_name.c_str (), t_lhs_name.c_str ());
+    }
+
   assignany_ops.checkelem (static_cast<int> (op), t_lhs) = f;
 
   return false;
@@ -240,6 +287,15 @@
 octave_value_typeinfo::do_register_pref_assign_conv (int t_lhs, int t_rhs,
 						     int t_result) 
 {
+  if (lookup_pref_assign_conv (t_lhs, t_rhs) >= 0)
+    {
+      std::string t_lhs_name = types(t_lhs);
+      std::string t_rhs_name = types(t_rhs);
+
+      warning ("overriding assignment conversion for types `%s' and `%s'",
+	       t_lhs_name.c_str (), t_rhs_name.c_str ());
+    }
+
   pref_assign_conv.checkelem (t_lhs, t_rhs) = t_result;
 
   return false;
@@ -249,6 +305,15 @@
 octave_value_typeinfo::do_register_widening_op
   (int t, int t_result, type_conv_fcn f)
 {
+  if (lookup_widening_op (t, t_result))
+    {
+      std::string t_name = types(t);
+      std::string t_result_name = types(t_result);
+
+      warning ("overriding widening op for `%s' to `%s'",
+	       t_name.c_str (), t_result_name.c_str ());
+    }
+
   widening_ops.checkelem (t, t_result) = f;
 
   return false;