# HG changeset patch # User jwe # Date 861412692 0 # Node ID 0da4980855bc2129355dc4b872b5d03da7738dfd # Parent 30e1f6f411614aa08d85cbd7b1b2ff6974557cad [project @ 1997-04-19 01:18:11 by jwe] diff --git a/src/op-cm-cm.cc b/src/op-cm-cm.cc --- a/src/op-cm-cm.cc +++ b/src/op-cm-cm.cc @@ -89,18 +89,12 @@ return xleftdiv (v1.complex_matrix_value (), v2.complex_matrix_value ()); } -#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, \ - 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 (<, boolMatrix (), boolMatrix ()); + return mx_el_lt (v1.complex_matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -108,7 +102,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); - BOOL_OP (<=, boolMatrix (), boolMatrix ()); + return mx_el_le (v1.complex_matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -116,10 +110,7 @@ { 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, 1.0); + return mx_el_eq (v1.complex_matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -127,7 +118,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); - BOOL_OP (>=, boolMatrix (), boolMatrix ()); + return mx_el_ge (v1.complex_matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -135,7 +126,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); - BOOL_OP (>, boolMatrix (), boolMatrix ()); + return mx_el_gt (v1.complex_matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -143,10 +134,7 @@ { 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, 0.0); + return mx_el_ne (v1.complex_matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -189,10 +177,7 @@ { 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, "&", - boolMatrix (), boolMatrix ()); + return mx_el_and (v1.complex_matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -200,10 +185,7 @@ { 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, "|", - boolMatrix (), boolMatrix ()); + return mx_el_or (v1.complex_matrix_value (), v2.complex_matrix_value ()); } static octave_value diff --git a/src/op-cm-cs.cc b/src/op-cm-cs.cc --- a/src/op-cm-cs.cc +++ b/src/op-cm-cs.cc @@ -92,17 +92,12 @@ return octave_value (); } -#define BOOL_OP(OP, EMPTY_RESULT) \ - MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), \ - Complex, s, v2.complex_value (), \ - real (m (i, j)) OP real (s), EMPTY_RESULT) - static octave_value lt (const octave_value& a1, const octave_value& a2) { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); - BOOL_OP (<, boolMatrix ()); + return mx_el_lt (v1.complex_matrix_value (), v2.complex_value ()); } static octave_value @@ -110,7 +105,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); - BOOL_OP (<=, boolMatrix ()); + return mx_el_le (v1.complex_matrix_value (), v2.complex_value ()); } static octave_value @@ -118,9 +113,7 @@ { 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 (), - m (i, j) == s, 0.0); + return mx_el_eq (v1.complex_matrix_value (), v2.complex_value ()); } static octave_value @@ -128,7 +121,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); - BOOL_OP (>=, boolMatrix ()); + return mx_el_ge (v1.complex_matrix_value (), v2.complex_value ()); } static octave_value @@ -136,7 +129,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); - BOOL_OP (>, boolMatrix ()); + return mx_el_gt (v1.complex_matrix_value (), v2.complex_value ()); } static octave_value @@ -144,9 +137,7 @@ { 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 (), - m (i, j) != s, 1.0); + return mx_el_ne (v1.complex_matrix_value (), v2.complex_value ()); } static octave_value @@ -191,9 +182,7 @@ { 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 (), - m (i, j) != 0.0 && s != 0.0, boolMatrix ()); + return mx_el_and (v1.complex_matrix_value (), v2.complex_value ()); } static octave_value @@ -201,9 +190,7 @@ { 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 (), - m (i, j) != 0.0 || s != 0.0, boolMatrix ()); + return mx_el_or (v1.complex_matrix_value (), v2.complex_value ()); } static octave_value diff --git a/src/op-cm-m.cc b/src/op-cm-m.cc --- a/src/op-cm-m.cc +++ b/src/op-cm-m.cc @@ -90,18 +90,12 @@ return xleftdiv (v1.complex_matrix_value (), v2.matrix_value ()); } -#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, \ - 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 (<, boolMatrix (), boolMatrix ()); + return mx_el_lt (v1.complex_matrix_value (), v2.matrix_value ()); } static octave_value @@ -109,7 +103,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&); - BOOL_OP (<=, boolMatrix (), boolMatrix ()); + return mx_el_le (v1.complex_matrix_value (), v2.matrix_value ()); } static octave_value @@ -117,10 +111,7 @@ { 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, 1.0); + return mx_el_eq (v1.complex_matrix_value (), v2.matrix_value ()); } static octave_value @@ -128,7 +119,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&); - BOOL_OP (>=, boolMatrix (), boolMatrix ()); + return mx_el_ge (v1.complex_matrix_value (), v2.matrix_value ()); } static octave_value @@ -136,7 +127,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&); - BOOL_OP (>, boolMatrix (), boolMatrix ()); + return mx_el_gt (v1.complex_matrix_value (), v2.matrix_value ()); } static octave_value @@ -144,10 +135,7 @@ { 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), "!=", - 1.0, 0.0); + return mx_el_ne (v1.complex_matrix_value (), v2.matrix_value ()); } static octave_value @@ -187,10 +175,7 @@ { 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), "&", - boolMatrix (), boolMatrix ()); + return mx_el_and (v1.complex_matrix_value (), v2.matrix_value ()); } static octave_value @@ -198,10 +183,7 @@ { 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), "|", - boolMatrix (), boolMatrix ()); + return mx_el_or (v1.complex_matrix_value (), v2.matrix_value ()); } static octave_value diff --git a/src/op-cm-s.cc b/src/op-cm-s.cc --- a/src/op-cm-s.cc +++ b/src/op-cm-s.cc @@ -94,17 +94,12 @@ return octave_value (); } -#define BOOL_OP(OP, EMPTY_RESULT) \ - MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), \ - double, s, v2.double_value (), \ - real (m (i, j)) OP s, EMPTY_RESULT) - static octave_value lt (const octave_value& a1, const octave_value& a2) { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&); - BOOL_OP (<, boolMatrix ()); + return mx_el_lt (v1.complex_matrix_value (), v2.double_value ()); } static octave_value @@ -112,7 +107,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&); - BOOL_OP (<=, boolMatrix ()); + return mx_el_le (v1.complex_matrix_value (), v2.double_value ()); } static octave_value @@ -120,9 +115,7 @@ { 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 (), - m (i, j) == s, 0.0); + return mx_el_eq (v1.complex_matrix_value (), v2.double_value ()); } static octave_value @@ -130,7 +123,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&); - BOOL_OP (>=, boolMatrix ()); + return mx_el_ge (v1.complex_matrix_value (), v2.double_value ()); } static octave_value @@ -138,7 +131,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&); - BOOL_OP (>, boolMatrix ()); + return mx_el_gt (v1.complex_matrix_value (), v2.double_value ()); } static octave_value @@ -146,9 +139,7 @@ { 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 (), - m (i, j) != s, 1.0); + return mx_el_ne (v1.complex_matrix_value (), v2.double_value ()); } static octave_value @@ -193,9 +184,7 @@ { 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 (), - m (i, j) != 0.0 && s, boolMatrix ()); + return mx_el_and (v1.complex_matrix_value (), v2.double_value ()); } static octave_value @@ -203,9 +192,7 @@ { 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 (), - m (i, j) != 0.0 || s, boolMatrix ()); + return mx_el_or (v1.complex_matrix_value (), v2.double_value ()); } static octave_value diff --git a/src/op-cs-cm.cc b/src/op-cs-cm.cc --- a/src/op-cs-cm.cc +++ b/src/op-cs-cm.cc @@ -92,17 +92,12 @@ return octave_value (v2.complex_matrix_value () / d); } -#define BOOL_OP(OP, EMPTY_RESULT) \ - SC_MX_BOOL_OP (Complex, s, v1.complex_value (), \ - ComplexMatrix, m, v2.complex_matrix_value (), \ - real (s) OP real (m (i, j)), EMPTY_RESULT) - static octave_value lt (const octave_value& a1, const octave_value& a2) { CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&); - BOOL_OP (<, boolMatrix ()); + return mx_el_lt (v1.complex_value (), v2.complex_matrix_value ()); } static octave_value @@ -110,7 +105,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&); - BOOL_OP (<=, boolMatrix ()); + return mx_el_le (v1.complex_value (), v2.complex_matrix_value ()); } static octave_value @@ -118,9 +113,7 @@ { 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 (), - s == m (i, j), 0.0); + return mx_el_eq (v1.complex_value (), v2.complex_matrix_value ()); } static octave_value @@ -128,7 +121,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&); - BOOL_OP (>=, boolMatrix ()); + return mx_el_ge (v1.complex_value (), v2.complex_matrix_value ()); } static octave_value @@ -136,7 +129,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&); - BOOL_OP (>, boolMatrix ()); + return mx_el_gt (v1.complex_value (), v2.complex_matrix_value ()); } static octave_value @@ -144,9 +137,7 @@ { 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 (), - s != m (i, j), 1.0); + return mx_el_ne (v1.complex_value (), v2.complex_matrix_value ()); } static octave_value @@ -191,9 +182,7 @@ { 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 (), - s != 0.0 && m (i, j) != 0.0, boolMatrix ()); + return mx_el_and (v1.complex_value (), v2.complex_matrix_value ()); } static octave_value @@ -201,9 +190,7 @@ { 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 (), - s != 0.0 || m (i, j) != 0.0, boolMatrix ()); + return mx_el_or (v1.complex_value (), v2.complex_matrix_value ()); } static octave_value * diff --git a/src/op-cs-m.cc b/src/op-cs-m.cc --- a/src/op-cs-m.cc +++ b/src/op-cs-m.cc @@ -96,17 +96,12 @@ return octave_value (v2.matrix_value () / d); } -#define BOOL_OP(OP, EMPTY_RESULT) \ - SC_MX_BOOL_OP (Complex, s, v1.complex_value (), \ - Matrix, m, v2.matrix_value (), \ - real (s) OP m (i, j), EMPTY_RESULT) - static octave_value lt (const octave_value& a1, const octave_value& a2) { CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&); - BOOL_OP (<, boolMatrix ()); + return mx_el_lt (v1.complex_value (), v2.matrix_value ()); } static octave_value @@ -114,7 +109,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&); - BOOL_OP (<=, boolMatrix ()); + return mx_el_le (v1.complex_value (), v2.matrix_value ()); } static octave_value @@ -122,9 +117,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&); - SC_MX_BOOL_OP (Complex, s, v1.complex_value (), - Matrix, m, v2.matrix_value (), - s == m (i, j), 0.0); + return mx_el_eq (v1.complex_value (), v2.matrix_value ()); } static octave_value @@ -132,7 +125,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&); - BOOL_OP (>=, boolMatrix ()); + return mx_el_ge (v1.complex_value (), v2.matrix_value ()); } static octave_value @@ -140,7 +133,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&); - BOOL_OP (>, boolMatrix ()); + return mx_el_gt (v1.complex_value (), v2.matrix_value ()); } static octave_value @@ -148,9 +141,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&); - SC_MX_BOOL_OP (Complex, s, v1.complex_value (), - Matrix, m, v2.matrix_value (), - s != m (i, j), 1.0); + return mx_el_ne (v1.complex_value (), v2.matrix_value ()); } static octave_value @@ -195,9 +186,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&); - SC_MX_BOOL_OP (Complex, s, v1.complex_value (), \ - Matrix, m, v2.matrix_value (), \ - s != 0.0 && m (i, j), boolMatrix ()); + return mx_el_and (v1.complex_value (), v2.matrix_value ()); } static octave_value @@ -205,9 +194,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&); - SC_MX_BOOL_OP (Complex, s, v1.complex_value (), \ - Matrix, m, v2.matrix_value (), \ - s != 0.0 || m (i, j), boolMatrix ()); + return mx_el_or (v1.complex_value (), v2.matrix_value ()); } static octave_value * diff --git a/src/op-m-cm.cc b/src/op-m-cm.cc --- a/src/op-m-cm.cc +++ b/src/op-m-cm.cc @@ -90,18 +90,12 @@ return xleftdiv (v1.matrix_value (), v2.complex_matrix_value ()); } -#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, \ - 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 (<, boolMatrix (), boolMatrix ()); + return mx_el_lt (v1.matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -109,7 +103,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&); - BOOL_OP (<=, boolMatrix (), boolMatrix ()); + return mx_el_le (v1.matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -117,10 +111,7 @@ { 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, 1.0); + return mx_el_eq (v1.matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -128,7 +119,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&); - BOOL_OP (>=, boolMatrix (), boolMatrix ()); + return mx_el_ge (v1.matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -136,7 +127,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&); - BOOL_OP (>, boolMatrix (), boolMatrix ()); + return mx_el_gt (v1.matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -144,10 +135,7 @@ { 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, 0.0); + return mx_el_ne (v1.matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -187,10 +175,7 @@ { 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, "&", - boolMatrix (), boolMatrix ()); + return mx_el_and (v1.matrix_value (), v2.complex_matrix_value ()); } static octave_value @@ -198,10 +183,7 @@ { 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, "|", - boolMatrix (), boolMatrix ()); + return mx_el_or (v1.matrix_value (), v2.complex_matrix_value ()); } static octave_value * diff --git a/src/op-m-cs.cc b/src/op-m-cs.cc --- a/src/op-m-cs.cc +++ b/src/op-m-cs.cc @@ -96,17 +96,12 @@ return octave_value (); } -#define BOOL_OP(OP, EMPTY_RESULT) \ - MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), \ - Complex, s, v2.complex_value (), \ - m (i, j) OP real (s), EMPTY_RESULT) - static octave_value lt (const octave_value& a1, const octave_value& a2) { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&); - BOOL_OP (<, boolMatrix ()); + return mx_el_lt (v1.matrix_value (), v2.complex_value ()); } static octave_value @@ -114,7 +109,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&); - BOOL_OP (<=, boolMatrix ()); + return mx_el_le (v1.matrix_value (), v2.complex_value ()); } static octave_value @@ -122,9 +117,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&); - MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), - Complex, s, v2.complex_value (), - m (i, j) == s, 0.0); + return mx_el_eq (v1.matrix_value (), v2.complex_value ()); } static octave_value @@ -132,7 +125,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&); - BOOL_OP (>=, boolMatrix ()); + return mx_el_ge (v1.matrix_value (), v2.complex_value ()); } static octave_value @@ -140,7 +133,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&); - BOOL_OP (>, boolMatrix ()); + return mx_el_gt (v1.matrix_value (), v2.complex_value ()); } static octave_value @@ -148,9 +141,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&); - MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), - Complex, s, v2.complex_value (), - m (i, j) != s, 1.0); + return mx_el_ne (v1.matrix_value (), v2.complex_value ()); } static octave_value @@ -195,9 +186,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&); - MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), - Complex, s, v2.complex_value (), - m (i, j) && s != 0.0, boolMatrix ()); + return mx_el_and (v1.matrix_value (), v2.complex_value ()); } static octave_value @@ -205,9 +194,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&); - MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), - Complex, s, v2.complex_value (), - m (i, j) || s != 0.0, boolMatrix ()); + return mx_el_or (v1.matrix_value (), v2.complex_value ()); } static octave_value * diff --git a/src/op-m-m.cc b/src/op-m-m.cc --- a/src/op-m-m.cc +++ b/src/op-m-m.cc @@ -86,18 +86,12 @@ return xleftdiv (v1.matrix_value (), v2.matrix_value ()); } -#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, \ - 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 (<, boolMatrix (), boolMatrix ()); + return mx_el_lt (v1.matrix_value (), v2.matrix_value ()); } static octave_value @@ -105,7 +99,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); - BOOL_OP (<=, boolMatrix (), boolMatrix ()); + return mx_el_le (v1.matrix_value (), v2.matrix_value ()); } static octave_value @@ -113,7 +107,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); - BOOL_OP (==, 0.0, 1.0); + return mx_el_eq (v1.matrix_value (), v2.matrix_value ()); } static octave_value @@ -121,7 +115,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); - BOOL_OP (>=, boolMatrix (), boolMatrix ()); + return mx_el_ge (v1.matrix_value (), v2.matrix_value ()); } static octave_value @@ -129,7 +123,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); - BOOL_OP (>, boolMatrix (), boolMatrix ()); + return mx_el_gt (v1.matrix_value (), v2.matrix_value ()); } static octave_value @@ -137,7 +131,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); - BOOL_OP (!=, 1.0, 0.0); + return mx_el_ne (v1.matrix_value (), v2.matrix_value ()); } static octave_value @@ -177,10 +171,7 @@ { 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), "&", - boolMatrix (), boolMatrix ()); + return mx_el_and (v1.matrix_value (), v2.matrix_value ()); } static octave_value @@ -188,10 +179,7 @@ { 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), "|", - boolMatrix (), boolMatrix ()); + return mx_el_or (v1.matrix_value (), v2.matrix_value ()); } static octave_value diff --git a/src/op-m-s.cc b/src/op-m-s.cc --- a/src/op-m-s.cc +++ b/src/op-m-s.cc @@ -92,17 +92,12 @@ return octave_value (); } -#define BOOL_OP(OP, EMPTY_RESULT) \ - MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), \ - double, s, v2.double_value (), \ - m (i, j) OP s, EMPTY_RESULT) - static octave_value lt (const octave_value& a1, const octave_value& a2) { CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&); - BOOL_OP (<, boolMatrix ()); + return mx_el_lt (v1.matrix_value (), v2.double_value ()); } static octave_value @@ -110,7 +105,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&); - BOOL_OP (<=, boolMatrix ()); + return mx_el_le (v1.matrix_value (), v2.double_value ()); } static octave_value @@ -118,7 +113,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&); - BOOL_OP (==, 0.0); + return mx_el_eq (v1.matrix_value (), v2.double_value ()); } static octave_value @@ -126,7 +121,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&); - BOOL_OP (>=, boolMatrix ()); + return mx_el_ge (v1.matrix_value (), v2.double_value ()); } static octave_value @@ -134,7 +129,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&); - BOOL_OP (>, boolMatrix ()); + return mx_el_gt (v1.matrix_value (), v2.double_value ()); } static octave_value @@ -142,7 +137,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&); - BOOL_OP (!=, 1.0); + return mx_el_ne (v1.matrix_value (), v2.double_value ()); } static octave_value @@ -187,9 +182,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&); - MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), - double, s, v2.double_value (), - m (i, j) && s, boolMatrix ()); + return mx_el_and (v1.matrix_value (), v2.double_value ()); } static octave_value @@ -197,9 +190,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&); - MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), - double, s, v2.double_value (), - m (i, j) || s, boolMatrix ()); + return mx_el_or (v1.matrix_value (), v2.double_value ()); } static octave_value diff --git a/src/op-s-cm.cc b/src/op-s-cm.cc --- a/src/op-s-cm.cc +++ b/src/op-s-cm.cc @@ -94,17 +94,12 @@ return octave_value (v2.complex_matrix_value () / d); } -#define BOOL_OP(OP, EMPTY_RESULT) \ - SC_MX_BOOL_OP (double, s, v1.double_value (), \ - ComplexMatrix, m, v2.complex_matrix_value (), \ - s OP real (m (i, j)), EMPTY_RESULT) - static octave_value lt (const octave_value& a1, const octave_value& a2) { CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&); - BOOL_OP (<, boolMatrix ()); + return mx_el_lt (v1.double_value (), v2.complex_matrix_value ()); } static octave_value @@ -112,7 +107,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&); - BOOL_OP (<=, boolMatrix ()); + return mx_el_le (v1.double_value (), v2.complex_matrix_value ()); } static octave_value @@ -120,9 +115,7 @@ { 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 (), - s == m (i, j), 0.0); + return mx_el_eq (v1.double_value (), v2.complex_matrix_value ()); } static octave_value @@ -130,7 +123,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&); - BOOL_OP (>=, boolMatrix ()); + return mx_el_ge (v1.double_value (), v2.complex_matrix_value ()); } static octave_value @@ -138,7 +131,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&); - BOOL_OP (>, boolMatrix ()); + return mx_el_gt (v1.double_value (), v2.complex_matrix_value ()); } static octave_value @@ -146,9 +139,7 @@ { 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 (), - s != m (i, j), 1.0); + return mx_el_ne (v1.double_value (), v2.complex_matrix_value ()); } static octave_value @@ -193,9 +184,7 @@ { 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 (), - s && m (i, j) != 0.0, boolMatrix ()); + return mx_el_and (v1.double_value (), v2.complex_matrix_value ()); } static octave_value @@ -203,9 +192,7 @@ { 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 (), - s || m (i, j) != 0.0, boolMatrix ()); + return mx_el_or (v1.double_value (), v2.complex_matrix_value ()); } static octave_value * diff --git a/src/op-s-m.cc b/src/op-s-m.cc --- a/src/op-s-m.cc +++ b/src/op-s-m.cc @@ -92,17 +92,12 @@ return octave_value (v2.matrix_value () / d); } -#define BOOL_OP(OP, EMPTY_RESULT) \ - SC_MX_BOOL_OP (double, s, v1.double_value (), \ - Matrix, m, v2.matrix_value (), \ - s OP m (i, j), EMPTY_RESULT) - static octave_value lt (const octave_value& a1, const octave_value& a2) { CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&); - BOOL_OP (<, boolMatrix ()); + return mx_el_lt (v1.double_value (), v2.matrix_value ()); } static octave_value @@ -110,7 +105,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&); - BOOL_OP (<=, boolMatrix ()); + return mx_el_le (v1.double_value (), v2.matrix_value ()); } static octave_value @@ -118,7 +113,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&); - BOOL_OP (==, 0.0); + return mx_el_eq (v1.double_value (), v2.matrix_value ()); } static octave_value @@ -126,7 +121,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&); - BOOL_OP (>=, boolMatrix ()); + return mx_el_ge (v1.double_value (), v2.matrix_value ()); } static octave_value @@ -134,7 +129,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&); - BOOL_OP (>, boolMatrix ()); + return mx_el_gt (v1.double_value (), v2.matrix_value ()); } static octave_value @@ -142,7 +137,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&); - BOOL_OP (!=, 1.0); + return mx_el_ne (v1.double_value (), v2.matrix_value ()); } static octave_value @@ -187,9 +182,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&); - SC_MX_BOOL_OP (double, s, v1.double_value (), - Matrix, m, v2.matrix_value (), - s && m (i, j), boolMatrix ()); + return mx_el_and (v1.double_value (), v2.matrix_value ()); } static octave_value @@ -197,9 +190,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&); - SC_MX_BOOL_OP (double, s, v1.double_value (), - Matrix, m, v2.matrix_value (), - s || m (i, j), boolMatrix ()); + return mx_el_or (v1.double_value (), v2.matrix_value ()); } static octave_value *