changeset 2613:5bcee07be597

[project @ 1997-01-21 03:52:08 by jwe]
author jwe
date Tue, 21 Jan 1997 03:53:18 +0000
parents e2d1b073b78a
children ae47b0911863
files ChangeLog NEWS PROJECTS liboctave/ChangeLog liboctave/chMatrix.cc mkoctfile.in scripts/ChangeLog scripts/plot/sombrero.m src/ChangeLog src/Makefile.in src/oct-stream.cc src/op-cm-cm.cc src/op-cm-cs.cc src/op-cm-m.cc src/op-cm-s.cc src/op-cs-cm.cc src/op-cs-m.cc src/op-m-cm.cc src/op-m-cs.cc src/op-m-m.cc src/op-m-s.cc src/op-s-cm.cc src/op-s-m.cc src/op-str-str.cc src/ops.h
diffstat 25 files changed, 226 insertions(+), 160 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,10 @@
 Mon Jan 20 11:16:21 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* mkoctfile.in (ALL_CXXFLAGS): Delete reference to -lg++.
+
 	* configure.in (RLD_FLAG): For sparc-sun-sunos4*, remove space
 	between -L and $(libdir).
+	(FPICFLAG): If using g77, set it to -fPIC.
 
 Sun Jan 19 15:57:20 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+Summary of changes for version 2.0.3:
+------------------------------------
+
+  * size ("") is now [0, 0].
+
 Summary of changes for version 2.0:
 ----------------------------------
 
--- a/PROJECTS
+++ b/PROJECTS
@@ -144,12 +144,6 @@
   * Consider changing the default value of `string_fill_char' from SPC
     to NUL.
 
-  * Consider making size ("") ==> [0, 0] for compatibility with
-    Matlab, at least when some preference variable is set.
-
-  * Consider making [] equivalent to "" for compatibility with
-    Matlab, at least when some preference variable is set.
-
   * Consider making ["test", []] ==> "test", for compatibility with
     Matlab, at least when some set of preferences are set.
 
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,9 @@
+Mon Jan 20 18:44:11 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* chMatrix.cc (charMatrix::charMatrix (const string&)):
+	If the number of columns is zero, also set the number of rows to zero.
+	(charMatrix::charMatrix (const char *)): Likewise.
+
 Tue Jan  7 00:16:57 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Version 2.0.1 released.
--- a/liboctave/chMatrix.cc
+++ b/liboctave/chMatrix.cc
@@ -46,17 +46,25 @@
 // charMatrix class.
 
 charMatrix::charMatrix (const char *s)
-  : MArray2<char> ((s ? 1 : 0), (s ? strlen (s) : 0))
+  : MArray2<char> ()
 {
-  int nc = cols ();
+  int nc = s ? strlen (s) : 0;
+  int nr = s && nc > 0 ? 1 : 0;
+
+  resize (nr, nc);
+
   for (int i = 0; i < nc; i++)
     elem (0, i) = s[i];
 }
 
 charMatrix::charMatrix (const string& s)
-  : MArray2<char> (1, s.length ())
+  : MArray2<char> ()
 {
-  int nc = cols ();
+  int nc = s.length ();
+  int nr = nc > 0 ? 1 : 0;
+
+  resize (nr, nc);
+
   for (int i = 0; i < nc; i++)
     elem (0, i) = s[i];
 }
@@ -65,6 +73,7 @@
   : MArray2<char> (s.length (), s.max_length (), 0)
 {
   int nr = rows ();
+
   for (int i = 0; i < nr; i++)
     {
       int nc = s[i].length ();
@@ -117,15 +126,21 @@
 string
 charMatrix::row_as_string (int r, bool strip_ws = false) const 
 {
-  if (r < 0 || r >= rows ())
+  string retval;
+
+  int nr = rows ();
+  int nc = cols ();
+
+  if (r == 0 && nr == 0 && nc == 0)
+    return retval;
+
+  if (r < 0 || r >= nr)
     {
       (*current_liboctave_error_handler) ("range error for row_as_string");
-      return 0;
+      return retval;
     }
 
-  int nc = cols ();
-
-  string retval (nc, '\0');
+  retval.resize (nc, '\0');
 
   for (int i = 0; i < nc; i++)
     retval[i] = elem (r, i);
--- a/mkoctfile.in
+++ b/mkoctfile.in
@@ -53,4 +53,4 @@
 
 echo "making $octfile from $objfile"
 
-$CXX -shared -o $octfile $objfile $LIBFLAGS $RLD_FLAG $OCTAVE_LIBS $FLIBS $LEXLIB $TERMLIBS $LIBS -lg++
+$CXX -shared -o $octfile $objfile $LIBFLAGS $RLD_FLAG $OCTAVE_LIBS $FLIBS $LEXLIB $TERMLIBS $LIBS
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,7 @@
+Mon Jan 20 12:28:34 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* plot/sombrero.m: Doc fix.
+
 Tue Jan  7 00:16:52 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Version 2.0.1 released.
--- a/scripts/plot/sombrero.m
+++ b/scripts/plot/sombrero.m
@@ -22,7 +22,7 @@
 ## Draw a `sombrero' in three dimensions using n grid lines.  The
 ## function plotted is
 ##
-##   z = sin (x^2 + y^2) / (x^2 + y^2);
+##   z = sin (sqrt (x^2 + y^2)) / (sqrt (x^2 + y^2))
 
 ## Author: jwe
 
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
 Mon Jan 20 11:11:12 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* ops.h (MX_MX_BOOL_OP): Correctly handle case of one or both
+	arguments being empty.  Change all callers.
+
+	* oct-stream.cc (printf_value_cache::looking_at_string):
+	Handle empty strings correctly now that they are 0x0.
+
 	* file-io.cc: Don't include "syswait.h" here.
 
 Sun Jan 19 22:38:45 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -35,13 +35,13 @@
 	  $(CXX) -shared -o $@ $< \
 	    $(OCTAVE_LFLAGS) \
 	    $(OCTAVE_LIBS) \
-	    $(FLIBS) $(LEXLIB) $(TERMLIBS) $(LIBS) -lg++
+	    $(FLIBS) $(LEXLIB) $(TERMLIBS) $(LIBS)
   else
     %.oct : %.o
 	  $(CXX) -shared -o $@ $< \
 	    $(OCTAVE_LFLAGS) \
 	    $(OCTAVE_LIBS) \
-	    $(FLIBS) $(LEXLIB) $(TERMLIBS) $(LIBS) -lg++
+	    $(FLIBS) $(LEXLIB) $(TERMLIBS) $(LIBS)
   endif
 endif
 
@@ -182,7 +182,7 @@
 	octave.o builtins.o $(DLD_STATIC_OBJ) \
 	$(OCTAVE_LFLAGS) \
 	$(OCTAVE_LIBS) \
-	$(FLIBS) $(LEXLIB) $(TERMLIBS) $(LIBS) -lg++
+	$(FLIBS) $(LEXLIB) $(TERMLIBS) $(LIBS)
 
 stamp-picdir:
 	if [ "$(SHARED_LIBS)" = true ] || [ "$(OCTAVE_LITE)" = true ]; then \
@@ -213,7 +213,7 @@
 	  $(CXX) -shared -o liboctinterp.$(SHLEXT) $(PICOBJ) \
 	    $(OCTAVE_LFLAGS) \
 	    -loctave -lcruft -ltinst -lreadline -lkpathsea \
-	    $(SH_TERMLIBS) $(SH_LIBS) -lg++ ; \
+	    $(SH_TERMLIBS) $(SH_LIBS) ; \
 	else \
 	  true ; \
 	fi
@@ -224,7 +224,7 @@
 	  $(CXX) -shared -o libtinst.$(SHLEXT) $(TI_PICOBJ) \
 	    $(OCTAVE_LFLAGS) \
 	    -loctinterp -loctave -lcruft -lreadline -lkpathsea \
-	    $(SH_TERMLIBS) $(SH_LIBS) -lg++ ; \
+	    $(SH_TERMLIBS) $(SH_LIBS) ; \
 	else \
 	  true ; \
 	fi
--- a/src/oct-stream.cc
+++ b/src/oct-stream.cc
@@ -1584,7 +1584,14 @@
     {
       octave_value tmp_val = values (idx);
 
-      retval = tmp_val.is_string () && tmp_val.rows () == 1;
+      // An empty string has zero rows and zero columns.
+
+      if (tmp_val.is_string ())
+	{
+	  int nr = tmp_val.rows ();
+
+	  retval = (nr == 1 || (nr == 0 && tmp_val.columns () == 0));
+	}
     }
 
   return retval;
--- a/src/op-cm-cm.cc
+++ b/src/op-cm-cm.cc
@@ -89,17 +89,18 @@
   return xleftdiv (v1.complex_matrix_value (), v2.complex_matrix_value ());
 }
 
-#define BOOL_OP(OP, EMPTY_RESULT) \
+#define BOOL_OP(OP, ONE_EMPTY_RESULT, TWO_EMPTY_RESULT) \
   MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), \
 		 ComplexMatrix, m2, v2.complex_matrix_value (), \
-		 real (m1 (i, j)) OP real (m2 (i, j)), #OP, EMPTY_RESULT)
+		 real (m1 (i, j)) OP real (m2 (i, j)), #OP, \
+		 ONE_EMPTY_RESULT, TWO_EMPTY_RESULT)
 
 static octave_value
 lt (const octave_value& a1, const octave_value& a2)
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
 
-  BOOL_OP (<, Matrix ());
+  BOOL_OP (<, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -107,7 +108,7 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
 
-  BOOL_OP (<=, Matrix ());
+  BOOL_OP (<=, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -115,9 +116,10 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
 
-  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), \
-		 ComplexMatrix, m2, v2.complex_matrix_value (), \
-		 m1 (i, j) == m2 (i, j), "==", 0.0);
+  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (),
+		 ComplexMatrix, m2, v2.complex_matrix_value (),
+		 m1 (i, j) == m2 (i, j), "==",
+		 0.0, 1.0);
 }
 
 static octave_value
@@ -125,7 +127,7 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
 
-  BOOL_OP (>=, Matrix ());
+  BOOL_OP (>=, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -133,7 +135,7 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
 
-  BOOL_OP (>, Matrix ());
+  BOOL_OP (>, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -141,9 +143,10 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
 
-  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), \
-		 ComplexMatrix, m2, v2.complex_matrix_value (), \
-		 m1 (i, j) != m2 (i, j), "!=", 1.0);
+  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (),
+		 ComplexMatrix, m2, v2.complex_matrix_value (),
+		 m1 (i, j) != m2 (i, j), "!=",
+		 1.0, 0.0);
 }
 
 static octave_value
@@ -186,9 +189,10 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
 
-  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), \
-		 ComplexMatrix, m2, v2.complex_matrix_value (), \
-		 m1 (i, j) != 0.0 && m2 (i, j) != 0.0, "&", Matrix ());
+  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (),
+		 ComplexMatrix, m2, v2.complex_matrix_value (),
+		 m1 (i, j) != 0.0 && m2 (i, j) != 0.0, "&",
+		 Matrix (), Matrix ());
 }
 
 static octave_value
@@ -196,9 +200,10 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
 
-  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), \
-		 ComplexMatrix, m2, v2.complex_matrix_value (), \
-		 m1 (i, j) != 0.0 || m2 (i, j) != 0.0, "|", Matrix ());
+  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (),
+		 ComplexMatrix, m2, v2.complex_matrix_value (),
+		 m1 (i, j) != 0.0 || m2 (i, j) != 0.0, "|",
+		 Matrix (), Matrix ());
 }
 
 static octave_value
--- a/src/op-cm-cs.cc
+++ b/src/op-cm-cs.cc
@@ -118,8 +118,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&);
 
-  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), \
-		 Complex, s, v2.complex_value (), \
+  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (),
+		 Complex, s, v2.complex_value (),
 		 m (i, j) == s, 0.0);
 }
 
@@ -144,8 +144,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&);
 
-  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), \
-		 Complex, s, v2.complex_value (), \
+  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (),
+		 Complex, s, v2.complex_value (),
 		 m (i, j) != s, 1.0);
 }
 
@@ -191,8 +191,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&);
 
-  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), \
-		 Complex, s, v2.complex_value (), \
+  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (),
+		 Complex, s, v2.complex_value (),
 		 m (i, j) != 0.0 && s != 0.0, Matrix ());
 }
 
@@ -201,8 +201,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&);
 
-  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), \
-		 Complex, s, v2.complex_value (), \
+  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (),
+		 Complex, s, v2.complex_value (),
 		 m (i, j) != 0.0 || s != 0.0, Matrix ());
 }
 
--- a/src/op-cm-m.cc
+++ b/src/op-cm-m.cc
@@ -87,17 +87,18 @@
   return xleftdiv (v1.complex_matrix_value (), v2.matrix_value ());
 }
 
-#define BOOL_OP(OP, EMPTY_RESULT) \
+#define BOOL_OP(OP, ONE_EMPTY_RESULT, TWO_EMPTY_RESULT) \
   MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), \
 		 Matrix, m2, v2.matrix_value (), \
-		 real (m1 (i, j)) OP m2 (i, j), #OP, EMPTY_RESULT)
+		 real (m1 (i, j)) OP m2 (i, j), #OP, \
+		 ONE_EMPTY_RESULT, TWO_EMPTY_RESULT)
 
 static octave_value
 lt (const octave_value& a1, const octave_value& a2)
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
 
-  BOOL_OP (<, Matrix ());
+  BOOL_OP (<, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -105,7 +106,7 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
 
-  BOOL_OP (<=, Matrix ());
+  BOOL_OP (<=, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -113,9 +114,10 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
 
-  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), \
-		 Matrix, m2, v2.matrix_value (), \
-		 m1 (i, j) == m2 (i, j), "==", 0.0);
+  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (),
+		 Matrix, m2, v2.matrix_value (),
+		 m1 (i, j) == m2 (i, j), "==",
+		 0.0, 1.0);
 }
 
 static octave_value
@@ -123,7 +125,7 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
 
-  BOOL_OP (>=, Matrix ());
+  BOOL_OP (>=, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -131,7 +133,7 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
 
-  BOOL_OP (>, Matrix ());
+  BOOL_OP (>, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -139,9 +141,10 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
 
-  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), \
-		 Matrix, m2, v2.matrix_value (), \
-		 m1 (i, j) != m2 (i, j), "!=", 0.0);
+  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (),
+		 Matrix, m2, v2.matrix_value (),
+		 m1 (i, j) != m2 (i, j), "!=",
+		 1.0, 0.0);
 }
 
 static octave_value
@@ -181,9 +184,10 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
 
-  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), \
-		 Matrix, m2, v2.matrix_value (), \
-		 m1 (i, j) != 0.0 && m2 (i, j), "&", Matrix ());
+  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (),
+		 Matrix, m2, v2.matrix_value (),
+		 m1 (i, j) != 0.0 && m2 (i, j), "&",
+		 Matrix (), Matrix ());
 }
 
 static octave_value
@@ -191,9 +195,10 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
 
-  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), \
-		 Matrix, m2, v2.matrix_value (), \
-		 m1 (i, j) != 0.0 || m2 (i, j), "|", Matrix ());
+  MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (),
+		 Matrix, m2, v2.matrix_value (),
+		 m1 (i, j) != 0.0 || m2 (i, j), "|",
+		 Matrix (), Matrix ());
 }
 
 static octave_value
--- a/src/op-cm-s.cc
+++ b/src/op-cm-s.cc
@@ -118,8 +118,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&);
 
-  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), \
-		 double, s, v2.double_value (), \
+  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (),
+		 double, s, v2.double_value (),
 		 m (i, j) == s, 0.0);
 }
 
@@ -144,8 +144,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&);
 
-  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), \
-		 double, s, v2.double_value (), \
+  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (),
+		 double, s, v2.double_value (),
 		 m (i, j) != s, 1.0);
 }
 
@@ -191,8 +191,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&);
 
-  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), \
-		 double, s, v2.double_value (), \
+  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (),
+		 double, s, v2.double_value (),
 		 m (i, j) != 0.0 && s, Matrix ());
 }
 
@@ -201,8 +201,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&);
 
-  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), \
-		 double, s, v2.double_value (), \
+  MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (),
+		 double, s, v2.double_value (),
 		 m (i, j) != 0.0 || s, Matrix ());
 }
 
--- a/src/op-cs-cm.cc
+++ b/src/op-cs-cm.cc
@@ -118,8 +118,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&);
 
-  SC_MX_BOOL_OP (Complex, s, v1.complex_value (), \
-		 ComplexMatrix, m, v2.complex_matrix_value (), \
+  SC_MX_BOOL_OP (Complex, s, v1.complex_value (),
+		 ComplexMatrix, m, v2.complex_matrix_value (),
 		 s == m (i, j), 0.0);
 }
 
@@ -144,8 +144,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&);
 
-  SC_MX_BOOL_OP (Complex, s, v1.complex_value (), \
-		 ComplexMatrix, m, v2.complex_matrix_value (), \
+  SC_MX_BOOL_OP (Complex, s, v1.complex_value (),
+		 ComplexMatrix, m, v2.complex_matrix_value (),
 		 s != m (i, j), 1.0);
 }
 
@@ -191,8 +191,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&);
 
-  SC_MX_BOOL_OP (Complex, s, v1.complex_value (), \
-		 ComplexMatrix, m, v2.complex_matrix_value (), \
+  SC_MX_BOOL_OP (Complex, s, v1.complex_value (),
+		 ComplexMatrix, m, v2.complex_matrix_value (),
 		 s != 0.0 && m (i, j) != 0.0, Matrix ());
 }
 
@@ -201,8 +201,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&);
 
-  SC_MX_BOOL_OP (Complex, s, v1.complex_value (), \
-		 ComplexMatrix, m, v2.complex_matrix_value (), \
+  SC_MX_BOOL_OP (Complex, s, v1.complex_value (),
+		 ComplexMatrix, m, v2.complex_matrix_value (),
 		 s != 0.0 || m (i, j) != 0.0, Matrix ());
 }
 
--- a/src/op-cs-m.cc
+++ b/src/op-cs-m.cc
@@ -119,8 +119,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&);
 
-  SC_MX_BOOL_OP (Complex, s, v1.complex_value (), \
-		 Matrix, m, v2.matrix_value (), \
+  SC_MX_BOOL_OP (Complex, s, v1.complex_value (),
+		 Matrix, m, v2.matrix_value (),
 		 s == m (i, j), 0.0);
 }
 
@@ -145,8 +145,8 @@
 {
   CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&);
 
-  SC_MX_BOOL_OP (Complex, s, v1.complex_value (), \
-		 Matrix, m, v2.matrix_value (), \
+  SC_MX_BOOL_OP (Complex, s, v1.complex_value (),
+		 Matrix, m, v2.matrix_value (),
 		 s != m (i, j), 1.0);
 }
 
--- a/src/op-m-cm.cc
+++ b/src/op-m-cm.cc
@@ -87,17 +87,18 @@
   return xleftdiv (v1.matrix_value (), v2.complex_matrix_value ());
 }
 
-#define BOOL_OP(OP, EMPTY_RESULT) \
+#define BOOL_OP(OP, ONE_EMPTY_RESULT, TWO_EMPTY_RESULT) \
   MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (), \
 		 ComplexMatrix, m2, v2.complex_matrix_value (), \
-		 m1 (i, j) OP real (m2 (i, j)), #OP, EMPTY_RESULT)
+		 m1 (i, j) OP real (m2 (i, j)), #OP, \
+		 ONE_EMPTY_RESULT, TWO_EMPTY_RESULT)
 
 static octave_value
 lt (const octave_value& a1, const octave_value& a2)
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
 
-  BOOL_OP (<, Matrix ());
+  BOOL_OP (<, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -105,7 +106,7 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
 
-  BOOL_OP (<=, Matrix ());
+  BOOL_OP (<=, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -113,9 +114,10 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
 
-  MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (), \
-		 ComplexMatrix, m2, v2.complex_matrix_value (), \
-		 m1 (i, j) == m2 (i, j), "==", 0.0);
+  MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (),
+		 ComplexMatrix, m2, v2.complex_matrix_value (),
+		 m1 (i, j) == m2 (i, j), "==",
+		 0.0, 1.0);
 }
 
 static octave_value
@@ -123,7 +125,7 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
 
-  BOOL_OP (>=, Matrix ());
+  BOOL_OP (>=, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -131,7 +133,7 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
 
-  BOOL_OP (>, Matrix ());
+  BOOL_OP (>, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -139,9 +141,10 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
 
-  MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (), \
-		 ComplexMatrix, m2, v2.complex_matrix_value (), \
-		 m1 (i, j) != m2 (i, j), "!=", 1.0);
+  MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (),
+		 ComplexMatrix, m2, v2.complex_matrix_value (),
+		 m1 (i, j) != m2 (i, j), "!=",
+		 1.0, 0.0);
 }
 
 static octave_value
@@ -181,9 +184,10 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
 
-  MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (), \
-		 ComplexMatrix, m2, v2.complex_matrix_value (), \
-		 m1 (i, j) && m2 (i, j) != 0.0, "&", Matrix ());
+  MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (),
+		 ComplexMatrix, m2, v2.complex_matrix_value (),
+		 m1 (i, j) && m2 (i, j) != 0.0, "&",
+		 Matrix (), Matrix ());
 }
 
 static octave_value
@@ -191,9 +195,10 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
 
-  MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (), \
-		 ComplexMatrix, m2, v2.complex_matrix_value (), \
-		 m1 (i, j) || m2 (i, j) != 0.0, "|", Matrix ());
+  MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (),
+		 ComplexMatrix, m2, v2.complex_matrix_value (),
+		 m1 (i, j) || m2 (i, j) != 0.0, "|",
+		 Matrix (), Matrix ());
 }
 
 static octave_value *
--- a/src/op-m-cs.cc
+++ b/src/op-m-cs.cc
@@ -119,8 +119,8 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&);
 
-  MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), \
-		 Complex, s, v2.complex_value (), \
+  MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (),
+		 Complex, s, v2.complex_value (),
 		 m (i, j) == s, 0.0);
 }
 
@@ -145,8 +145,8 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&);
 
-  MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), \
-		 Complex, s, v2.complex_value (), \
+  MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (),
+		 Complex, s, v2.complex_value (),
 		 m (i, j) != s, 1.0);
 }
 
@@ -192,8 +192,8 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&);
 
-  MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), \
-		 Complex, s, v2.complex_value (), \
+  MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (),
+		 Complex, s, v2.complex_value (),
 		 m (i, j) && s != 0.0, Matrix ());
 }
 
@@ -202,8 +202,8 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&);
 
-  MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), \
-		 Complex, s, v2.complex_value (), \
+  MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (),
+		 Complex, s, v2.complex_value (),
 		 m (i, j) || s != 0.0, Matrix ());
 }
 
--- a/src/op-m-m.cc
+++ b/src/op-m-m.cc
@@ -86,17 +86,18 @@
   return xleftdiv (v1.matrix_value (), v2.matrix_value ());
 }
 
-#define BOOL_OP(OP, EMPTY_RESULT) \
+#define BOOL_OP(OP, ONE_EMPTY_RESULT, TWO_EMPTY_RESULT) \
   MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (), \
 		 Matrix, m2, v2.matrix_value (), \
-		 m1 (i, j) OP m2 (i, j), #OP, EMPTY_RESULT)
+		 m1 (i, j) OP m2 (i, j), #OP, \
+		 ONE_EMPTY_RESULT, TWO_EMPTY_RESULT)
 
 static octave_value
 lt (const octave_value& a1, const octave_value& a2)
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
 
-  BOOL_OP (<, Matrix ());
+  BOOL_OP (<, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -104,7 +105,7 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
 
-  BOOL_OP (<=, Matrix ());
+  BOOL_OP (<=, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -112,7 +113,7 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
 
-  BOOL_OP (==, 1.0);
+  BOOL_OP (==, 0.0, 1.0);
 }
 
 static octave_value
@@ -120,7 +121,7 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
 
-  BOOL_OP (>=, Matrix ());
+  BOOL_OP (>=, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -128,7 +129,7 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
 
-  BOOL_OP (>, Matrix ());
+  BOOL_OP (>, Matrix (), Matrix ());
 }
 
 static octave_value
@@ -136,7 +137,7 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
 
-  BOOL_OP (!=, 0.0);
+  BOOL_OP (!=, 1.0, 0.0);
 }
 
 static octave_value
@@ -176,9 +177,10 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
 
-  MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (), \
-		 Matrix, m2, v2.matrix_value (), \
-		 m1 (i, j) && m2 (i, j), "&", Matrix ());
+  MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (),
+		 Matrix, m2, v2.matrix_value (),
+		 m1 (i, j) && m2 (i, j), "&",
+		 Matrix (), Matrix ());
 }
 
 static octave_value
@@ -186,9 +188,10 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
 
-  MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (), \
-		 Matrix, m2, v2.matrix_value (), \
-		 m1 (i, j) || m2 (i, j), "|", Matrix ());
+  MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (),
+		 Matrix, m2, v2.matrix_value (),
+		 m1 (i, j) || m2 (i, j), "|",
+		 Matrix (), Matrix ());
 }
 
 static octave_value
--- a/src/op-m-s.cc
+++ b/src/op-m-s.cc
@@ -187,8 +187,8 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&);
 
-  MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), \
-                 double, s, v2.double_value (), \
+  MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (),
+                 double, s, v2.double_value (),
 		 m (i, j) && s, Matrix ());
 }
 
@@ -197,8 +197,8 @@
 {
   CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&);
 
-  MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), \
-                 double, s, v2.double_value (), \
+  MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (),
+                 double, s, v2.double_value (),
 		 m (i, j) || s, Matrix ());
 }
 
--- a/src/op-s-cm.cc
+++ b/src/op-s-cm.cc
@@ -118,8 +118,8 @@
 {
   CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&);
 
-  SC_MX_BOOL_OP (double, s, v1.double_value (), \
-		 ComplexMatrix, m, v2.complex_matrix_value (), \
+  SC_MX_BOOL_OP (double, s, v1.double_value (),
+		 ComplexMatrix, m, v2.complex_matrix_value (),
 		 s == m (i, j), 0.0);
 }
 
@@ -144,8 +144,8 @@
 {
   CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&);
 
-  SC_MX_BOOL_OP (double, s, v1.double_value (), \
-		 ComplexMatrix, m, v2.complex_matrix_value (), \
+  SC_MX_BOOL_OP (double, s, v1.double_value (),
+		 ComplexMatrix, m, v2.complex_matrix_value (),
 		 s != m (i, j), 1.0);
 }
 
@@ -191,8 +191,8 @@
 {
   CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&);
 
-  SC_MX_BOOL_OP (double, s, v1.double_value (), \
-		 ComplexMatrix, m, v2.complex_matrix_value (), \
+  SC_MX_BOOL_OP (double, s, v1.double_value (),
+		 ComplexMatrix, m, v2.complex_matrix_value (),
 		 s && m (i, j) != 0.0, Matrix ());
 }
 
@@ -201,8 +201,8 @@
 {
   CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&);
 
-  SC_MX_BOOL_OP (double, s, v1.double_value (), \
-		 ComplexMatrix, m, v2.complex_matrix_value (), \
+  SC_MX_BOOL_OP (double, s, v1.double_value (),
+		 ComplexMatrix, m, v2.complex_matrix_value (),
 		 s || m (i, j) != 0.0, Matrix ());
 }
 
--- a/src/op-s-m.cc
+++ b/src/op-s-m.cc
@@ -187,8 +187,8 @@
 {
   CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&);
 
-  SC_MX_BOOL_OP (double, s, v1.double_value (), \
-                 Matrix, m, v2.matrix_value (), \
+  SC_MX_BOOL_OP (double, s, v1.double_value (),
+                 Matrix, m, v2.matrix_value (),
 		 s && m (i, j), Matrix ());
 }
 
@@ -197,8 +197,8 @@
 {
   CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&);
 
-  SC_MX_BOOL_OP (double, s, v1.double_value (), \
-                 Matrix, m, v2.matrix_value (), \
+  SC_MX_BOOL_OP (double, s, v1.double_value (),
+                 Matrix, m, v2.matrix_value (),
 		 s || m (i, j), Matrix ());
 }
 
--- a/src/op-str-str.cc
+++ b/src/op-str-str.cc
@@ -63,7 +63,7 @@
 		       c == m (i, j), 0.0);
       else
 	MX_MX_BOOL_OP (charMatrix, m1, cm1, charMatrix, m2, cm2,
-		       m1 (i, j) == m2 (i, j), "==", 0.0);
+		       m1 (i, j) == m2 (i, j), "==", 0.0, 1.0);
     }
 }
 
@@ -81,21 +81,17 @@
       if (cm2.rows () == 1 && cm2.columns () == 1)
 	return octave_value (cm1 (0, 0) != cm2 (0, 0));
       else
-	SC_MX_BOOL_OP (char, c, cm1 (0, 0), \
-		       charMatrix, m, cm2, \
+	SC_MX_BOOL_OP (char, c, cm1 (0, 0), charMatrix, m, cm2,
 		       c != m (i, j), 1.0);
     }
   else
     {
       if (cm2.rows () == 1 && cm2.columns () == 1)
-	MX_SC_BOOL_OP (charMatrix, m, cm1, \
-		       char, c, cm2 (0, 0), \
+	MX_SC_BOOL_OP (charMatrix, m, cm1, char, c, cm2 (0, 0),
 		       c != m (i, j), 1.0);
       else
-	MX_MX_BOOL_OP (charMatrix, m1, cm1, \
-		       charMatrix, m2, cm2, \
-		       m1 (i, j) != m2 (i, j), \
-		       "!=", 1.0);
+	MX_MX_BOOL_OP (charMatrix, m1, cm1, charMatrix, m2, cm2,
+		       m1 (i, j) != m2 (i, j), "!=", 1.0, 0.0);
     }
 }
 
--- a/src/ops.h
+++ b/src/ops.h
@@ -83,7 +83,7 @@
   while (0)
 
 #define MX_MX_BOOL_OP(m1t, m1n, get_m1, m2t, m2n, get_m2, test, op, \
-		      empty_result) \
+		      one_empty_result, two_empty_result) \
   do \
     { \
       BOOL_OP1 (m1t, m1n, get_m1, m2t, m2n, get_m2) \
@@ -91,15 +91,27 @@
       int m1_nc = m1n.cols (); \
       int m2_nr = m2n.rows (); \
       int m2_nc = m2n.cols (); \
-      if (m1_nr != m2_nr || m1_nc != m2_nc) \
+      if (m1_nr == m2_nr && m1_nc == m2_nc) \
 	{ \
-	  gripe_nonconformant ("operator " op, m1_nr, m1_nc, m2_nr, m2_nc); \
-	  return Matrix (); \
+	  if (m1_nr == 0 && m1_nc == 0) \
+	    return two_empty_result; \
+	  else \
+	    { \
+	      BOOL_OP2 (m1n) \
+	      BOOL_OP3 (test) \
+	    } \
 	} \
-      if (m1_nr == 0 || m1_nc == 0) \
-	return empty_result; \
-      BOOL_OP2 (m1n) \
-      BOOL_OP3 (test) \
+      else \
+	{ \
+	  if ((m1_nr == 0 && m1_nc == 0) || (m2_nr == 0 && m2_nc == 0)) \
+	    return one_empty_result; \
+	  else \
+	    { \
+	      gripe_nonconformant ("operator " op, m1_nr, m1_nc, \
+				   m2_nr, m2_nc); \
+	      return Matrix (); \
+	    } \
+	} \
     } \
   while (0)