changeset 2870:3241d0057e78

[project @ 1997-04-19 01:21:29 by jwe]
author jwe
date Sat, 19 Apr 1997 01:23:06 +0000
parents 0da4980855bc
children c691fdf6bebb
files doc/faq/Makefile.in liboctave/CMatrix.cc liboctave/CMatrix.h liboctave/dMatrix.cc liboctave/dMatrix.h liboctave/mx-cdm-cm.cc liboctave/mx-cdm-cs.cc liboctave/mx-cdm-dm.cc liboctave/mx-cdm-m.cc liboctave/mx-cdm-s.cc liboctave/mx-cm-cdm.cc liboctave/mx-cm-dm.cc liboctave/mx-cm-m.cc liboctave/mx-cm-s.cc liboctave/mx-cs-cdm.cc liboctave/mx-cs-dm.cc liboctave/mx-cs-m.cc liboctave/mx-dm-cdm.cc liboctave/mx-dm-cm.cc liboctave/mx-dm-cs.cc liboctave/mx-dm-m.cc liboctave/mx-dm-s.cc liboctave/mx-inlines.cc liboctave/mx-m-cdm.cc liboctave/mx-m-cm.cc liboctave/mx-m-cs.cc liboctave/mx-m-dm.cc liboctave/mx-op-defs.h liboctave/mx-s-cdm.cc liboctave/mx-s-cm.cc liboctave/mx-s-dm.cc scripts/ChangeLog scripts/miscellaneous/xor.m test/ChangeLog
diffstat 34 files changed, 606 insertions(+), 169 deletions(-) [+]
line wrap: on
line diff
--- a/doc/faq/Makefile.in
+++ b/doc/faq/Makefile.in
@@ -20,9 +20,9 @@
 
 SOURCES =
 
-TEXINFO := FAQ.texi
+TEXINFO := Octave-FAQ.texi
 
-FORMATTED := FAQ.info FAQ.dvi FAQ.ps
+FORMATTED := Octave-FAQ.info Octave-FAQ.dvi Octave-FAQ.ps
 
 DISTFILES := Makefile.in $(TEXINFO) $(FORMATTED)
 
@@ -35,19 +35,19 @@
 	sed -e 's/@@/ at /g' -e 's/@[a-zA-Z]*//g' $< | spell > $@.tmp
 	mv $@.tmp $@
 
-all: FAQ.info FAQ.dvi FAQ.ps
+all: Octave-FAQ.info Octave-FAQ.dvi Octave-FAQ.ps
 .PHONY: all
 
-FAQ.info: FAQ.texi
-	-makeinfo -I$(srcdir) $(srcdir)/FAQ.texi
+Octave-FAQ.info: Octave-FAQ.texi
+	-makeinfo -I$(srcdir) $(srcdir)/Octave-FAQ.texi
 
-FAQ.dvi: FAQ.texi
+Octave-FAQ.dvi: Octave-FAQ.texi
 	-TEXINPUTS="$(srcdir):$(srcdir)/..:$(TEXINPUTS):" ; \
 	  export TEXINPUTS ; \
-	  $(TEXI2DVI) $(srcdir)/FAQ.texi
+	  $(TEXI2DVI) $(srcdir)/Octave-FAQ.texi
 
-FAQ.ps: FAQ.dvi
-	-dvips -o FAQ.ps FAQ.dvi
+Octave-FAQ.ps: Octave-FAQ.dvi
+	-dvips -o Octave-FAQ.ps Octave-FAQ.dvi
 
 check install install-strip uninstall:
 .PHONY: check install install-strip uninstall
@@ -62,9 +62,10 @@
 .PHONY: spell
 
 mostlyclean clean:
-	rm -f FAQ.cp FAQ.fn FAQ.ky FAQ.pg FAQ.tp FAQ.vr \
-	FAQ.cps FAQ.fns FAQ.kys FAQ.pgs FAQ.tps FAQ.vrs \
-	FAQ.aux	FAQ.log FAQ.toc
+	rm -f Octave-FAQ.cp Octave-FAQ.fn Octave-FAQ.ky Octave-FAQ.pg \
+	Octave-FAQ.tp Octave-FAQ.vr Octave-FAQ.cps Octave-FAQ.fns \
+	Octave-FAQ.kys Octave-FAQ.pgs Octave-FAQ.tps Octave-FAQ.vrs \
+	Octave-FAQ.aux	Octave-FAQ.log Octave-FAQ.toc
 .PHONY: mostlyclean clean
 
 distclean: clean
@@ -72,7 +73,8 @@
 .PHONY: distclean
 
 maintainer-clean: distclean
-	rm -f tags TAGS FAQ.info FAQ.info-* FAQ.dvi FAQ.ps
+	rm -f tags TAGS Octave-FAQ.info Octave-FAQ.info-* \
+	Octave-FAQ.dvi Octave-FAQ.ps
 .PHONY: maintainer-clean
 
 dist: all
--- a/liboctave/CMatrix.cc
+++ b/liboctave/CMatrix.cc
@@ -2878,6 +2878,15 @@
   return retval;
 }
 
+MS_CMP_OPS(ComplexMatrix, real, Complex, real)
+MS_BOOL_OPS(ComplexMatrix, Complex)
+
+SM_CMP_OPS(Complex, real, ComplexMatrix, real)
+SM_BOOL_OPS(Complex, ComplexMatrix)
+
+MM_CMP_OPS(ComplexMatrix, real, ComplexMatrix, real)
+MM_BOOL_OPS(ComplexMatrix, ComplexMatrix)
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/liboctave/CMatrix.h
+++ b/liboctave/CMatrix.h
@@ -31,6 +31,7 @@
 #include "MDiagArray2.h"
 
 #include "mx-defs.h"
+#include "mx-op-defs.h"
 #include "oct-cmplx.h"
 
 class ComplexMatrix : public MArray2<Complex>
@@ -259,6 +260,15 @@
 extern ComplexMatrix operator * (const ComplexMatrix&, const Matrix&);
 extern ComplexMatrix operator * (const ComplexMatrix&, const ComplexMatrix&);
 
+MS_CMP_OP_DECLS (ComplexMatrix, Complex)
+MS_BOOL_OP_DECLS (ComplexMatrix, Complex)
+
+SM_CMP_OP_DECLS (Complex, ComplexMatrix)
+SM_BOOL_OP_DECLS (Complex, ComplexMatrix)
+
+MM_CMP_OP_DECLS (ComplexMatrix, ComplexMatrix)
+MM_BOOL_OP_DECLS (ComplexMatrix, ComplexMatrix)
+
 #endif
 
 /*
--- a/liboctave/dMatrix.cc
+++ b/liboctave/dMatrix.cc
@@ -3049,6 +3049,15 @@
   return retval;
 }
 
+MS_CMP_OPS(Matrix, , double, )
+MS_BOOL_OPS(Matrix, double)
+
+SM_CMP_OPS(double, , Matrix, )
+SM_BOOL_OPS(double, Matrix)
+
+MM_CMP_OPS(Matrix, , Matrix, )
+MM_BOOL_OPS(Matrix, Matrix)
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/liboctave/dMatrix.h
+++ b/liboctave/dMatrix.h
@@ -31,6 +31,7 @@
 #include "MDiagArray2.h"
 
 #include "mx-defs.h"
+#include "mx-op-defs.h"
 
 #include "data-conv.h"
 #include "mach-info.h"
@@ -237,6 +238,15 @@
 
 extern Matrix operator * (const Matrix& a, const Matrix& b);
 
+MS_CMP_OP_DECLS (Matrix, double)
+MS_BOOL_OP_DECLS (Matrix, double)
+
+SM_CMP_OP_DECLS (double, Matrix)
+SM_BOOL_OP_DECLS (double, Matrix)
+
+MM_CMP_OP_DECLS (Matrix, Matrix)
+MM_BOOL_OP_DECLS (Matrix, Matrix)
+
 #endif
 
 /*
--- a/liboctave/mx-cdm-cm.cc
+++ b/liboctave/mx-cdm-cm.cc
@@ -29,7 +29,7 @@
 #include "CMatrix.h"
 #include "CDiagMatrix.h"
 
-DMM_OPS (ComplexMatrix, ComplexDiagMatrix, ComplexMatrix)
+DMM_BIN_OPS (ComplexMatrix, ComplexDiagMatrix, ComplexMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-cdm-cs.cc
+++ b/liboctave/mx-cdm-cs.cc
@@ -29,7 +29,7 @@
 #include "CMatrix.h"
 #include "CDiagMatrix.h"
 
-DMS_OPS (ComplexMatrix, ComplexDiagMatrix, Complex)
+DMS_BIN_OPS (ComplexMatrix, ComplexDiagMatrix, Complex)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-cdm-dm.cc
+++ b/liboctave/mx-cdm-dm.cc
@@ -29,7 +29,7 @@
 #include "dDiagMatrix.h"
 #include "CDiagMatrix.h"
 
-DMDM_OPS (ComplexDiagMatrix, ComplexDiagMatrix, DiagMatrix)
+DMDM_BIN_OPS (ComplexDiagMatrix, ComplexDiagMatrix, DiagMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-cdm-m.cc
+++ b/liboctave/mx-cdm-m.cc
@@ -30,7 +30,7 @@
 #include "CMatrix.h"
 #include "CDiagMatrix.h"
 
-DMM_OPS (ComplexMatrix, ComplexDiagMatrix, Matrix)
+DMM_BIN_OPS (ComplexMatrix, ComplexDiagMatrix, Matrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-cdm-s.cc
+++ b/liboctave/mx-cdm-s.cc
@@ -29,7 +29,7 @@
 #include "CMatrix.h"
 #include "CDiagMatrix.h"
 
-DMS_OPS (ComplexMatrix, ComplexDiagMatrix, double)
+DMS_BIN_OPS (ComplexMatrix, ComplexDiagMatrix, double)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-cm-cdm.cc
+++ b/liboctave/mx-cm-cdm.cc
@@ -29,7 +29,7 @@
 #include "CMatrix.h"
 #include "CDiagMatrix.h"
 
-MDM_OPS (ComplexMatrix, ComplexMatrix, ComplexDiagMatrix)
+MDM_BIN_OPS (ComplexMatrix, ComplexMatrix, ComplexDiagMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-cm-dm.cc
+++ b/liboctave/mx-cm-dm.cc
@@ -29,7 +29,7 @@
 #include "CMatrix.h"
 #include "dDiagMatrix.h"
 
-MDM_OPS (ComplexMatrix, ComplexMatrix, DiagMatrix)
+MDM_BIN_OPS (ComplexMatrix, ComplexMatrix, DiagMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-cm-m.cc
+++ b/liboctave/mx-cm-m.cc
@@ -26,10 +26,15 @@
 
 #include "mx-cm-m.h"
 
+#include "boolMatrix.h"
 #include "dMatrix.h"
 #include "CMatrix.h"
 
-MM_OPS (ComplexMatrix, ComplexMatrix, Matrix)
+MM_BIN_OPS (ComplexMatrix, ComplexMatrix, Matrix)
+
+MM_CMP_OPS (ComplexMatrix, real, Matrix, )
+
+MM_BOOL_OPS (ComplexMatrix, Matrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-cm-s.cc
+++ b/liboctave/mx-cm-s.cc
@@ -26,9 +26,14 @@
 
 #include "mx-cm-s.h"
 
+#include "boolMatrix.h"
 #include "CMatrix.h"
 
-MS_OPS (ComplexMatrix, ComplexMatrix, double)
+MS_BIN_OPS (ComplexMatrix, ComplexMatrix, double)
+
+MS_CMP_OPS (ComplexMatrix, real, double, )
+
+MS_BOOL_OPS (ComplexMatrix, double)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-cs-cdm.cc
+++ b/liboctave/mx-cs-cdm.cc
@@ -29,7 +29,7 @@
 #include "CMatrix.h"
 #include "CDiagMatrix.h"
 
-SDM_OPS (ComplexMatrix, Complex, ComplexDiagMatrix)
+SDM_BIN_OPS (ComplexMatrix, Complex, ComplexDiagMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-cs-dm.cc
+++ b/liboctave/mx-cs-dm.cc
@@ -29,7 +29,7 @@
 #include "CMatrix.h"
 #include "dDiagMatrix.h"
 
-SDM_OPS (ComplexMatrix, Complex, DiagMatrix)
+SDM_BIN_OPS (ComplexMatrix, Complex, DiagMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-cs-m.cc
+++ b/liboctave/mx-cs-m.cc
@@ -26,10 +26,15 @@
 
 #include "mx-cs-m.h"
 
+#include "boolMatrix.h"
 #include "dMatrix.h"
 #include "CMatrix.h"
 
-SM_OPS (ComplexMatrix, Complex, Matrix)
+SM_BIN_OPS (ComplexMatrix, Complex, Matrix)
+
+SM_CMP_OPS (Complex, real, Matrix, )
+
+SM_BOOL_OPS (Complex, Matrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-dm-cdm.cc
+++ b/liboctave/mx-dm-cdm.cc
@@ -29,7 +29,7 @@
 #include "dDiagMatrix.h"
 #include "CDiagMatrix.h"
 
-DMDM_OPS (ComplexDiagMatrix, DiagMatrix, ComplexDiagMatrix)
+DMDM_BIN_OPS (ComplexDiagMatrix, DiagMatrix, ComplexDiagMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-dm-cm.cc
+++ b/liboctave/mx-dm-cm.cc
@@ -29,7 +29,7 @@
 #include "CMatrix.h"
 #include "dDiagMatrix.h"
 
-DMM_OPS (ComplexMatrix, DiagMatrix, ComplexMatrix)
+DMM_BIN_OPS (ComplexMatrix, DiagMatrix, ComplexMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-dm-cs.cc
+++ b/liboctave/mx-dm-cs.cc
@@ -29,7 +29,7 @@
 #include "CMatrix.h"
 #include "dDiagMatrix.h"
 
-DMS_OPS (ComplexMatrix, DiagMatrix, Complex)
+DMS_BIN_OPS (ComplexMatrix, DiagMatrix, Complex)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-dm-m.cc
+++ b/liboctave/mx-dm-m.cc
@@ -29,7 +29,7 @@
 #include "dMatrix.h"
 #include "dDiagMatrix.h"
 
-DMM_OPS (Matrix, DiagMatrix, Matrix)
+DMM_BIN_OPS (Matrix, DiagMatrix, Matrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-dm-s.cc
+++ b/liboctave/mx-dm-s.cc
@@ -29,7 +29,7 @@
 #include "dMatrix.h"
 #include "dDiagMatrix.h"
 
-DMS_OPS (Matrix, DiagMatrix, double)
+DMS_BIN_OPS (Matrix, DiagMatrix, double)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-inlines.cc
+++ b/liboctave/mx-inlines.cc
@@ -36,10 +36,10 @@
       r[i] = v[i] OP s; \
   }
 
-VS_OP_FCN(add, +)
-VS_OP_FCN(subtract, -)
-VS_OP_FCN(multiply, *)
-VS_OP_FCN(divide, /)
+VS_OP_FCN (add,      +)
+VS_OP_FCN (subtract, -)
+VS_OP_FCN (multiply, *)
+VS_OP_FCN (divide,   /)
 
 #define VS_OP(F, OP, R, V, S) \
   extern template void F ## _vs (R *, const V *, size_t, S); \
@@ -56,10 +56,10 @@
   }
 
 #define VS_OPS(R, V, S) \
-  VS_OP (add, +, R, S, V) \
-  VS_OP (subtract, -, R, S, V) \
-  VS_OP (multiply, *, R, S, V) \
-  VS_OP (divide, /, R, S, V)
+  VS_OP (add,      +, R, V, S) \
+  VS_OP (subtract, -, R, V, S) \
+  VS_OP (multiply, *, R, V, S) \
+  VS_OP (divide,   /, R, V, S)
 
 VS_OPS (double,  double,  double)
 VS_OPS (Complex, double,  Complex)
@@ -75,10 +75,10 @@
       r[i] = s OP v[i]; \
   } \
 
-SV_OP_FCN(add, +)
-SV_OP_FCN(subtract, -)
-SV_OP_FCN(multiply, *)
-SV_OP_FCN(divide, /)
+SV_OP_FCN (add,      +)
+SV_OP_FCN (subtract, -)
+SV_OP_FCN (multiply, *)
+SV_OP_FCN (divide,   /)
 
 #define SV_OP(F, OP, R, S, V) \
   extern template void F ## _sv (R *, S, const V *, size_t); \
@@ -95,10 +95,10 @@
   }
 
 #define SV_OPS(R, S, V) \
-  SV_OP (add,      +, R, V, S) \
-  SV_OP (subtract, -, R, V, S) \
-  SV_OP (multiply, *, R, V, S) \
-  SV_OP (divide,   /, R, V, S)
+  SV_OP (add,      +, R, S, V) \
+  SV_OP (subtract, -, R, S, V) \
+  SV_OP (multiply, *, R, S, V) \
+  SV_OP (divide,   /, R, S, V)
 
 SV_OPS (double,  double,  double)
 SV_OPS (Complex, double,  Complex)
@@ -114,10 +114,10 @@
       r[i] = v1[i] OP v2[i]; \
   } \
 
-VV_OP_FCN(add, +)
-VV_OP_FCN(subtract, -)
-VV_OP_FCN(multiply, *)
-VV_OP_FCN(divide, /)
+VV_OP_FCN (add,      +)
+VV_OP_FCN (subtract, -)
+VV_OP_FCN (multiply, *)
+VV_OP_FCN (divide,   /)
 
 #define VV_OP(F, OP, R, T1, T2) \
   extern template void F ## _vv (R *, const T1 *, const T2 *, size_t); \
--- a/liboctave/mx-m-cdm.cc
+++ b/liboctave/mx-m-cdm.cc
@@ -30,7 +30,7 @@
 #include "CMatrix.h"
 #include "CDiagMatrix.h"
 
-MDM_OPS (ComplexMatrix, Matrix, ComplexDiagMatrix)
+MDM_BIN_OPS (ComplexMatrix, Matrix, ComplexDiagMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-m-cm.cc
+++ b/liboctave/mx-m-cm.cc
@@ -26,10 +26,15 @@
 
 #include "mx-m-cm.h"
 
+#include "boolMatrix.h"
 #include "dMatrix.h"
 #include "CMatrix.h"
 
-MM_OPS (ComplexMatrix, Matrix, ComplexMatrix)
+MM_BIN_OPS (ComplexMatrix, Matrix, ComplexMatrix)
+
+MM_CMP_OPS (Matrix, , ComplexMatrix, real)
+
+MM_BOOL_OPS (Matrix, ComplexMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-m-cs.cc
+++ b/liboctave/mx-m-cs.cc
@@ -26,10 +26,15 @@
 
 #include "mx-m-cs.h"
 
+#include "boolMatrix.h"
 #include "dMatrix.h"
 #include "CMatrix.h"
 
-MS_OPS (ComplexMatrix, Matrix, Complex)
+MS_BIN_OPS (ComplexMatrix, Matrix, Complex)
+
+MS_CMP_OPS (Matrix, , Complex, real)
+
+MS_BOOL_OPS (Matrix, Complex)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-m-dm.cc
+++ b/liboctave/mx-m-dm.cc
@@ -29,7 +29,7 @@
 #include "dMatrix.h"
 #include "dDiagMatrix.h"
 
-MDM_OPS (Matrix, Matrix, DiagMatrix)
+MDM_BIN_OPS (Matrix, Matrix, DiagMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-op-defs.h
+++ b/liboctave/mx-op-defs.h
@@ -28,48 +28,123 @@
 #define BIN_OP_DECL(R, OP, X, Y) \
   extern R OP (const X&, const Y&)
 
-#define MS_OP_DECLS(R, M, S) \
+class boolMatrix;
+
+#define CMP_OP_DECL(OP, X, Y) \
+  extern boolMatrix OP (const X&, const Y&)
+
+#define BOOL_OP_DECL(OP, X, Y) \
+  extern boolMatrix OP (const X&, const Y&)
+
+#define TBM boolMatrix (1, 1, true)
+#define FBM boolMatrix (1, 1, false)
+#define NBM boolMatrix ()
+
+#if 0
+
+// vector by scalar operations.
+
+#define VS_BIN_OP_DECLS(R, V, S) \
+  BIN_OP_DECL (R, operator +, V, S); \
+  BIN_OP_DECL (R, operator -, V, S); \
+  BIN_OP_DECL (R, operator *, V, S); \
+  BIN_OP_DECL (R, operator /, V, S);
+
+#define VS_BIN_OP(R, F, OP, V, S) \
+  R \
+  F (const V& v, const S& s) \
+  { \
+    int len = v.length (); \
+ \
+    R r (len); \
+ \
+    for (size_t i = 0; i < len; i++) \
+      r.elem(i) = v.elem(i) OP s; \
+ \
+    return r; \
+  }
+
+#define VS_BIN_OPS(R, V, S) \
+  VS_BIN_OP (R, operator +, +, V, S) \
+  VS_BIN_OP (R, operator -, -, V, S) \
+  VS_BIN_OP (R, operator *, *, V, S) \
+  VS_BIN_OP (R, operator /, /, V, S)
+
+// scalar by vector by operations.
+
+#define SV_BIN_OP_DECLS(R, S, V) \
+  BIN_OP_DECL (R, operator +, S, V); \
+  BIN_OP_DECL (R, operator -, S, V); \
+  BIN_OP_DECL (R, operator *, S, V); \
+  BIN_OP_DECL (R, operator /, S, V);
+
+#define SV_BIN_OP(R, F, OP, S, V) \
+  R \
+  F (const S& s, const V& v) \
+  { \
+    int len = v.length (); \
+ \
+    R r (len); \
+ \
+    for (size_t i = 0; i < len; i++) \
+      r.elem(i) = s OP v.elem(i); \
+ \
+    return r; \
+  }
+
+#define SV_BIN_OPS(R, S, V) \
+  SV_BIN_OP (R, operator +, +, S, V) \
+  SV_BIN_OP (R, operator -, -, S, V) \
+  SV_BIN_OP (R, operator *, *, S, V) \
+  SV_BIN_OP (R, operator /, /, S, V)
+
+// vector by vector operations.
+
+#define VV_BIN_OP_DECLS(R, V1, V2) \
+  BIN_OP_DECL (R, operator +, V1, V2); \
+  BIN_OP_DECL (R, operator -, V1, V2); \
+  BIN_OP_DECL (R, product,    V1, V2); \
+  BIN_OP_DECL (R, quotient,   V1, V2);
+
+#define VV_BIN_OP(R, F, OP, V1, V2) \
+  R \
+  F (const V1& v1, const V2& v2) \
+  { \
+    R r; \
+ \
+    int v1_len = v1.length (); \
+    int v2_len = v2.length (); \
+ \
+    if (v1_len != v2_len) \
+      gripe_nonconformant (#OP, v1_len, v2_len); \
+    else \
+      { \
+	r.resize (v1_len); \
+ \
+	for (size_t i = 0; i < v1_len; i++) \
+	  r.elem(i) = v1.elem(i) OP v2.elem(i); \
+      } \
+ \
+    return r; \
+  }
+
+#define VV_BIN_OPS(R, V1, V2) \
+  VV_BIN_OP (R, operator +, +, V1, V2) \
+  VV_BIN_OP (R, operator -, -, V1, V2) \
+  VV_BIN_OP (R, product,    *, V1, V2) \
+  VV_BIN_OP (R, quotient,   /, V1, V2)
+
+#endif
+
+// matrix by scalar operations.
+
+#define MS_BIN_OP_DECLS(R, M, S) \
   BIN_OP_DECL (R, operator +, M, S); \
   BIN_OP_DECL (R, operator -, M, S); \
   BIN_OP_DECL (R, operator *, M, S); \
   BIN_OP_DECL (R, operator /, M, S);
 
-#define SM_OP_DECLS(R, S, M) \
-  BIN_OP_DECL (R, operator +, S, M); \
-  BIN_OP_DECL (R, operator -, S, M); \
-  BIN_OP_DECL (R, operator *, S, M); \
-  BIN_OP_DECL (R, operator /, S, M);
-
-#define MM_OP_DECLS(R, M1, M2) \
-  BIN_OP_DECL (R, operator +, M1, M2); \
-  BIN_OP_DECL (R, operator -, M1, M2); \
-  BIN_OP_DECL (R, product,    M1, M2); \
-  BIN_OP_DECL (R, quotient,   M1, M2);
-
-#define SDM_OP_DECLS(R, S, DM) \
-  BIN_OP_DECL (R, operator +, S, DM); \
-  BIN_OP_DECL (R, operator -, S, DM);
-
-#define DMS_OP_DECLS(R, DM, S) \
-  BIN_OP_DECL (R, operator +, DM, S); \
-  BIN_OP_DECL (R, operator -, DM, S);
-
-#define MDM_OP_DECLS(R, M, DM) \
-  BIN_OP_DECL (R, operator +, M, DM); \
-  BIN_OP_DECL (R, operator -, M, DM); \
-  BIN_OP_DECL (R, operator *, M, DM);
-
-#define DMM_OP_DECLS(R, DM, M) \
-  BIN_OP_DECL (R, operator +, DM, M); \
-  BIN_OP_DECL (R, operator -, DM, M); \
-  BIN_OP_DECL (R, operator *, DM, M);
-
-#define DMDM_OP_DECLS(R, DM1, DM2) \
-  BIN_OP_DECL (R, operator +, DM1, DM2); \
-  BIN_OP_DECL (R, operator -, DM1, DM2); \
-  BIN_OP_DECL (R, product, DM1, DM2);
-
-#define MS_OP(R, OP, M, S, F) \
+#define MS_BIN_OP(R, OP, M, S, F) \
   R \
   OP (const M& m, const S& s) \
   { \
@@ -84,13 +159,94 @@
     return r; \
   }
 
-#define MS_OPS(R, M, S) \
-  MS_OP (R, operator +, M, S, add) \
-  MS_OP (R, operator -, M, S, subtract) \
-  MS_OP (R, operator *, M, S, multiply) \
-  MS_OP (R, operator /, M, S, divide)
+#define MS_BIN_OPS(R, M, S) \
+  MS_BIN_OP (R, operator +, M, S, add) \
+  MS_BIN_OP (R, operator -, M, S, subtract) \
+  MS_BIN_OP (R, operator *, M, S, multiply) \
+  MS_BIN_OP (R, operator /, M, S, divide)
+
+#define MS_CMP_OP_DECLS(M, S) \
+  CMP_OP_DECL (mx_el_lt, M, S); \
+  CMP_OP_DECL (mx_el_le, M, S); \
+  CMP_OP_DECL (mx_el_ge, M, S); \
+  CMP_OP_DECL (mx_el_gt, M, S); \
+  CMP_OP_DECL (mx_el_eq, M, S); \
+  CMP_OP_DECL (mx_el_ne, M, S);
+
+#define MS_CMP_OP(F, OP, M, MC, S, SC, EMPTY_RESULT) \
+  boolMatrix \
+  F (const M& m, const S& s) \
+  { \
+    boolMatrix r; \
+ \
+    int nr = m.rows (); \
+    int nc = m.cols (); \
+ \
+    if (nr == 0 || nc == 0) \
+      r = EMPTY_RESULT; \
+    else \
+      { \
+        r.resize (nr, nc); \
+ \
+        for (int j = 0; j < nc; j++) \
+          for (int i = 0; i < nr; i++) \
+	    r.elem(i, j) = MC (m.elem(i, j)) OP SC (s); \
+      } \
+ \
+    return r; \
+  }
 
-#define SM_OP(R, OP, S, M, F) \
+#define MS_CMP_OPS(M, CM, S, CS) \
+  MS_CMP_OP (mx_el_lt, <,  M, CM, S, CS, NBM) \
+  MS_CMP_OP (mx_el_le, <=, M, CM, S, CS, NBM) \
+  MS_CMP_OP (mx_el_ge, >=, M, CM, S, CS, NBM) \
+  MS_CMP_OP (mx_el_gt, >,  M, CM, S, CS, NBM) \
+  MS_CMP_OP (mx_el_eq, ==, M,   , S,   , FBM) \
+  MS_CMP_OP (mx_el_ne, !=, M,   , S,   , TBM)
+
+#define MS_BOOL_OP_DECLS(M, S) \
+  BOOL_OP_DECL (mx_el_and, M, S); \
+  BOOL_OP_DECL (mx_el_or,  M, S); \
+
+#define MS_BOOL_OP(F, OP, M, S) \
+  boolMatrix \
+  F (const M& m, const S& s) \
+  { \
+    boolMatrix r; \
+ \
+    int nr = m.rows (); \
+    int nc = m.cols (); \
+ \
+    if (nr != 0 && nc != 0) \
+      { \
+        r.resize (nr, nc); \
+ \
+        for (int j = 0; j < nc; j++) \
+          for (int i = 0; i < nr; i++) \
+	    r.elem(i, j) = (m.elem(i, j) != 0) OP (s != 0); \
+      } \
+ \
+    return r; \
+  }
+
+#define MS_BOOL_OPS(M, S) \
+  MS_BOOL_OP (mx_el_and, &&, M, S) \
+  MS_BOOL_OP (mx_el_or,  ||, M, S)
+
+#define MS_OP_DECLS(R, M, S) \
+  MS_BIN_OP_DECLS (R, M, S) \
+  MS_CMP_OP_DECLS (M, S) \
+  MS_BOOL_OP_DECLS (M, S) \
+
+// scalar by matrix operations.
+
+#define SM_BIN_OP_DECLS(R, S, M) \
+  BIN_OP_DECL (R, operator +, S, M); \
+  BIN_OP_DECL (R, operator -, S, M); \
+  BIN_OP_DECL (R, operator *, S, M); \
+  BIN_OP_DECL (R, operator /, S, M);
+
+#define SM_BIN_OP(R, OP, S, M, F) \
   R \
   OP (const S& s, const M& m) \
   { \
@@ -105,13 +261,94 @@
     return r; \
   }
 
-#define SM_OPS(R, S, M) \
-  SM_OP (R, operator +, S, M, add) \
-  SM_OP (R, operator -, S, M, subtract) \
-  SM_OP (R, operator *, S, M, multiply) \
-  SM_OP (R, operator /, S, M, divide)
+#define SM_BIN_OPS(R, S, M) \
+  SM_BIN_OP (R, operator +, S, M, add) \
+  SM_BIN_OP (R, operator -, S, M, subtract) \
+  SM_BIN_OP (R, operator *, S, M, multiply) \
+  SM_BIN_OP (R, operator /, S, M, divide)
+
+#define SM_CMP_OP_DECLS(S, M) \
+  CMP_OP_DECL (mx_el_lt, S, M); \
+  CMP_OP_DECL (mx_el_le, S, M); \
+  CMP_OP_DECL (mx_el_ge, S, M); \
+  CMP_OP_DECL (mx_el_gt, S, M); \
+  CMP_OP_DECL (mx_el_eq, S, M); \
+  CMP_OP_DECL (mx_el_ne, S, M);
+
+#define SM_CMP_OP(F, OP, S, SC, M, MC, EMPTY_RESULT) \
+  boolMatrix \
+  F (const S& s, const M& m) \
+  { \
+    boolMatrix r; \
+ \
+    int nr = m.rows (); \
+    int nc = m.cols (); \
+ \
+    if (nr == 0 || nc == 0) \
+      r = EMPTY_RESULT; \
+    else \
+      { \
+        r.resize (nr, nc); \
+ \
+        for (int j = 0; j < nc; j++) \
+          for (int i = 0; i < nr; i++) \
+	    r.elem(i, j) = SC (s) OP MC (m.elem(i, j)); \
+      } \
+ \
+    return r; \
+  }
 
-#define MM_OP(R, OP, M1, M2, F) \
+#define SM_CMP_OPS(S, CS, M, CM) \
+  SM_CMP_OP (mx_el_lt, <,  S, CS, M, CM, NBM) \
+  SM_CMP_OP (mx_el_le, <=, S, CS, M, CM, NBM) \
+  SM_CMP_OP (mx_el_ge, >=, S, CS, M, CM, NBM) \
+  SM_CMP_OP (mx_el_gt, >,  S, CS, M, CM, NBM) \
+  SM_CMP_OP (mx_el_eq, ==, S,   , M,   , FBM) \
+  SM_CMP_OP (mx_el_ne, !=, S,   , M,   , TBM)
+
+#define SM_BOOL_OP_DECLS(S, M) \
+  BOOL_OP_DECL (mx_el_and, S, M); \
+  BOOL_OP_DECL (mx_el_or,  S, M); \
+
+#define SM_BOOL_OP(F, OP, S, M) \
+  boolMatrix \
+  F (const S& s, const M& m) \
+  { \
+    boolMatrix r; \
+ \
+    int nr = m.rows (); \
+    int nc = m.cols (); \
+ \
+    if (nr != 0 && nc != 0) \
+      { \
+        r.resize (nr, nc); \
+ \
+        for (int j = 0; j < nc; j++) \
+          for (int i = 0; i < nr; i++) \
+	    r.elem(i, j) = (s != 0) OP (m.elem(i, j) != 0); \
+      } \
+ \
+    return r; \
+  }
+
+#define SM_BOOL_OPS(S, M) \
+  SM_BOOL_OP (mx_el_and, &&, S, M) \
+  SM_BOOL_OP (mx_el_or,  ||, S, M)
+
+#define SM_OP_DECLS(R, S, M) \
+  SM_BIN_OP_DECLS (R, S, M) \
+  SM_CMP_OP_DECLS (S, M) \
+  SM_BOOL_OP_DECLS (S, M) \
+
+// matrix by matrix operations.
+
+#define MM_BIN_OP_DECLS(R, M1, M2) \
+  BIN_OP_DECL (R, operator +, M1, M2); \
+  BIN_OP_DECL (R, operator -, M1, M2); \
+  BIN_OP_DECL (R, product,    M1, M2); \
+  BIN_OP_DECL (R, quotient,   M1, M2);
+
+#define MM_BIN_OP(R, OP, M1, M2, F) \
   R \
   OP (const M1& m1, const M2& m2) \
   { \
@@ -136,13 +373,116 @@
     return r; \
   }
 
-#define MM_OPS(R, M1, M2) \
-  MM_OP (R, operator +, M1, M2, add) \
-  MM_OP (R, operator -, M1, M2, subtract) \
-  MM_OP (R, product,    M1, M2, multiply) \
-  MM_OP (R, quotient,   M1, M2, divide)
+#define MM_BIN_OPS(R, M1, M2) \
+  MM_BIN_OP (R, operator +, M1, M2, add) \
+  MM_BIN_OP (R, operator -, M1, M2, subtract) \
+  MM_BIN_OP (R, product,    M1, M2, multiply) \
+  MM_BIN_OP (R, quotient,   M1, M2, divide)
+
+#define MM_CMP_OP_DECLS(M1, M2) \
+  CMP_OP_DECL (mx_el_lt, M1, M2); \
+  CMP_OP_DECL (mx_el_le, M1, M2); \
+  CMP_OP_DECL (mx_el_ge, M1, M2); \
+  CMP_OP_DECL (mx_el_gt, M1, M2); \
+  CMP_OP_DECL (mx_el_eq, M1, M2); \
+  CMP_OP_DECL (mx_el_ne, M1, M2);
+
+#define MM_CMP_OP(F, OP, M1, C1, M2, C2, ONE_MT_RESULT, TWO_MT_RESULT) \
+  boolMatrix \
+  F (const M1& m1, const M2& m2) \
+  { \
+    boolMatrix r; \
+ \
+    int m1_nr = m1.rows (); \
+    int m1_nc = m1.cols (); \
+ \
+    int m2_nr = m2.rows (); \
+    int m2_nc = m2.cols (); \
+ \
+    if (m1_nr == m2_nr && m1_nc == m2_nc) \
+      { \
+	if (m1_nr == 0 && m1_nc == 0) \
+	  r = TWO_MT_RESULT; \
+	else \
+	  { \
+	    r.resize (m1_nr, m1_nc); \
+ \
+	    for (int j = 0; j < m1_nc; j++) \
+	      for (int i = 0; i < m1_nr; i++) \
+		r.elem(i, j) = C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j)); \
+	  } \
+      } \
+    else \
+      { \
+	if ((m1_nr == 0 && m1_nc == 0) || (m2_nr == 0 && m2_nc == 0)) \
+	  r = ONE_MT_RESULT; \
+	else \
+	  gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
+      } \
+ \
+    return r; \
+  }
 
-#define SDM_OP(R, OP, S, DM, OPEQ) \
+#define MM_CMP_OPS(M1, C1, M2, C2) \
+  MM_CMP_OP (mx_el_lt, <,  M1, C1, M2, C2, NBM, NBM) \
+  MM_CMP_OP (mx_el_le, <=, M1, C1, M2, C2, NBM, NBM) \
+  MM_CMP_OP (mx_el_ge, >=, M1, C1, M2, C2, NBM, NBM) \
+  MM_CMP_OP (mx_el_gt, >,  M1, C1, M2, C2, NBM, NBM) \
+  MM_CMP_OP (mx_el_eq, ==, M1,   , M2,   , FBM, TBM) \
+  MM_CMP_OP (mx_el_ne, !=, M1,   , M2,   , TBM, FBM)
+
+#define MM_BOOL_OP_DECLS(M1, M2) \
+  BOOL_OP_DECL (mx_el_and, M1, M2); \
+  BOOL_OP_DECL (mx_el_or,  M1, M2);
+
+#define MM_BOOL_OP(F, OP, M1, M2) \
+  boolMatrix \
+  F (const M1& m1, const M2& m2) \
+  { \
+    boolMatrix r; \
+ \
+    int m1_nr = m1.rows (); \
+    int m1_nc = m1.cols (); \
+ \
+    int m2_nr = m2.rows (); \
+    int m2_nc = m2.cols (); \
+ \
+    if (m1_nr == m2_nr && m1_nc == m2_nc) \
+      { \
+	if (m1_nr != 0 || m1_nc != 0) \
+	  { \
+	    r.resize (m1_nr, m1_nc); \
+ \
+	    for (int j = 0; j < m1_nc; j++) \
+	      for (int i = 0; i < m1_nr; i++) \
+		r.elem(i, j) = (m1.elem(i, j) != 0) OP (m2.elem(i, j) != 0); \
+	  } \
+      } \
+    else \
+      { \
+	if ((m1_nr != 0 || m1_nc != 0) && (m2_nr != 0 || m2_nc != 0)) \
+	  gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
+      } \
+ \
+    return r; \
+  }
+
+#define MM_BOOL_OPS(M1, M2) \
+  MM_BOOL_OP (mx_el_and, &&, M1, M2) \
+  MM_BOOL_OP (mx_el_or,  ||, M1, M2)
+
+#define MM_OP_DECLS(R, M1, M2) \
+  MM_BIN_OP_DECLS (R, M1, M2) \
+  MM_CMP_OP_DECLS (M1, M2) \
+  MM_BOOL_OP_DECLS (M1, M2)
+
+// scalar by diagonal matrix operations.
+
+#define SDM_BIN_OP_DECLS(R, S, DM) \
+  BIN_OP_DECL (R, operator +, S, DM); \
+  BIN_OP_DECL (R, operator -, S, DM);
+
+#define SDM_BIN_OP(R, OP, S, DM, OPEQ) \
   R \
   OP (const S& s, const DM& dm) \
   { \
@@ -154,16 +494,25 @@
     int len = dm.length (); \
  \
     for (int i = 0; i < len; i++) \
-      r.elem (i, i) OPEQ dm.elem (i, i); \
+      r.elem(i, i) OPEQ dm.elem(i, i); \
  \
     return r; \
 }
 
-#define SDM_OPS(R, S, DM) \
-  SDM_OP (R, operator +, S, DM, +=) \
-  SDM_OP (R, operator -, S, DM, -=)
+#define SDM_BIN_OPS(R, S, DM) \
+  SDM_BIN_OP (R, operator +, S, DM, +=) \
+  SDM_BIN_OP (R, operator -, S, DM, -=)
+
+#define SDM_OP_DECLS(R, S, DM) \
+  SDM_BIN_OP_DECLS(R, S, DM)
 
-#define DMS_OP(R, OP, DM, S, SGN) \
+// diagonal matrix by scalar operations.
+
+#define DMS_BIN_OP_DECLS(R, DM, S) \
+  BIN_OP_DECL (R, operator +, DM, S); \
+  BIN_OP_DECL (R, operator -, DM, S);
+
+#define DMS_BIN_OP(R, OP, DM, S, SGN) \
   R \
   OP (const DM& dm, const S& s) \
   { \
@@ -175,16 +524,26 @@
     int len = dm.length (); \
  \
     for (int i = 0; i < len; i++) \
-      r.elem (i, i) += dm.elem (i, i); \
+      r.elem(i, i) += dm.elem(i, i); \
  \
     return r; \
   }
 
-#define DMS_OPS(R, DM, S) \
-  DMS_OP (R, operator +, DM, S, ) \
-  DMS_OP (R, operator -, DM, S, -)
+#define DMS_BIN_OPS(R, DM, S) \
+  DMS_BIN_OP (R, operator +, DM, S, ) \
+  DMS_BIN_OP (R, operator -, DM, S, -)
+
+#define DMS_OP_DECLS(R, DM, S) \
+  DMS_BIN_OP_DECLS(R, DM, S)
 
-#define MDM_OP(R, OP, M, DM, OPEQ) \
+// matrix by diagonal matrix operations.
+
+#define MDM_BIN_OP_DECLS(R, M, DM) \
+  BIN_OP_DECL (R, operator +, M, DM); \
+  BIN_OP_DECL (R, operator -, M, DM); \
+  BIN_OP_DECL (R, operator *, M, DM);
+
+#define MDM_BIN_OP(R, OP, M, DM, OPEQ) \
 R \
 OP (const M& m, const DM& dm) \
 { \
@@ -209,7 +568,7 @@
 	  int len = dm.length (); \
  \
 	  for (int i = 0; i < len; i++) \
-	    r.elem (i, i) OPEQ dm.elem (i, i); \
+	    r.elem(i, i) OPEQ dm.elem(i, i); \
 	} \
     } \
  \
@@ -238,15 +597,15 @@
 	{ \
 	  for (int j = 0; j < dm.length (); j++) \
 	    { \
-	      if (dm.elem (j, j) == 1.0) \
+	      if (dm.elem(j, j) == 1.0) \
 		{ \
 		  for (int i = 0; i < m_nr; i++) \
-		    r.elem (i, j) = m.elem (i, j); \
+		    r.elem(i, j) = m.elem(i, j); \
 		} \
-	      else if (dm.elem (j, j) != 0.0) \
+	      else if (dm.elem(j, j) != 0.0) \
 		{ \
 		  for (int i = 0; i < m_nr; i++) \
-		    r.elem (i, j) = dm.elem (j, j) * m.elem (i, j); \
+		    r.elem(i, j) = dm.elem(j, j) * m.elem(i, j); \
 		} \
 	    } \
 	} \
@@ -255,14 +614,24 @@
   return r; \
 }
 
-#define MDM_OPS(R, M, DM) \
-  MDM_OP (R, operator +, M, DM, +=) \
-  MDM_OP (R, operator -, M, DM, -=) \
+#define MDM_BIN_OPS(R, M, DM) \
+  MDM_BIN_OP (R, operator +, M, DM, +=) \
+  MDM_BIN_OP (R, operator -, M, DM, -=) \
   MDM_MULTIPLY_OP (R, M, DM)
 
+#define MDM_OP_DECLS(R, M, DM) \
+  MDM_BIN_OP_DECLS(R, M, DM)
+
+// diagonal matrix by matrix operations.
+
 // XXX FIXME XXX -- DM - M will not give the correct result.
 
-#define DMM_OP(R, OP, DM, M, OPEQ) \
+#define DMM_BIN_OP_DECLS(R, DM, M) \
+  BIN_OP_DECL (R, operator +, DM, M); \
+  BIN_OP_DECL (R, operator -, DM, M); \
+  BIN_OP_DECL (R, operator *, DM, M);
+
+#define DMM_BIN_OP(R, OP, DM, M, OPEQ) \
 R \
 OP (const DM& dm, const M& m) \
 { \
@@ -285,7 +654,7 @@
 	  int len = dm.length (); \
  \
 	  for (int i = 0; i < len; i++) \
-	    r.elem (i, i) OPEQ dm.elem (i, i); \
+	    r.elem(i, i) OPEQ dm.elem(i, i); \
 	} \
       else \
 	r.resize (m_nr, m_nc); \
@@ -316,15 +685,15 @@
 	{ \
 	  for (int i = 0; i < dm.length (); i++) \
 	    { \
-	      if (dm.elem (i, i) == 1.0) \
+	      if (dm.elem(i, i) == 1.0) \
 		{ \
 		  for (int j = 0; j < m_nc; j++) \
-		    r.elem (i, j) = m.elem (i, j); \
+		    r.elem(i, j) = m.elem(i, j); \
 		} \
-	      else if (dm.elem (i, i) != 0.0) \
+	      else if (dm.elem(i, i) != 0.0) \
 		{ \
 		  for (int j = 0; j < m_nc; j++) \
-		    r.elem (i, j) = dm.elem (i, i) * m.elem (i, j); \
+		    r.elem(i, j) = dm.elem(i, i) * m.elem(i, j); \
 		} \
 	    } \
 	} \
@@ -333,37 +702,22 @@
   return r; \
 }
 
-#define DMM_OPS(R, DM, M) \
-  DMM_OP (R, operator +, DM, M, +=) \
-  DMM_OP (R, operator -, DM, M, -=) \
+#define DMM_BIN_OPS(R, DM, M) \
+  DMM_BIN_OP (R, operator +, DM, M, +=) \
+  DMM_BIN_OP (R, operator -, DM, M, -=) \
   DMM_MULTIPLY_OP(R, DM, M)
 
-#define MM_OP(R, OP, M1, M2, F) \
-  R \
-  OP (const M1& m1, const M2& m2) \
-  { \
-    R r; \
- \
-    int m1_nr = m1.rows (); \
-    int m1_nc = m1.cols (); \
- \
-    int m2_nr = m2.rows (); \
-    int m2_nc = m2.cols (); \
- \
-    if (m1_nr != m2_nr || m1_nc != m2_nc) \
-      gripe_nonconformant (#OP, m1_nr, m1_nc, m2_nr, m2_nc); \
-    else \
-      { \
-	r.resize (m1_nr, m1_nc); \
- \
-	if (m1_nr > 0 && m1_nc > 0) \
-	  F ## _vv (r.fortran_vec (), m1.data (), m2.data (), m1_nr * m1_nc); \
-      } \
- \
-    return r; \
-  }
+#define DMM_OP_DECLS(R, DM, M) \
+  DMM_BIN_OP_DECLS(R, DM, M)
+
+// diagonal matrix by diagonal matrix operations.
 
-#define DMDM_OP(R, OP, DM1, DM2, F) \
+#define DMDM_BIN_OP_DECLS(R, DM1, DM2) \
+  BIN_OP_DECL (R, operator +, DM1, DM2); \
+  BIN_OP_DECL (R, operator -, DM1, DM2); \
+  BIN_OP_DECL (R, product, DM1, DM2);
+
+#define DMDM_BIN_OP(R, OP, DM1, DM2, F) \
   R \
   OP (const DM1& dm1, const DM2& dm2) \
   { \
@@ -389,10 +743,13 @@
     return r; \
   }
 
-#define DMDM_OPS(R, DM1, DM2) \
-  DMDM_OP (R, operator +, DM1, DM2, add) \
-  DMDM_OP (R, operator -, DM1, DM2, subtract) \
-  DMDM_OP (R, product,    DM1, DM2, multiply)
+#define DMDM_BIN_OPS(R, DM1, DM2) \
+  DMDM_BIN_OP (R, operator +, DM1, DM2, add) \
+  DMDM_BIN_OP (R, operator -, DM1, DM2, subtract) \
+  DMDM_BIN_OP (R, product,    DM1, DM2, multiply)
+
+#define DMDM_OP_DECLS(R, DM1, DM2) \
+  DMDM_BIN_OP_DECLS (R, DM1, DM2)
 
 #endif
 
--- a/liboctave/mx-s-cdm.cc
+++ b/liboctave/mx-s-cdm.cc
@@ -29,7 +29,7 @@
 #include "CMatrix.h"
 #include "CDiagMatrix.h"
 
-SDM_OPS (ComplexMatrix, double, ComplexDiagMatrix)
+SDM_BIN_OPS (ComplexMatrix, double, ComplexDiagMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-s-cm.cc
+++ b/liboctave/mx-s-cm.cc
@@ -26,9 +26,14 @@
 
 #include "mx-s-cm.h"
 
+#include "boolMatrix.h"
 #include "CMatrix.h"
 
-SM_OPS (ComplexMatrix, double, ComplexMatrix)
+SM_BIN_OPS (ComplexMatrix, double, ComplexMatrix)
+
+SM_CMP_OPS (double, , ComplexMatrix, real)
+
+SM_BOOL_OPS (double, ComplexMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/mx-s-dm.cc
+++ b/liboctave/mx-s-dm.cc
@@ -29,7 +29,7 @@
 #include "dMatrix.h"
 #include "dDiagMatrix.h"
 
-SDM_OPS (Matrix, double, DiagMatrix)
+SDM_BIN_OPS (Matrix, double, DiagMatrix)
 
 /*
 ;;; Local Variables: ***
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,7 @@
+Wed Apr  2 22:04:03 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* miscellaneous/xor.m: Make type of return value logical.
+
 Fri Mar 28 16:19:53 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* miscellaneous/dump_prefs.m: Delete call to dump_1_pref for
--- a/scripts/miscellaneous/xor.m
+++ b/scripts/miscellaneous/xor.m
@@ -28,7 +28,7 @@
 
   if (nargin == 2)
     if (is_scalar (x) || is_scalar (y) || size (x) == size (y))  
-      z = (x | y) - (x & y);
+      z = logical ((x | y) - (x & y));
     else
       error ("xor: x and y must be of common size or scalars");
     endif
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+Wed Apr  2 21:59:15 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* octave.test/prefer/prefer.exp: Delete prefer-36 and prefer-37.
+	* octave.test/prefer/prefer-36.m, octave.test/prefer/prefer-37.m:
+	Delete test files.
+
 Wed Mar 12 16:56:41 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Makefile.in (install-strip): New target.