# HG changeset patch # User jwe # Date 853818798 0 # Node ID 5bcee07be597189eb74e4faa5371aad3c9dfe3a9 # Parent e2d1b073b78a0d17c3afc5712d419d1c42541098 [project @ 1997-01-21 03:52:08 by jwe] diff -r e2d1b073b78a -r 5bcee07be597 ChangeLog --- a/ChangeLog Mon Jan 20 23:06:31 1997 +0000 +++ b/ChangeLog Tue Jan 21 03:53:18 1997 +0000 @@ -1,7 +1,10 @@ Mon Jan 20 11:16:21 1997 John W. Eaton + * 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 diff -r e2d1b073b78a -r 5bcee07be597 NEWS --- a/NEWS Mon Jan 20 23:06:31 1997 +0000 +++ b/NEWS Tue Jan 21 03:53:18 1997 +0000 @@ -1,3 +1,8 @@ +Summary of changes for version 2.0.3: +------------------------------------ + + * size ("") is now [0, 0]. + Summary of changes for version 2.0: ---------------------------------- diff -r e2d1b073b78a -r 5bcee07be597 PROJECTS --- a/PROJECTS Mon Jan 20 23:06:31 1997 +0000 +++ b/PROJECTS Tue Jan 21 03:53:18 1997 +0000 @@ -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. diff -r e2d1b073b78a -r 5bcee07be597 liboctave/ChangeLog --- a/liboctave/ChangeLog Mon Jan 20 23:06:31 1997 +0000 +++ b/liboctave/ChangeLog Tue Jan 21 03:53:18 1997 +0000 @@ -1,3 +1,9 @@ +Mon Jan 20 18:44:11 1997 John W. Eaton + + * 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 * Version 2.0.1 released. diff -r e2d1b073b78a -r 5bcee07be597 liboctave/chMatrix.cc --- a/liboctave/chMatrix.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/liboctave/chMatrix.cc Tue Jan 21 03:53:18 1997 +0000 @@ -46,17 +46,25 @@ // charMatrix class. charMatrix::charMatrix (const char *s) - : MArray2 ((s ? 1 : 0), (s ? strlen (s) : 0)) + : MArray2 () { - 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 (1, s.length ()) + : MArray2 () { - 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 (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); diff -r e2d1b073b78a -r 5bcee07be597 mkoctfile.in --- a/mkoctfile.in Mon Jan 20 23:06:31 1997 +0000 +++ b/mkoctfile.in Tue Jan 21 03:53:18 1997 +0000 @@ -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 diff -r e2d1b073b78a -r 5bcee07be597 scripts/ChangeLog --- a/scripts/ChangeLog Mon Jan 20 23:06:31 1997 +0000 +++ b/scripts/ChangeLog Tue Jan 21 03:53:18 1997 +0000 @@ -1,3 +1,7 @@ +Mon Jan 20 12:28:34 1997 John W. Eaton + + * plot/sombrero.m: Doc fix. + Tue Jan 7 00:16:52 1997 John W. Eaton * Version 2.0.1 released. diff -r e2d1b073b78a -r 5bcee07be597 scripts/plot/sombrero.m --- a/scripts/plot/sombrero.m Mon Jan 20 23:06:31 1997 +0000 +++ b/scripts/plot/sombrero.m Tue Jan 21 03:53:18 1997 +0000 @@ -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 diff -r e2d1b073b78a -r 5bcee07be597 src/ChangeLog --- a/src/ChangeLog Mon Jan 20 23:06:31 1997 +0000 +++ b/src/ChangeLog Tue Jan 21 03:53:18 1997 +0000 @@ -1,5 +1,11 @@ Mon Jan 20 11:11:12 1997 John W. Eaton + * 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 diff -r e2d1b073b78a -r 5bcee07be597 src/Makefile.in --- a/src/Makefile.in Mon Jan 20 23:06:31 1997 +0000 +++ b/src/Makefile.in Tue Jan 21 03:53:18 1997 +0000 @@ -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 diff -r e2d1b073b78a -r 5bcee07be597 src/oct-stream.cc --- a/src/oct-stream.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/oct-stream.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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; diff -r e2d1b073b78a -r 5bcee07be597 src/op-cm-cm.cc --- a/src/op-cm-cm.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/op-cm-cm.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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 diff -r e2d1b073b78a -r 5bcee07be597 src/op-cm-cs.cc --- a/src/op-cm-cs.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/op-cm-cs.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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 ()); } diff -r e2d1b073b78a -r 5bcee07be597 src/op-cm-m.cc --- a/src/op-cm-m.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/op-cm-m.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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 diff -r e2d1b073b78a -r 5bcee07be597 src/op-cm-s.cc --- a/src/op-cm-s.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/op-cm-s.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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 ()); } diff -r e2d1b073b78a -r 5bcee07be597 src/op-cs-cm.cc --- a/src/op-cs-cm.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/op-cs-cm.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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 ()); } diff -r e2d1b073b78a -r 5bcee07be597 src/op-cs-m.cc --- a/src/op-cs-m.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/op-cs-m.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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); } diff -r e2d1b073b78a -r 5bcee07be597 src/op-m-cm.cc --- a/src/op-m-cm.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/op-m-cm.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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 * diff -r e2d1b073b78a -r 5bcee07be597 src/op-m-cs.cc --- a/src/op-m-cs.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/op-m-cs.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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 ()); } diff -r e2d1b073b78a -r 5bcee07be597 src/op-m-m.cc --- a/src/op-m-m.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/op-m-m.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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 diff -r e2d1b073b78a -r 5bcee07be597 src/op-m-s.cc --- a/src/op-m-s.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/op-m-s.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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 ()); } diff -r e2d1b073b78a -r 5bcee07be597 src/op-s-cm.cc --- a/src/op-s-cm.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/op-s-cm.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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 ()); } diff -r e2d1b073b78a -r 5bcee07be597 src/op-s-m.cc --- a/src/op-s-m.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/op-s-m.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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 ()); } diff -r e2d1b073b78a -r 5bcee07be597 src/op-str-str.cc --- a/src/op-str-str.cc Mon Jan 20 23:06:31 1997 +0000 +++ b/src/op-str-str.cc Tue Jan 21 03:53:18 1997 +0000 @@ -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); } } diff -r e2d1b073b78a -r 5bcee07be597 src/ops.h --- a/src/ops.h Mon Jan 20 23:06:31 1997 +0000 +++ b/src/ops.h Tue Jan 21 03:53:18 1997 +0000 @@ -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)