# HG changeset patch # User jwe # Date 1087445676 0 # Node ID f7a337f3fd9e5aba1a3242708e39aeb3a1943343 # Parent 71229573b6bfe71edef705a14ed43973e16ad591 [project @ 2004-06-17 04:11:50 by jwe] diff -r 71229573b6bf -r f7a337f3fd9e src/ChangeLog --- a/src/ChangeLog Mon Jun 14 19:33:53 2004 +0000 +++ b/src/ChangeLog Thu Jun 17 04:14:36 2004 +0000 @@ -1,3 +1,12 @@ +2004-06-16 John W. Eaton + + * OPERATORS/op-int.h: New file. + * OPERATORS/op-i16-i16.cc, OPERATORS/op-i8-i8.cc, + OPERATORS/op-ui32-ui32.cc, OPERATORS/op-i32-i32.cc, + OPERATORS/op-int-conv.cc, OPERATORS/op-ui64-ui64.cc, + OPERATORS/op-i64-i64.cc, OPERATORS/op-ui16-ui16.cc, + OPERATORS/op-ui8-ui8.cc: Use new macros from op-int.h. + 2004-06-14 John W. Eaton * pr-output.h, pr-output.cc (octave_print_conv): New traits class. diff -r 71229573b6bf -r f7a337f3fd9e src/OPERATORS/op-i16-i16.cc --- a/src/OPERATORS/op-i16-i16.cc Mon Jun 14 19:33:53 2004 +0000 +++ b/src/OPERATORS/op-i16-i16.cc Thu Jun 17 04:14:36 2004 +0000 @@ -37,99 +37,14 @@ #include "xdiv.h" #include "xpow.h" -// matrix unary ops. - -DEFNDUNOP_OP (not, int16_matrix, int16_array, !) -DEFNDUNOP_OP (uminus, int16_matrix, int16_array, -) - -DEFUNOP (transpose, int16_matrix) -{ - CAST_UNOP_ARG (const octave_int16_matrix&); - - if (v.ndims () > 2) - { - error ("transpose not defined for N-d objects"); - return octave_value (); - } - else - return octave_value (v.int16_array_value().transpose ()); -} - -//DEFNCUNOP_METHOD (incr, int16_matrix, increment) -//DEFNCUNOP_METHOD (decr, int16_matrix, decrement) - -// matrix by matrix ops. - -DEFNDBINOP_OP (add, int16_matrix, int16_matrix, int16_array, int16_array, +) -DEFNDBINOP_OP (sub, int16_matrix, int16_matrix, int16_array, int16_array, -) - -// DEFBINOP_OP (mul, int16_matrix, int16_matrix, *) -// DEFBINOP_FN (div, int16_matrix, int16_matrix, xdiv) +#include "op-int.h" -DEFBINOPX (pow, int16_matrix, int16_matrix) -{ - error ("can't do A ^ B for A and B both matrices"); - return octave_value (); -} - -//DEFBINOP_FN (ldiv, int16_matrix, int16_matrix, xleftdiv) - -DEFNDBINOP_FN (lt, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_lt) -DEFNDBINOP_FN (le, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_le) -DEFNDBINOP_FN (eq, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_eq) -DEFNDBINOP_FN (ge, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_ge) -DEFNDBINOP_FN (gt, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_gt) -DEFNDBINOP_FN (ne, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_ne) - -DEFNDBINOP_FN (el_mul, int16_matrix, int16_matrix, int16_array, int16_array, product) - -DEFNDBINOP_FN (el_div, int16_matrix, int16_matrix, int16_array, int16_array, quotient) - -//DEFNDBINOP_FN (el_pow, int16_matrix, int16_matrix, int16_array, int16_array, elem_xpow) - -//DEFBINOP (el_ldiv, int16_matrix, int16_matrix) -//{ -// CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); -// -// return octave_value (quotient (v2.array_value (), v1.array_value ())); -//} - -DEFNDBINOP_FN (el_and, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_and) -DEFNDBINOP_FN (el_or, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_or) - -DEFNDASSIGNOP_FN (assign, int16_matrix, int16_matrix, int16_array, assign) +OCTAVE_INT_OPS (int16) void install_i16_i16_ops (void) { - INSTALL_UNOP (op_not, octave_int16_matrix, not); - INSTALL_UNOP (op_uminus, octave_int16_matrix, uminus); - INSTALL_UNOP (op_transpose, octave_int16_matrix, transpose); - INSTALL_UNOP (op_hermitian, octave_int16_matrix, transpose); - - // INSTALL_NCUNOP (op_incr, octave_int16_matrix, incr); - // INSTALL_NCUNOP (op_decr, octave_int16_matrix, decr); - - INSTALL_BINOP (op_add, octave_int16_matrix, octave_int16_matrix, add); - INSTALL_BINOP (op_sub, octave_int16_matrix, octave_int16_matrix, sub); - // INSTALL_BINOP (op_mul, octave_int16_matrix, octave_int16_matrix, mul); - // INSTALL_BINOP (op_div, octave_int16_matrix, octave_int16_matrix, div); - INSTALL_BINOP (op_pow, octave_int16_matrix, octave_int16_matrix, pow); - // INSTALL_BINOP (op_ldiv, octave_int16_matrix, octave_int16_matrix, ldiv); - INSTALL_BINOP (op_lt, octave_int16_matrix, octave_int16_matrix, lt); - INSTALL_BINOP (op_le, octave_int16_matrix, octave_int16_matrix, le); - INSTALL_BINOP (op_eq, octave_int16_matrix, octave_int16_matrix, eq); - INSTALL_BINOP (op_ge, octave_int16_matrix, octave_int16_matrix, ge); - INSTALL_BINOP (op_gt, octave_int16_matrix, octave_int16_matrix, gt); - INSTALL_BINOP (op_ne, octave_int16_matrix, octave_int16_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_int16_matrix, octave_int16_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_int16_matrix, octave_int16_matrix, el_div); - // INSTALL_BINOP (op_el_pow, octave_int16_matrix, octave_int16_matrix, el_pow); - // INSTALL_BINOP (op_el_ldiv, octave_int16_matrix, octave_int16_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_int16_matrix, octave_int16_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_int16_matrix, octave_int16_matrix, el_or); - - INSTALL_ASSIGNOP (op_asn_eq, octave_int16_matrix, octave_int16_matrix, assign); + OCTAVE_INSTALL_INT_OPS (int16); } /* diff -r 71229573b6bf -r f7a337f3fd9e src/OPERATORS/op-i32-i32.cc --- a/src/OPERATORS/op-i32-i32.cc Mon Jun 14 19:33:53 2004 +0000 +++ b/src/OPERATORS/op-i32-i32.cc Thu Jun 17 04:14:36 2004 +0000 @@ -37,99 +37,14 @@ #include "xdiv.h" #include "xpow.h" -// matrix unary ops. - -DEFNDUNOP_OP (not, int32_matrix, int32_array, !) -DEFNDUNOP_OP (uminus, int32_matrix, int32_array, -) - -DEFUNOP (transpose, int32_matrix) -{ - CAST_UNOP_ARG (const octave_int32_matrix&); - - if (v.ndims () > 2) - { - error ("transpose not defined for N-d objects"); - return octave_value (); - } - else - return octave_value (v.int32_array_value().transpose ()); -} - -//DEFNCUNOP_METHOD (incr, int32_matrix, increment) -//DEFNCUNOP_METHOD (decr, int32_matrix, decrement) - -// matrix by matrix ops. - -DEFNDBINOP_OP (add, int32_matrix, int32_matrix, int32_array, int32_array, +) -DEFNDBINOP_OP (sub, int32_matrix, int32_matrix, int32_array, int32_array, -) - -//DEFBINOP_OP (mul, int32_matrix, int32_matrix, *) -//DEFBINOP_FN (div, int32_matrix, int32_matrix, xdiv) +#include "op-int.h" -DEFBINOPX (pow, int32_matrix, int32_matrix) -{ - error ("can't do A ^ B for A and B both matrices"); - return octave_value (); -} - -//DEFBINOP_FN (ldiv, int32_matrix, int32_matrix, xleftdiv) - -DEFNDBINOP_FN (lt, int32_matrix, int32_matrix, int32_array, int32_array, mx_el_lt) -DEFNDBINOP_FN (le, int32_matrix, int32_matrix, int32_array, int32_array, mx_el_le) -DEFNDBINOP_FN (eq, int32_matrix, int32_matrix, int32_array, int32_array, mx_el_eq) -DEFNDBINOP_FN (ge, int32_matrix, int32_matrix, int32_array, int32_array, mx_el_ge) -DEFNDBINOP_FN (gt, int32_matrix, int32_matrix, int32_array, int32_array, mx_el_gt) -DEFNDBINOP_FN (ne, int32_matrix, int32_matrix, int32_array, int32_array, mx_el_ne) - -DEFNDBINOP_FN (el_mul, int32_matrix, int32_matrix, int32_array, int32_array, product) - -DEFNDBINOP_FN (el_div, int32_matrix, int32_matrix, int32_array, int32_array, quotient) - -//DEFNDBINOP_FN (el_pow, int32_matrix, int32_matrix, int32_array, int32_array, elem_xpow) - -//DEFBINOP (el_ldiv, int32_matrix, int32_matrix) -//{ -// CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); -// -// return octave_value (quotient (v2.array_value (), v1.array_value ())); -//} - -DEFNDBINOP_FN (el_and, int32_matrix, int32_matrix, int32_array, int32_array, mx_el_and) -DEFNDBINOP_FN (el_or, int32_matrix, int32_matrix, int32_array, int32_array, mx_el_or) - -DEFNDASSIGNOP_FN (assign, int32_matrix, int32_matrix, int32_array, assign) +OCTAVE_INT_OPS (int32) void install_i32_i32_ops (void) { - INSTALL_UNOP (op_not, octave_int32_matrix, not); - INSTALL_UNOP (op_uminus, octave_int32_matrix, uminus); - INSTALL_UNOP (op_transpose, octave_int32_matrix, transpose); - INSTALL_UNOP (op_hermitian, octave_int32_matrix, transpose); - - // INSTALL_NCUNOP (op_incr, octave_int32_matrix, incr); - // INSTALL_NCUNOP (op_decr, octave_int32_matrix, decr); - - INSTALL_BINOP (op_add, octave_int32_matrix, octave_int32_matrix, add); - INSTALL_BINOP (op_sub, octave_int32_matrix, octave_int32_matrix, sub); - // INSTALL_BINOP (op_mul, octave_int32_matrix, octave_int32_matrix, mul); - // INSTALL_BINOP (op_div, octave_int32_matrix, octave_int32_matrix, div); - INSTALL_BINOP (op_pow, octave_int32_matrix, octave_int32_matrix, pow); - // INSTALL_BINOP (op_ldiv, octave_int32_matrix, octave_int32_matrix, ldiv); - INSTALL_BINOP (op_lt, octave_int32_matrix, octave_int32_matrix, lt); - INSTALL_BINOP (op_le, octave_int32_matrix, octave_int32_matrix, le); - INSTALL_BINOP (op_eq, octave_int32_matrix, octave_int32_matrix, eq); - INSTALL_BINOP (op_ge, octave_int32_matrix, octave_int32_matrix, ge); - INSTALL_BINOP (op_gt, octave_int32_matrix, octave_int32_matrix, gt); - INSTALL_BINOP (op_ne, octave_int32_matrix, octave_int32_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_int32_matrix, octave_int32_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_int32_matrix, octave_int32_matrix, el_div); - // INSTALL_BINOP (op_el_pow, octave_int32_matrix, octave_int32_matrix, el_pow); - // INSTALL_BINOP (op_el_ldiv, octave_int32_matrix, octave_int32_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_int32_matrix, octave_int32_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_int32_matrix, octave_int32_matrix, el_or); - - INSTALL_ASSIGNOP (op_asn_eq, octave_int32_matrix, octave_int32_matrix, assign); + OCTAVE_INSTALL_INT_OPS (int32); } /* diff -r 71229573b6bf -r f7a337f3fd9e src/OPERATORS/op-i64-i64.cc --- a/src/OPERATORS/op-i64-i64.cc Mon Jun 14 19:33:53 2004 +0000 +++ b/src/OPERATORS/op-i64-i64.cc Thu Jun 17 04:14:36 2004 +0000 @@ -37,99 +37,40 @@ #include "xdiv.h" #include "xpow.h" -// matrix unary ops. - -DEFNDUNOP_OP (not, int64_matrix, int64_array, !) -DEFNDUNOP_OP (uminus, int64_matrix, int64_array, -) - -DEFUNOP (transpose, int64_matrix) -{ - CAST_UNOP_ARG (const octave_int64_matrix&); +#include "op-int.h" - if (v.ndims () > 2) - { - error ("transpose not defined for N-d objects"); - return octave_value (); - } - else - return octave_value (v.int64_array_value().transpose ()); -} - -//DEFNCUNOP_METHOD (incr, int64_matrix, increment) -//DEFNCUNOP_METHOD (decr, int64_matrix, decrement) - -// matrix by matrix ops. - -//DEFNDBINOP_OP (add, int64_matrix, int64_matrix, int64_array, int64_array, +) -//DEFNDBINOP_OP (sub, int64_matrix, int64_matrix, int64_array, int64_array, -) - -//DEFBINOP_OP (mul, int64_matrix, int64_matrix, *) -//DEFBINOP_FN (div, int64_matrix, int64_matrix, xdiv) +OCTAVE_S_INT_UNOPS (int64) +OCTAVE_SS_INT_CMP_OPS (int64, int64) +OCTAVE_SS_INT_BOOL_OPS (int64, int64) -DEFBINOPX (pow, int64_matrix, int64_matrix) -{ - error ("can't do A ^ B for A and B both matrices"); - return octave_value (); -} - -//DEFBINOP_FN (ldiv, int64_matrix, int64_matrix, xleftdiv) - -DEFNDBINOP_FN (lt, int64_matrix, int64_matrix, int64_array, int64_array, mx_el_lt) -DEFNDBINOP_FN (le, int64_matrix, int64_matrix, int64_array, int64_array, mx_el_le) -DEFNDBINOP_FN (eq, int64_matrix, int64_matrix, int64_array, int64_array, mx_el_eq) -DEFNDBINOP_FN (ge, int64_matrix, int64_matrix, int64_array, int64_array, mx_el_ge) -DEFNDBINOP_FN (gt, int64_matrix, int64_matrix, int64_array, int64_array, mx_el_gt) -DEFNDBINOP_FN (ne, int64_matrix, int64_matrix, int64_array, int64_array, mx_el_ne) +OCTAVE_SM_INT_CMP_OPS (int64, int64) +OCTAVE_SM_INT_BOOL_OPS (int64, int64) -//DEFNDBINOP_FN (el_mul, int64_matrix, int64_matrix, int64_array, int64_array, product) - -//DEFNDBINOP_FN (el_div, int64_matrix, int64_matrix, int64_array, int64_array, quotient) - -//DEFNDBINOP_FN (el_pow, int64_matrix, int64_matrix, int64_array, int64_array, elem_xpow) +OCTAVE_MS_INT_CMP_OPS (int64, int64) +OCTAVE_MS_INT_BOOL_OPS (int64, int64) -//DEFBINOP (el_ldiv, int64_matrix, int64_matrix) -//{ -// CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); -// -// return octave_value (quotient (v2.array_value (), v1.array_value ())); -//} - -DEFNDBINOP_FN (el_and, int64_matrix, int64_matrix, int64_array, int64_array, mx_el_and) -DEFNDBINOP_FN (el_or, int64_matrix, int64_matrix, int64_array, int64_array, mx_el_or) - -DEFNDASSIGNOP_FN (assign, int64_matrix, int64_matrix, int64_array, assign) +OCTAVE_M_INT_UNOPS (int64) +OCTAVE_MM_INT_CMP_OPS (int64, int64) +OCTAVE_MM_INT_BOOL_OPS (int64, int64) +OCTAVE_MM_INT_ASSIGN_OPS (int64) void install_i64_i64_ops (void) { - INSTALL_UNOP (op_not, octave_int64_matrix, not); - INSTALL_UNOP (op_uminus, octave_int64_matrix, uminus); - INSTALL_UNOP (op_transpose, octave_int64_matrix, transpose); - INSTALL_UNOP (op_hermitian, octave_int64_matrix, transpose); + OCTAVE_INSTALL_S_INT_UNOPS (int64); + OCTAVE_INSTALL_SS_INT_CMP_OPS (int64, int64); + OCTAVE_INSTALL_SS_INT_BOOL_OPS (int64, int64); - // INSTALL_NCUNOP (op_incr, octave_int64_matrix, incr); - // INSTALL_NCUNOP (op_decr, octave_int64_matrix, decr); + OCTAVE_INSTALL_SM_INT_CMP_OPS (int64, int64); + OCTAVE_INSTALL_SM_INT_BOOL_OPS (int64, int64); - // INSTALL_BINOP (op_add, octave_int64_matrix, octave_int64_matrix, add); - // INSTALL_BINOP (op_sub, octave_int64_matrix, octave_int64_matrix, sub); - // INSTALL_BINOP (op_mul, octave_int64_matrix, octave_int64_matrix, mul); - // INSTALL_BINOP (op_div, octave_int64_matrix, octave_int64_matrix, div); - INSTALL_BINOP (op_pow, octave_int64_matrix, octave_int64_matrix, pow); - // INSTALL_BINOP (op_ldiv, octave_int64_matrix, octave_int64_matrix, ldiv); - INSTALL_BINOP (op_lt, octave_int64_matrix, octave_int64_matrix, lt); - INSTALL_BINOP (op_le, octave_int64_matrix, octave_int64_matrix, le); - INSTALL_BINOP (op_eq, octave_int64_matrix, octave_int64_matrix, eq); - INSTALL_BINOP (op_ge, octave_int64_matrix, octave_int64_matrix, ge); - INSTALL_BINOP (op_gt, octave_int64_matrix, octave_int64_matrix, gt); - INSTALL_BINOP (op_ne, octave_int64_matrix, octave_int64_matrix, ne); - // INSTALL_BINOP (op_el_mul, octave_int64_matrix, octave_int64_matrix, el_mul); - // INSTALL_BINOP (op_el_div, octave_int64_matrix, octave_int64_matrix, el_div); - // INSTALL_BINOP (op_el_pow, octave_int64_matrix, octave_int64_matrix, el_pow); - // INSTALL_BINOP (op_el_ldiv, octave_int64_matrix, octave_int64_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_int64_matrix, octave_int64_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_int64_matrix, octave_int64_matrix, el_or); + OCTAVE_INSTALL_MS_INT_CMP_OPS (int64, int64); + OCTAVE_INSTALL_MS_INT_BOOL_OPS (int64, int64); - INSTALL_ASSIGNOP (op_asn_eq, octave_int64_matrix, octave_int64_matrix, assign); + OCTAVE_INSTALL_M_INT_UNOPS (int64); + OCTAVE_INSTALL_MM_INT_CMP_OPS (int64, int64); + OCTAVE_INSTALL_MM_INT_BOOL_OPS (int64, int64); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (int64); } /* diff -r 71229573b6bf -r f7a337f3fd9e src/OPERATORS/op-i8-i8.cc --- a/src/OPERATORS/op-i8-i8.cc Mon Jun 14 19:33:53 2004 +0000 +++ b/src/OPERATORS/op-i8-i8.cc Thu Jun 17 04:14:36 2004 +0000 @@ -37,99 +37,14 @@ #include "xdiv.h" #include "xpow.h" -// matrix unary ops. - -DEFNDUNOP_OP (not, int8_matrix, int8_array, !) -DEFNDUNOP_OP (uminus, int8_matrix, int8_array, -) - -DEFUNOP (transpose, int8_matrix) -{ - CAST_UNOP_ARG (const octave_int8_matrix&); - - if (v.ndims () > 2) - { - error ("transpose not defined for N-d objects"); - return octave_value (); - } - else - return octave_value (v.int8_array_value().transpose ()); -} - -//DEFNCUNOP_METHOD (incr, int8_matrix, increment) -//DEFNCUNOP_METHOD (decr, int8_matrix, decrement) - -// matrix by matrix ops. - -DEFNDBINOP_OP (add, int8_matrix, int8_matrix, int8_array, int8_array, +) -DEFNDBINOP_OP (sub, int8_matrix, int8_matrix, int8_array, int8_array, -) - -// DEFBINOP_OP (mul, int8_matrix, int8_matrix, *) -// DEFBINOP_FN (div, int8_matrix, int8_matrix, xdiv) +#include "op-int.h" -DEFBINOPX (pow, int8_matrix, int8_matrix) -{ - error ("can't do A ^ B for A and B both matrices"); - return octave_value (); -} - -// DEFBINOP_FN (ldiv, int8_matrix, int8_matrix, xleftdiv) - -DEFNDBINOP_FN (lt, int8_matrix, int8_matrix, int8_array, int8_array, mx_el_lt) -DEFNDBINOP_FN (le, int8_matrix, int8_matrix, int8_array, int8_array, mx_el_le) -DEFNDBINOP_FN (eq, int8_matrix, int8_matrix, int8_array, int8_array, mx_el_eq) -DEFNDBINOP_FN (ge, int8_matrix, int8_matrix, int8_array, int8_array, mx_el_ge) -DEFNDBINOP_FN (gt, int8_matrix, int8_matrix, int8_array, int8_array, mx_el_gt) -DEFNDBINOP_FN (ne, int8_matrix, int8_matrix, int8_array, int8_array, mx_el_ne) - -DEFNDBINOP_FN (el_mul, int8_matrix, int8_matrix, int8_array, int8_array, product) - -DEFNDBINOP_FN (el_div, int8_matrix, int8_matrix, int8_array, int8_array, quotient) - -//DEFNDBINOP_FN (el_pow, int8_matrix, int8_matrix, int8_array, int8_array, elem_xpow) - -//DEFBINOP (el_ldiv, int8_matrix, int8_matrix) -//{ -// CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); -// -// return octave_value (quotient (v2.array_value (), v1.array_value ())); -//} - -DEFNDBINOP_FN (el_and, int8_matrix, int8_matrix, int8_array, int8_array, mx_el_and) -DEFNDBINOP_FN (el_or, int8_matrix, int8_matrix, int8_array, int8_array, mx_el_or) - -DEFNDASSIGNOP_FN (assign, int8_matrix, int8_matrix, int8_array, assign) +OCTAVE_INT_OPS (int8) void install_i8_i8_ops (void) { - INSTALL_UNOP (op_not, octave_int8_matrix, not); - INSTALL_UNOP (op_uminus, octave_int8_matrix, uminus); - INSTALL_UNOP (op_transpose, octave_int8_matrix, transpose); - INSTALL_UNOP (op_hermitian, octave_int8_matrix, transpose); - - // INSTALL_NCUNOP (op_incr, octave_int8_matrix, incr); - // INSTALL_NCUNOP (op_decr, octave_int8_matrix, decr); - - INSTALL_BINOP (op_add, octave_int8_matrix, octave_int8_matrix, add); - INSTALL_BINOP (op_sub, octave_int8_matrix, octave_int8_matrix, sub); - // INSTALL_BINOP (op_mul, octave_int8_matrix, octave_int8_matrix, mul); - // INSTALL_BINOP (op_div, octave_int8_matrix, octave_int8_matrix, div); - INSTALL_BINOP (op_pow, octave_int8_matrix, octave_int8_matrix, pow); - // INSTALL_BINOP (op_ldiv, octave_int8_matrix, octave_int8_matrix, ldiv); - INSTALL_BINOP (op_lt, octave_int8_matrix, octave_int8_matrix, lt); - INSTALL_BINOP (op_le, octave_int8_matrix, octave_int8_matrix, le); - INSTALL_BINOP (op_eq, octave_int8_matrix, octave_int8_matrix, eq); - INSTALL_BINOP (op_ge, octave_int8_matrix, octave_int8_matrix, ge); - INSTALL_BINOP (op_gt, octave_int8_matrix, octave_int8_matrix, gt); - INSTALL_BINOP (op_ne, octave_int8_matrix, octave_int8_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_int8_matrix, octave_int8_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_int8_matrix, octave_int8_matrix, el_div); - // INSTALL_BINOP (op_el_pow, octave_int8_matrix, octave_int8_matrix, el_pow); - // INSTALL_BINOP (op_el_ldiv, octave_int8_matrix, octave_int8_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_int8_matrix, octave_int8_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_int8_matrix, octave_int8_matrix, el_or); - - INSTALL_ASSIGNOP (op_asn_eq, octave_int8_matrix, octave_int8_matrix, assign); + OCTAVE_INSTALL_INT_OPS (int8); } /* diff -r 71229573b6bf -r f7a337f3fd9e src/OPERATORS/op-int.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/OPERATORS/op-int.h Thu Jun 17 04:14:36 2004 +0000 @@ -0,0 +1,536 @@ +/* + +Copyright (C) 1996, 1997 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#define OCTAVE_S_INT_UNOPS(TYPE) \ + /* scalar unary ops. */ \ + \ + DEFUNOP_OP (s_not, TYPE ## _scalar, !) \ + DEFUNOP_OP (s_uminus, TYPE ## _scalar, -) \ + DEFUNOP_OP (s_transpose, TYPE ## _scalar, /* no-op */) \ + DEFUNOP_OP (s_hermitian, TYPE ## _scalar, /* no-op */) \ + \ + /* DEFNCUNOP_METHOD (s_incr, TYPE ## _scalar, increment) */ \ + /* DEFNCUNOP_METHOD (s_decr, TYPE ## _scalar, decrement) */ + +#define OCTAVE_SS_INT_ARITH_OPS(T1, T2) \ + /* scalar by scalar ops. */ \ + \ + DEFBINOP_OP (ss_add, T1 ## _scalar, T2 ## _scalar, +) \ + DEFBINOP_OP (ss_sub, T1 ## _scalar, T2 ## _scalar, -) \ + DEFBINOP_OP (ss_mul, T1 ## _scalar, T2 ## _scalar, *) \ + \ + DEFBINOP (ss_div, T1 ## _scalar, T2 ## _scalar) \ + { \ + CAST_BINOP_ARGS (const octave_ ## T1 ## _scalar&, const octave_ ## T2 ## _scalar&); \ + \ + double d = v2.T2 ## _scalar_value (); \ + \ + if (d == 0.0) \ + gripe_divide_by_zero (); \ + \ + return octave_value (v1.T1 ## _scalar_value () / d); \ + } \ + \ + /* DEFBINOP_FN (ss_pow, T1 ## _scalar, T2 ## _scalar, xpow) */ \ + \ + DEFBINOP (ss_ldiv, T1 ## _scalar, T2 ## _scalar) \ + { \ + CAST_BINOP_ARGS (const octave_ ## T1 ## _scalar&, const octave_ ## T2 ## _scalar&); \ + \ + double d = v1.T1 ## _scalar_value (); \ + \ + if (d == 0.0) \ + gripe_divide_by_zero (); \ + \ + return octave_value (v2.T2 ## _scalar_value () / d); \ + } \ + \ + DEFBINOP_OP (ss_el_mul, T1 ## _scalar, T2 ## _scalar, *) \ + \ + DEFBINOP (ss_el_div, T1 ## _scalar, T2 ## _scalar) \ + { \ + CAST_BINOP_ARGS (const octave_ ## T1 ## _scalar&, const octave_ ## T2 ## _scalar&); \ + \ + double d = v2.T2 ## _scalar_value (); \ + \ + if (d == 0.0) \ + gripe_divide_by_zero (); \ + \ + return octave_value (v1.T1 ## _scalar_value () / d); \ + } \ + \ + DEFBINOP_FN (ss_el_pow, T1 ## _scalar, T2 ## _scalar, xpow) \ + \ + DEFBINOP (ss_el_ldiv, T1 ## _scalar, T2 ## _scalar) \ + { \ + CAST_BINOP_ARGS (const octave_ ## T1 ## _scalar&, const octave_ ## T2 ## _scalar&); \ + \ + double d = v1.T1 ## _scalar_value (); \ + \ + if (d == 0.0) \ + gripe_divide_by_zero (); \ + \ + return octave_value (v2.T2 ## _scalar_value () / d); \ + } \ + +#define OCTAVE_SS_INT_BOOL_OPS(T1, T2) \ + /* DEFBINOP_OP (ss_el_and, T1 ## _scalar, T2 ## _scalar, &&) */ \ + /* DEFBINOP_OP (ss_el_or, T1 ## _scalar, T2 ## _scalar, ||) */ + +#define OCTAVE_SS_INT_CMP_OPS(T1, T2) \ + DEFBINOP_OP (ss_lt, T1 ## _scalar, T2 ## _scalar, <) \ + DEFBINOP_OP (ss_le, T1 ## _scalar, T2 ## _scalar, <=) \ + DEFBINOP_OP (ss_eq, T1 ## _scalar, T2 ## _scalar, ==) \ + DEFBINOP_OP (ss_ge, T1 ## _scalar, T2 ## _scalar, >=) \ + DEFBINOP_OP (ss_gt, T1 ## _scalar, T2 ## _scalar, >) \ + DEFBINOP_OP (ss_ne, T1 ## _scalar, T2 ## _scalar, !=) + +#define OCTAVE_SS_INT_OPS(TYPE) \ + OCTAVE_S_INT_UNOPS (TYPE) \ + OCTAVE_SS_INT_ARITH_OPS (TYPE, TYPE) \ + OCTAVE_SS_INT_CMP_OPS (TYPE, TYPE) \ + OCTAVE_SS_INT_BOOL_OPS (TYPE, TYPE) + +#define OCTAVE_SS_INT_OPS2(T1, T2) \ + OCTAVE_SS_INT_ARITH_OPS (T1, T2) \ + OCTAVE_SS_INT_CMP_OPS (T1, T2) \ + OCTAVE_SS_INT_BOOL_OPS (T1, T2) + +#define OCTAVE_SM_INT_ARITH_OPS(TS, TM) \ + /* scalar by matrix ops. */ \ + \ + DEFNDBINOP_OP (sm_add, TS ## _scalar, TM ## _matrix, TS ## _scalar, TM ## _array, +) \ + DEFNDBINOP_OP (sm_sub, TS ## _scalar, TM ## _matrix, TS ## _scalar, TM ## _array, -) \ + DEFNDBINOP_OP (sm_mul, TS ## _scalar, TM ## _matrix, TS ## _scalar, TM ## _array, *) \ + \ + /* DEFBINOP (sm_div, TS ## _scalar, TM ## _matrix) */ \ + /* { */ \ + /* CAST_BINOP_ARGS (const octave_ ## TS ## _scalar&, const octave_ ## TM ## _matrix&); */ \ + /* */ \ + /* Matrix m1 = v1.TM ## _matrix_value (); */ \ + /* Matrix m2 = v2.TM ## _matrix_value (); */ \ + /* */ \ + /* return octave_value (xdiv (m1, m2)); */ \ + /* } */ \ + \ + /* DEFBINOP_FN (sm_pow, TS ## _scalar, TM ## _matrix, xpow) */ \ + \ + /* DEFBINOP (sm_ldiv, TS ## _scalar, TM ## _matrix) */ \ + /* { */ \ + /* CAST_BINOP_ARGS (const octave_ ## TS ## _scalar&, const octave_ ## TM ## _matrix&); */ \ + /* */ \ + /* double d = v1.TS ## _scalar_value (); */ \ + /* */ \ + /* if (d == 0) */ \ + /* gripe_divide_by_zero (); */ \ + /* */ \ + /* return octave_value (v2.TS ## _scalar_value () / d); */ \ + /* } */ \ + \ + DEFNDBINOP_OP (sm_el_mul, TS ## _scalar, TM ## _matrix, TS ## _scalar, TM ## _array, *) \ + /* DEFNDBINOP_FN (sm_el_div, TS ## _scalar, TM ## _matrix, TS ## _scalar, TM ## _array, x_el_div) */ \ + /* DEFNDBINOP_FN (sm_el_pow, TS ## _scalar, TM ## _matrix, TS ## _scalar, TM ## _array, elem_xpow) */ \ + \ + /* DEFBINOP (sm_el_ldiv, TS ## _scalar, TM ## _matrix) */ \ + /* { */ \ + /* CAST_BINOP_ARGS (const octave_ ## TS ## _scalar&, const octave_ ## TM ## _matrix&); */ \ + /* */ \ + /* double d = v1.TS ## _scalar_value (); */ \ + /* */ \ + /* if (d == 0) */ \ + /* gripe_divide_by_zero (); */ \ + /* */ \ + /* return octave_value (v2.TM ## _array_value () / d); */ \ + /* } */ \ + +#define OCTAVE_SM_INT_CMP_OPS(TS, TM) \ + DEFNDBINOP_FN (sm_lt, TS ## _scalar, TM ## _matrix, TS ## _scalar, TM ## _array, mx_el_lt) \ + DEFNDBINOP_FN (sm_le, TS ## _scalar, TM ## _matrix, TS ## _scalar, TM ## _array, mx_el_le) \ + DEFNDBINOP_FN (sm_eq, TS ## _scalar, TM ## _matrix, TS ## _scalar, TM ## _array, mx_el_eq) \ + DEFNDBINOP_FN (sm_ge, TS ## _scalar, TM ## _matrix, TS ## _scalar, TM ## _array, mx_el_ge) \ + DEFNDBINOP_FN (sm_gt, TS ## _scalar, TM ## _matrix, TS ## _scalar, TM ## _array, mx_el_gt) \ + DEFNDBINOP_FN (sm_ne, TS ## _scalar, TM ## _matrix, TS ## _scalar, TM ## _array, mx_el_ne) + +#define OCTAVE_SM_INT_BOOL_OPS(TS, TM) \ + /* DEFNDBINOP_FN (sm_el_and, TS ## _scalar, TYPE ## _matrix, TS ## _scalar, TYPE ## _array, mx_el_and) */ \ + /* DEFNDBINOP_FN (sm_el_or, TS ## _scalar, TYPE ## _matrix, TS ## _scalar, TYPE ## _array, mx_el_or) */ + +#define OCTAVE_SM_INT_OPS(TYPE) \ + OCTAVE_SM_INT_ARITH_OPS (TYPE, TYPE) \ + OCTAVE_SM_INT_CMP_OPS (TYPE, TYPE) \ + OCTAVE_SM_INT_BOOL_OPS (TYPE, TYPE) \ + \ + /* DEFCONV (TYPE ## _matrix_conv, TYPE ## _scalar, TYPE ## _matrix) */ \ + /* { */ \ + /* CAST_CONV_ARG (const octave_ ## TYPE ## _scalar&); */ \ + /* */ \ + /* return new octave_ ## TYPE ## _matrix (v.TYPE ## _matrix_value ()); */ \ + /* } */ + +#define OCTAVE_SM_INT_OPS2(TS, TM) \ + OCTAVE_SM_INT_ARITH_OPS (TS, TM) \ + OCTAVE_SM_INT_CMP_OPS (TS, TM) \ + OCTAVE_SM_INT_BOOL_OPS (TS, TM) + +#define OCTAVE_MS_INT_ARITH_OPS(TM, TS) \ + /* matrix by scalar ops. */ \ + \ + DEFNDBINOP_OP (ms_add, TM ## _matrix, TS ## _scalar, TM ## _array, TS ## _scalar, +) \ + DEFNDBINOP_OP (ms_sub, TM ## _matrix, TS ## _scalar, TM ## _array, TS ## _scalar, -) \ + DEFNDBINOP_OP (ms_mul, TM ## _matrix, TS ## _scalar, TM ## _array, TS ## _scalar, *) \ + \ + /* DEFBINOP (ms_div, TM ## _matrix, TS ## _scalar) */ \ + /* { */ \ + /* CAST_BINOP_ARGS (const octave_ ## TM ## _matrix&, const octave_ ## TS ## _scalar&); */ \ + /* */ \ + /* double d = v2.TM ## _ ## TS ## _scalar_value (); */ \ + /* */ \ + /* if (d == 0.0) */ \ + /* gripe_divide_by_zero (); */ \ + /* */ \ + /* return octave_value (v1.TM ## _array_value () / d); */ \ + /* } */ \ + \ + /* DEFBINOP_FN (ms_pow, TM ## _matrix, TS ## _scalar, xpow) */ \ + \ + /* DEFBINOP (ms_ldiv, TM ## _matrix, TS ## _scalar) */ \ + /* { */ \ + /* CAST_BINOP_ARGS (const octave_ ## TM ## _matrix&, const octave_ ## TS ## _scalar&); */ \ + /* */ \ + /* Matrix m1 = v1.TM ## _matrix_value (); */ \ + /* Matrix m2 = v2.TM ## _matrix_value (); */ \ + /* */ \ + /* return octave_value (xleftdiv (m1, m2)); */ \ + /* } */ \ + \ + DEFNDBINOP_OP (ms_el_mul, TM ## _matrix, TS ## _scalar, TM ## _array, TS ## _scalar, *) \ + \ + /* DEFBINOP (ms_el_div, TM ## _matrix, TS ## _scalar) */ \ + /* { */ \ + /* CAST_BINOP_ARGS (const octave_ ## TM ## _matrix&, const octave_ ## TS ## _scalar&); */ \ + /* */ \ + /* double d = v2.TM ## _ ## TS ## _scalar_value (); */ \ + /* */ \ + /* if (d == 0.0) */ \ + /* gripe_divide_by_zero (); */ \ + /* */ \ + /* return octave_value (v1.TM ## _array_value () / d); */ \ + /* } */ \ + \ + /* DEFNDBINOP_FN (ms_el_pow, TM ## _matrix, TS ## _scalar, TM ## _array, TS ## _scalar, elem_xpow) */ \ + \ + /* DEFBINOP (el_ldiv, TM ## _matrix, TS ## _scalar) */ \ + /* { */ \ + /* CAST_BINOP_ARGS (const octave_ ## TM ## _matrix&, const octave_ ## TS ## _scalar&); */ \ + /* */ \ + /* return x_el_div (v2.TM ## _ ## TS ## _scalar_value (), v1.TM ## _array_value ()); */ \ + /* } */ + +#define OCTAVE_MS_INT_CMP_OPS(TM, TS) \ + DEFNDBINOP_FN (ms_lt, TM ## _matrix, TS ## _scalar, TM ## _array, TS ## _scalar, mx_el_lt) \ + DEFNDBINOP_FN (ms_le, TM ## _matrix, TS ## _scalar, TM ## _array, TS ## _scalar, mx_el_le) \ + DEFNDBINOP_FN (ms_eq, TM ## _matrix, TS ## _scalar, TM ## _array, TS ## _scalar, mx_el_eq) \ + DEFNDBINOP_FN (ms_ge, TM ## _matrix, TS ## _scalar, TM ## _array, TS ## _scalar, mx_el_ge) \ + DEFNDBINOP_FN (ms_gt, TM ## _matrix, TS ## _scalar, TM ## _array, TS ## _scalar, mx_el_gt) \ + DEFNDBINOP_FN (ms_ne, TM ## _matrix, TS ## _scalar, TM ## _array, TS ## _scalar, mx_el_ne) \ + +#define OCTAVE_MS_INT_BOOL_OPS(TM, TS) \ + /* DEFNDBINOP_FN (ms_el_and, TM ## _matrix, TS ## _scalar, TM ## _array, TS ## _scalar, mx_el_and) */ \ + /* DEFNDBINOP_FN (ms_el_or, TM ## _matrix, TS ## _scalar, TM + ## _array, TS ## _scalar, mx_el_or) */ + +#define OCTAVE_MS_INT_ASSIGN_OPS(TM, TS) \ + DEFNDASSIGNOP_FN (ms_assign, TM ## _matrix, TS ## _scalar, TS ## _array, assign) + +#define OCTAVE_MS_INT_OPS(TYPE) \ + OCTAVE_MS_INT_ARITH_OPS (TYPE, TYPE) \ + OCTAVE_MS_INT_CMP_OPS (TYPE, TYPE) \ + OCTAVE_MS_INT_BOOL_OPS (TYPE, TYPE) \ + OCTAVE_MS_INT_ASSIGN_OPS (TYPE, TYPE) + +#define OCTAVE_M_INT_UNOPS(TYPE) \ + /* matrix unary ops. */ \ + \ + DEFNDUNOP_OP (m_not, TYPE ## _matrix, TYPE ## _array, !) \ + DEFNDUNOP_OP (m_uminus, TYPE ## _matrix, TYPE ## _array, -) \ + \ + DEFUNOP (m_transpose, TYPE ## _matrix) \ + { \ + CAST_UNOP_ARG (const octave_ ## TYPE ## _matrix&); \ + \ + if (v.ndims () > 2) \ + { \ + error ("transpose not defined for N-d objects"); \ + return octave_value (); \ + } \ + else \ + return octave_value (v.TYPE ## _array_value().transpose ()); \ + } \ + \ + /* DEFNCUNOP_METHOD (m_incr, TYPE ## _matrix, increment) */ \ + /* DEFNCUNOP_METHOD (m_decr, TYPE ## _matrix, decrement) */ + +#define OCTAVE_MM_INT_ARITH_OPS(T1, T2) \ + /* matrix by matrix ops. */ \ + \ + DEFNDBINOP_OP (mm_add, T1 ## _matrix, T2 ## _matrix, T1 ## _array, T2 ## _array, +) \ + DEFNDBINOP_OP (mm_sub, T1 ## _matrix, T2 ## _matrix, T1 ## _array, T2 ## _array, -) \ + \ + /* DEFBINOP_OP (mm_mul, T1 ## _matrix, T2 ## _matrix, *) */ \ + /* DEFBINOP_FN (mm_div, T1 ## _matrix, T2 ## _matrix, xdiv) */ \ + \ + DEFBINOPX (mm_pow, T1 ## _matrix, T2 ## _matrix) \ + { \ + error ("can't do A ^ B for A and B both matrices"); \ + return octave_value (); \ + } \ + \ + /* DEFBINOP_FN (ldiv, T1 ## _matrix, T2 ## _matrix, xleftdiv) */ \ + \ + DEFNDBINOP_FN (mm_el_mul, T1 ## _matrix, T2 ## _matrix, T1 ## _array, T2 ## _array, product) \ + \ + DEFNDBINOP_FN (mm_el_div, T1 ## _matrix, T2 ## _matrix, T1 ## _array, T2 ## _array, quotient) \ + \ + /* DEFNDBINOP_FN (mm_el_pow, T1 ## _matrix, T2 ## _matrix, T1 ## _array, T2 ## _array, elem_xpow) */ \ + \ + /* DEFBINOP (mm_el_ldiv, T1 ## _matrix, T2 ## _matrix) */ \ + /* { */ \ + /* CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); */ \ + /* */ \ + /* return octave_value (quotient (v2.array_value (), v1.array_value ())); */ \ + /* } */ + +#define OCTAVE_MM_INT_CMP_OPS(T1, T2) \ + DEFNDBINOP_FN (mm_lt, T1 ## _matrix, T2 ## _matrix, T1 ## _array, T2 ## _array, mx_el_lt) \ + DEFNDBINOP_FN (mm_le, T1 ## _matrix, T2 ## _matrix, T1 ## _array, T2 ## _array, mx_el_le) \ + DEFNDBINOP_FN (mm_eq, T1 ## _matrix, T2 ## _matrix, T1 ## _array, T2 ## _array, mx_el_eq) \ + DEFNDBINOP_FN (mm_ge, T1 ## _matrix, T2 ## _matrix, T1 ## _array, T2 ## _array, mx_el_ge) \ + DEFNDBINOP_FN (mm_gt, T1 ## _matrix, T2 ## _matrix, T1 ## _array, T2 ## _array, mx_el_gt) \ + DEFNDBINOP_FN (mm_ne, T1 ## _matrix, T2 ## _matrix, T1 ## _array, T2 ## _array, mx_el_ne) + +#define OCTAVE_MM_INT_BOOL_OPS(T1, T2) \ + DEFNDBINOP_FN (mm_el_and, T1 ## _matrix, T2 ## _matrix, T1 ## _array, T2 ## _array, mx_el_and) \ + DEFNDBINOP_FN (mm_el_or, T1 ## _matrix, T2 ## _matrix, T1 ## _array, T2 ## _array, mx_el_or) + +#define OCTAVE_MM_INT_ASSIGN_OPS(TYPE) \ + DEFNDASSIGNOP_FN (mm_assign, TYPE ## _matrix, TYPE ## _matrix, TYPE ## _array, assign) + +#define OCTAVE_MM_INT_OPS(TYPE) \ + OCTAVE_M_INT_UNOPS (TYPE) \ + OCTAVE_MM_INT_ARITH_OPS (TYPE, TYPE) \ + OCTAVE_MM_INT_CMP_OPS (TYPE, TYPE) \ + OCTAVE_MM_INT_BOOL_OPS (TYPE, TYPE) \ + OCTAVE_MM_INT_ASSIGN_OPS (TYPE) + +#define OCTAVE_MM_INT_OPS2(T1, T2) \ + OCTAVE_MM_INT_ARITH_OPS (T1, T2) \ + OCTAVE_MM_INT_CMP_OPS (T1, T2) \ + OCTAVE_MM_INT_BOOL_OPS (T1, T2) + +#define OCTAVE_INT_OPS(TYPE) \ + OCTAVE_SS_INT_OPS (TYPE) \ + OCTAVE_SM_INT_OPS (TYPE) \ + OCTAVE_MS_INT_OPS (TYPE) \ + OCTAVE_MM_INT_OPS (TYPE) + +#define OCTAVE_INSTALL_S_INT_UNOPS(TYPE) \ + INSTALL_UNOP (op_not, octave_ ## TYPE ## _scalar, s_not); \ + INSTALL_UNOP (op_uminus, octave_ ## TYPE ## _scalar, s_uminus); \ + INSTALL_UNOP (op_transpose, octave_ ## TYPE ## _scalar, s_transpose); \ + INSTALL_UNOP (op_hermitian, octave_ ## TYPE ## _scalar, s_hermitian); \ + \ + /* INSTALL_NCUNOP (op_incr, octave_ ## TYPE ## _scalar, s_incr); */ \ + /* INSTALL_NCUNOP (op_decr, octave_ ## TYPE ## _scalar, s_decr); */ + +#define OCTAVE_INSTALL_SS_INT_ARITH_OPS(T1, T2) \ + INSTALL_BINOP (op_add, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_add); \ + INSTALL_BINOP (op_sub, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_sub); \ + INSTALL_BINOP (op_mul, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_mul); \ + INSTALL_BINOP (op_div, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_div); \ + /* INSTALL_BINOP (op_pow, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_pow); */ \ + INSTALL_BINOP (op_ldiv, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_ldiv); \ + INSTALL_BINOP (op_el_mul, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_el_mul); \ + INSTALL_BINOP (op_el_div, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_el_div); \ + INSTALL_BINOP (op_el_pow, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_el_pow); \ + INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_el_ldiv); + +#define OCTAVE_INSTALL_SS_INT_CMP_OPS(T1, T2) \ + INSTALL_BINOP (op_lt, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_lt); \ + INSTALL_BINOP (op_le, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_le); \ + INSTALL_BINOP (op_eq, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_eq); \ + INSTALL_BINOP (op_ge, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_ge); \ + INSTALL_BINOP (op_gt, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_gt); \ + INSTALL_BINOP (op_ne, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_ne); + +#define OCTAVE_INSTALL_SS_INT_BOOL_OPS(T1, T2) \ + /* INSTALL_BINOP (op_el_and, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_el_and); */ \ + /* INSTALL_BINOP (op_el_or, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, ss_el_or); */ + +#define OCTAVE_INSTALL_SS_INT_OPS(TYPE) \ + OCTAVE_INSTALL_S_INT_UNOPS (TYPE) \ + OCTAVE_INSTALL_SS_INT_ARITH_OPS (TYPE, TYPE) \ + OCTAVE_INSTALL_SS_INT_CMP_OPS (TYPE, TYPE) \ + OCTAVE_INSTALL_SS_INT_BOOL_OPS (TYPE, TYPE) \ + INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix) + +#define OCTAVE_INSTALL_SS_INT_OPS2(T1, T2) \ + OCTAVE_INSTALL_SS_INT_ARITH_OPS (T1, T2) \ + OCTAVE_INSTALL_SS_INT_CMP_OPS (T1, T2) \ + OCTAVE_INSTALL_SS_INT_BOOL_OPS (T1, T2) + +#define OCTAVE_INSTALL_SM_INT_ARITH_OPS(T1, T2) \ + INSTALL_BINOP (op_add, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_add); \ + INSTALL_BINOP (op_sub, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_sub); \ + INSTALL_BINOP (op_mul, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_mul); \ + /* INSTALL_BINOP (op_div, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_div); */ \ + /* INSTALL_BINOP (op_pow, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_pow); */ \ + /* INSTALL_BINOP (op_ldiv, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_ldiv); */ \ + INSTALL_BINOP (op_el_mul, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_el_mul); \ + /* INSTALL_BINOP (op_el_div, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_el_div); */ \ + /* INSTALL_BINOP (op_el_pow, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_el_pow); */ \ + /* INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_el_ldiv); */ + +#define OCTAVE_INSTALL_SM_INT_CMP_OPS(T1, T2) \ + INSTALL_BINOP (op_lt, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_lt); \ + INSTALL_BINOP (op_le, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_le); \ + INSTALL_BINOP (op_eq, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_eq); \ + INSTALL_BINOP (op_ge, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_ge); \ + INSTALL_BINOP (op_gt, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_gt); \ + INSTALL_BINOP (op_ne, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_ne); + +#define OCTAVE_INSTALL_SM_INT_BOOL_OPS(T1, T2) \ + /* INSTALL_BINOP (op_el_and, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_el_and); */ \ + /* INSTALL_BINOP (op_el_or, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, sm_el_or); */ + +#define OCTAVE_INSTALL_SM_INT_OPS(TYPE) \ + OCTAVE_INSTALL_SM_INT_ARITH_OPS (TYPE, TYPE) \ + OCTAVE_INSTALL_SM_INT_CMP_OPS (TYPE, TYPE) \ + OCTAVE_INSTALL_SM_INT_BOOL_OPS (TYPE, TYPE) \ + /* INSTALL_WIDENOP (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, TYPE ## _matrix_conv); */ \ + INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _matrix) + +#define OCTAVE_INSTALL_SM_INT_OPS2(T1, T2) \ + OCTAVE_INSTALL_SM_INT_ARITH_OPS (T1, T2) \ + OCTAVE_INSTALL_SM_INT_CMP_OPS (T1, T2) \ + OCTAVE_INSTALL_SM_INT_BOOL_OPS (T1, T2) + +#define OCTAVE_INSTALL_MS_INT_ARITH_OPS(T1, T2) \ + INSTALL_BINOP (op_add, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_add); \ + INSTALL_BINOP (op_sub, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_sub); \ + INSTALL_BINOP (op_mul, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_mul); \ + /* INSTALL_BINOP (op_div, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_div); */ \ + /* INSTALL_BINOP (op_pow, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_pow); */ \ + /* INSTALL_BINOP (op_ldiv, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_ldiv); */ \ + \ + INSTALL_BINOP (op_el_mul, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_el_mul); \ + /* INSTALL_BINOP (op_el_div, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_el_div); */ \ + /* INSTALL_BINOP (op_el_pow, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_el_pow); */ \ + /* INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_el_ldiv); */ + +#define OCTAVE_INSTALL_MS_INT_CMP_OPS(T1, T2) \ + /* INSTALL_BINOP (op_lt, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_lt); */ \ + \ + octave_value_typeinfo::register_binary_op \ + (octave_value::op_lt, octave_ ## T1 ## _matrix::static_type_id (), \ + octave_ ## T2 ## _scalar::static_type_id (), oct_binop_ms_lt); \ + \ + INSTALL_BINOP (op_le, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_le); \ + INSTALL_BINOP (op_eq, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_eq); \ + INSTALL_BINOP (op_ge, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_ge); \ + INSTALL_BINOP (op_gt, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_gt); \ + INSTALL_BINOP (op_ne, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_ne); + +#define OCTAVE_INSTALL_MS_INT_BOOL_OPS(T1, T2) \ + /* INSTALL_BINOP (op_el_and, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_el_and); */ \ + /* INSTALL_BINOP (op_el_or, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, ms_el_or); */ + +#define OCTAVE_INSTALL_MS_INT_OPS(TYPE) \ + OCTAVE_INSTALL_MS_INT_ARITH_OPS (TYPE, TYPE) \ + OCTAVE_INSTALL_MS_INT_CMP_OPS (TYPE, TYPE) \ + OCTAVE_INSTALL_MS_INT_BOOL_OPS (TYPE, TYPE) \ + INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _scalar, ms_assign) + +#define OCTAVE_INSTALL_MS_INT_OPS2(T1, T2) \ + OCTAVE_INSTALL_MS_INT_ARITH_OPS (T1, T2) \ + OCTAVE_INSTALL_MS_INT_CMP_OPS (T1, T2) \ + OCTAVE_INSTALL_MS_INT_BOOL_OPS (T1, T2) + +#define OCTAVE_INSTALL_M_INT_UNOPS(TYPE) \ + INSTALL_UNOP (op_not, octave_ ## TYPE ## _matrix, m_not); \ + INSTALL_UNOP (op_uminus, octave_ ## TYPE ## _matrix, m_uminus); \ + INSTALL_UNOP (op_transpose, octave_ ## TYPE ## _matrix, m_transpose); \ + INSTALL_UNOP (op_hermitian, octave_ ## TYPE ## _matrix, m_transpose); \ + \ + /* INSTALL_NCUNOP (op_incr, octave_ ## TYPE ## _matrix, m_incr); */ \ + /* INSTALL_NCUNOP (op_decr, octave_ ## TYPE ## _matrix, m_decr); */ + +#define OCTAVE_INSTALL_MM_INT_ARITH_OPS(T1, T2) \ + INSTALL_BINOP (op_add, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_add); \ + INSTALL_BINOP (op_sub, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_sub); \ + /* INSTALL_BINOP (op_mul, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_mul); */ \ + /* INSTALL_BINOP (op_div, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_div); */ \ + INSTALL_BINOP (op_pow, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_pow); \ + /* INSTALL_BINOP (op_ldiv, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_ldiv); */ \ + INSTALL_BINOP (op_el_mul, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_el_mul); \ + INSTALL_BINOP (op_el_div, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_el_div); \ + /* INSTALL_BINOP (op_el_pow, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_el_pow); */ \ + /* INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_el_ldiv); */ + +#define OCTAVE_INSTALL_MM_INT_CMP_OPS(T1, T2) \ + INSTALL_BINOP (op_lt, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_lt); \ + INSTALL_BINOP (op_le, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_le); \ + INSTALL_BINOP (op_eq, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_eq); \ + INSTALL_BINOP (op_ge, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_ge); \ + INSTALL_BINOP (op_gt, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_gt); \ + INSTALL_BINOP (op_ne, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_ne); + +#define OCTAVE_INSTALL_MM_INT_BOOL_OPS(T1, T2) \ + INSTALL_BINOP (op_el_and, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_el_and); \ + INSTALL_BINOP (op_el_or, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_el_or); + +#define OCTAVE_INSTALL_MM_INT_ASSIGN_OPS(TYPE) \ + INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _matrix, mm_assign) + +#define OCTAVE_INSTALL_MM_INT_OPS(TYPE) \ + OCTAVE_INSTALL_M_INT_UNOPS (TYPE) \ + OCTAVE_INSTALL_MM_INT_ARITH_OPS (TYPE, TYPE) \ + OCTAVE_INSTALL_MM_INT_CMP_OPS (TYPE, TYPE) \ + OCTAVE_INSTALL_MM_INT_BOOL_OPS (TYPE, TYPE) \ + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (TYPE) + +#define OCTAVE_INSTALL_MM_INT_OPS2(T1, T2) \ + OCTAVE_INSTALL_MM_INT_ARITH_OPS (T1, T2) \ + OCTAVE_INSTALL_MM_INT_CMP_OPS (T1, T2) \ + OCTAVE_INSTALL_MM_INT_BOOL_OPS (T1, T2) + +#define OCTAVE_INSTALL_INT_OPS(TYPE) \ + OCTAVE_INSTALL_SS_INT_OPS (TYPE) \ + OCTAVE_INSTALL_SM_INT_OPS (TYPE) \ + OCTAVE_INSTALL_MS_INT_OPS (TYPE) \ + OCTAVE_INSTALL_MM_INT_OPS (TYPE) + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/ + diff -r 71229573b6bf -r f7a337f3fd9e src/OPERATORS/op-ui16-ui16.cc --- a/src/OPERATORS/op-ui16-ui16.cc Mon Jun 14 19:33:53 2004 +0000 +++ b/src/OPERATORS/op-ui16-ui16.cc Thu Jun 17 04:14:36 2004 +0000 @@ -37,99 +37,14 @@ #include "xdiv.h" #include "xpow.h" -// matrix unary ops. - -DEFNDUNOP_OP (not, uint16_matrix, uint16_array, !) -DEFNDUNOP_OP (uminus, uint16_matrix, uint16_array, -) - -DEFUNOP (transpose, uint16_matrix) -{ - CAST_UNOP_ARG (const octave_uint16_matrix&); - - if (v.ndims () > 2) - { - error ("transpose not defined for N-d objects"); - return octave_value (); - } - else - return octave_value (v.uint16_array_value().transpose ()); -} - -//DEFNCUNOP_METHOD (incr, uint16_matrix, increment) -//DEFNCUNOP_METHOD (decr, uint16_matrix, decrement) - -// matrix by matrix ops. - -DEFNDBINOP_OP (add, uint16_matrix, uint16_matrix, uint16_array, uint16_array, +) -DEFNDBINOP_OP (sub, uint16_matrix, uint16_matrix, uint16_array, uint16_array, -) - -//DEFBINOP_OP (mul, uint16_matrix, uint16_matrix, *) -//DEFBINOP_FN (div, uint16_matrix, uint16_matrix, xdiv) +#include "op-int.h" -DEFBINOPX (pow, uint16_matrix, uint16_matrix) -{ - error ("can't do A ^ B for A and B both matrices"); - return octave_value (); -} - -//DEFBINOP_FN (ldiv, uint16_matrix, uint16_matrix, xleftdiv) - -DEFNDBINOP_FN (lt, uint16_matrix, uint16_matrix, uint16_array, uint16_array, mx_el_lt) -DEFNDBINOP_FN (le, uint16_matrix, uint16_matrix, uint16_array, uint16_array, mx_el_le) -DEFNDBINOP_FN (eq, uint16_matrix, uint16_matrix, uint16_array, uint16_array, mx_el_eq) -DEFNDBINOP_FN (ge, uint16_matrix, uint16_matrix, uint16_array, uint16_array, mx_el_ge) -DEFNDBINOP_FN (gt, uint16_matrix, uint16_matrix, uint16_array, uint16_array, mx_el_gt) -DEFNDBINOP_FN (ne, uint16_matrix, uint16_matrix, uint16_array, uint16_array, mx_el_ne) - -DEFNDBINOP_FN (el_mul, uint16_matrix, uint16_matrix, uint16_array, uint16_array, product) - -DEFNDBINOP_FN (el_div, uint16_matrix, uint16_matrix, uint16_array, uint16_array, quotient) - -//DEFNDBINOP_FN (el_pow, uint16_matrix, uint16_matrix, uint16_array, uint16_array, elem_xpow) - -//DEFBINOP (el_ldiv, uint16_matrix, uint16_matrix) -//{ -// CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); -// -// return octave_value (quotient (v2.array_value (), v1.array_value ())); -//} - -DEFNDBINOP_FN (el_and, uint16_matrix, uint16_matrix, uint16_array, uint16_array, mx_el_and) -DEFNDBINOP_FN (el_or, uint16_matrix, uint16_matrix, uint16_array, uint16_array, mx_el_or) - -DEFNDASSIGNOP_FN (assign, uint16_matrix, uint16_matrix, uint16_array, assign) +OCTAVE_INT_OPS (uint16) void install_ui16_ui16_ops (void) { - INSTALL_UNOP (op_not, octave_uint16_matrix, not); - INSTALL_UNOP (op_uminus, octave_uint16_matrix, uminus); - INSTALL_UNOP (op_transpose, octave_uint16_matrix, transpose); - INSTALL_UNOP (op_hermitian, octave_uint16_matrix, transpose); - - // INSTALL_NCUNOP (op_incr, octave_uint16_matrix, incr); - // INSTALL_NCUNOP (op_decr, octave_uint16_matrix, decr); - - INSTALL_BINOP (op_add, octave_uint16_matrix, octave_uint16_matrix, add); - INSTALL_BINOP (op_sub, octave_uint16_matrix, octave_uint16_matrix, sub); - // INSTALL_BINOP (op_mul, octave_uint16_matrix, octave_uint16_matrix, mul); - // INSTALL_BINOP (op_div, octave_uint16_matrix, octave_uint16_matrix, div); - // INSTALL_BINOP (op_pow, octave_uint16_matrix, octave_uint16_matrix, pow); - // INSTALL_BINOP (op_ldiv, octave_uint16_matrix, octave_uint16_matrix, ldiv); - INSTALL_BINOP (op_lt, octave_uint16_matrix, octave_uint16_matrix, lt); - INSTALL_BINOP (op_le, octave_uint16_matrix, octave_uint16_matrix, le); - INSTALL_BINOP (op_eq, octave_uint16_matrix, octave_uint16_matrix, eq); - INSTALL_BINOP (op_ge, octave_uint16_matrix, octave_uint16_matrix, ge); - INSTALL_BINOP (op_gt, octave_uint16_matrix, octave_uint16_matrix, gt); - INSTALL_BINOP (op_ne, octave_uint16_matrix, octave_uint16_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_uint16_matrix, octave_uint16_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_uint16_matrix, octave_uint16_matrix, el_div); - // INSTALL_BINOP (op_el_pow, octave_uint16_matrix, octave_uint16_matrix, el_pow); - // INSTALL_BINOP (op_el_ldiv, octave_uint16_matrix, octave_uint16_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_uint16_matrix, octave_uint16_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_uint16_matrix, octave_uint16_matrix, el_or); - - INSTALL_ASSIGNOP (op_asn_eq, octave_uint16_matrix, octave_uint16_matrix, assign); + OCTAVE_INSTALL_INT_OPS (uint16); } /* diff -r 71229573b6bf -r f7a337f3fd9e src/OPERATORS/op-ui32-ui32.cc --- a/src/OPERATORS/op-ui32-ui32.cc Mon Jun 14 19:33:53 2004 +0000 +++ b/src/OPERATORS/op-ui32-ui32.cc Thu Jun 17 04:14:36 2004 +0000 @@ -37,99 +37,14 @@ #include "xdiv.h" #include "xpow.h" -// matrix unary ops. - -DEFNDUNOP_OP (not, uint32_matrix, uint32_array, !) -DEFNDUNOP_OP (uminus, uint32_matrix, uint32_array, -) - -DEFUNOP (transpose, uint32_matrix) -{ - CAST_UNOP_ARG (const octave_uint32_matrix&); - - if (v.ndims () > 2) - { - error ("transpose not defined for N-d objects"); - return octave_value (); - } - else - return octave_value (v.uint32_array_value().transpose ()); -} - -//DEFNCUNOP_METHOD (incr, uint32_matrix, increment) -//DEFNCUNOP_METHOD (decr, uint32_matrix, decrement) - -// matrix by matrix ops. - -DEFNDBINOP_OP (add, uint32_matrix, uint32_matrix, uint32_array, uint32_array, +) -DEFNDBINOP_OP (sub, uint32_matrix, uint32_matrix, uint32_array, uint32_array, -) - -//DEFBINOP_OP (mul, uint32_matrix, uint32_matrix, *) -//DEFBINOP_FN (div, uint32_matrix, uint32_matrix, xdiv) +#include "op-int.h" -DEFBINOPX (pow, uint32_matrix, uint32_matrix) -{ - error ("can't do A ^ B for A and B both matrices"); - return octave_value (); -} - -//DEFBINOP_FN (ldiv, uint32_matrix, uint32_matrix, xleftdiv) - -DEFNDBINOP_FN (lt, uint32_matrix, uint32_matrix, uint32_array, uint32_array, mx_el_lt) -DEFNDBINOP_FN (le, uint32_matrix, uint32_matrix, uint32_array, uint32_array, mx_el_le) -DEFNDBINOP_FN (eq, uint32_matrix, uint32_matrix, uint32_array, uint32_array, mx_el_eq) -DEFNDBINOP_FN (ge, uint32_matrix, uint32_matrix, uint32_array, uint32_array, mx_el_ge) -DEFNDBINOP_FN (gt, uint32_matrix, uint32_matrix, uint32_array, uint32_array, mx_el_gt) -DEFNDBINOP_FN (ne, uint32_matrix, uint32_matrix, uint32_array, uint32_array, mx_el_ne) - -DEFNDBINOP_FN (el_mul, uint32_matrix, uint32_matrix, uint32_array, uint32_array, product) - -DEFNDBINOP_FN (el_div, uint32_matrix, uint32_matrix, uint32_array, uint32_array, quotient) - -//DEFNDBINOP_FN (el_pow, uint32_matrix, uint32_matrix, uint32_array, uint32_array, elem_xpow) - -//DEFBINOP (el_ldiv, uint32_matrix, uint32_matrix) -//{ -// CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); -// -// return octave_value (quotient (v2.array_value (), v1.array_value ())); -//} - -DEFNDBINOP_FN (el_and, uint32_matrix, uint32_matrix, uint32_array, uint32_array, mx_el_and) -DEFNDBINOP_FN (el_or, uint32_matrix, uint32_matrix, uint32_array, uint32_array, mx_el_or) - -DEFNDASSIGNOP_FN (assign, uint32_matrix, uint32_matrix, uint32_array, assign) +OCTAVE_INT_OPS (uint32) void install_ui32_ui32_ops (void) { - INSTALL_UNOP (op_not, octave_uint32_matrix, not); - INSTALL_UNOP (op_uminus, octave_uint32_matrix, uminus); - INSTALL_UNOP (op_transpose, octave_uint32_matrix, transpose); - INSTALL_UNOP (op_hermitian, octave_uint32_matrix, transpose); - - // INSTALL_NCUNOP (op_incr, octave_uint32_matrix, incr); - // INSTALL_NCUNOP (op_decr, octave_uint32_matrix, decr); - - INSTALL_BINOP (op_add, octave_uint32_matrix, octave_uint32_matrix, add); - INSTALL_BINOP (op_sub, octave_uint32_matrix, octave_uint32_matrix, sub); - // INSTALL_BINOP (op_mul, octave_uint32_matrix, octave_uint32_matrix, mul); - // INSTALL_BINOP (op_div, octave_uint32_matrix, octave_uint32_matrix, div); - // INSTALL_BINOP (op_pow, octave_uint32_matrix, octave_uint32_matrix, pow); - // INSTALL_BINOP (op_ldiv, octave_uint32_matrix, octave_uint32_matrix, ldiv); - INSTALL_BINOP (op_lt, octave_uint32_matrix, octave_uint32_matrix, lt); - INSTALL_BINOP (op_le, octave_uint32_matrix, octave_uint32_matrix, le); - INSTALL_BINOP (op_eq, octave_uint32_matrix, octave_uint32_matrix, eq); - INSTALL_BINOP (op_ge, octave_uint32_matrix, octave_uint32_matrix, ge); - INSTALL_BINOP (op_gt, octave_uint32_matrix, octave_uint32_matrix, gt); - INSTALL_BINOP (op_ne, octave_uint32_matrix, octave_uint32_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_uint32_matrix, octave_uint32_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_uint32_matrix, octave_uint32_matrix, el_div); - // INSTALL_BINOP (op_el_pow, octave_uint32_matrix, octave_uint32_matrix, el_pow); - // INSTALL_BINOP (op_el_ldiv, octave_uint32_matrix, octave_uint32_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_uint32_matrix, octave_uint32_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_uint32_matrix, octave_uint32_matrix, el_or); - - INSTALL_ASSIGNOP (op_asn_eq, octave_uint32_matrix, octave_uint32_matrix, assign); + OCTAVE_INSTALL_INT_OPS (uint32); } /* diff -r 71229573b6bf -r f7a337f3fd9e src/OPERATORS/op-ui64-ui64.cc --- a/src/OPERATORS/op-ui64-ui64.cc Mon Jun 14 19:33:53 2004 +0000 +++ b/src/OPERATORS/op-ui64-ui64.cc Thu Jun 17 04:14:36 2004 +0000 @@ -37,99 +37,40 @@ #include "xdiv.h" #include "xpow.h" -// matrix unary ops. - -DEFNDUNOP_OP (not, uint64_matrix, uint64_array, !) -DEFNDUNOP_OP (uminus, uint64_matrix, uint64_array, -) - -DEFUNOP (transpose, uint64_matrix) -{ - CAST_UNOP_ARG (const octave_uint64_matrix&); +#include "op-int.h" - if (v.ndims () > 2) - { - error ("transpose not defined for N-d objects"); - return octave_value (); - } - else - return octave_value (v.uint64_array_value().transpose ()); -} - -//DEFNCUNOP_METHOD (incr, uint64_matrix, increment) -//DEFNCUNOP_METHOD (decr, uint64_matrix, decrement) - -// matrix by matrix ops. - -//DEFNDBINOP_OP (add, uint64_matrix, uint64_matrix, uint64_array, uint64_array, +) -//DEFNDBINOP_OP (sub, uint64_matrix, uint64_matrix, uint64_array, uint64_array, -) - -//DEFBINOP_OP (mul, uint64_matrix, uint64_matrix, *) -//DEFBINOP_FN (div, uint64_matrix, uint64_matrix, xdiv) +OCTAVE_S_INT_UNOPS (uint64) +OCTAVE_SS_INT_CMP_OPS (uint64, uint64) +OCTAVE_SS_INT_BOOL_OPS (uint64, uint64) -DEFBINOPX (pow, uint64_matrix, uint64_matrix) -{ - error ("can't do A ^ B for A and B both matrices"); - return octave_value (); -} - -//DEFBINOP_FN (ldiv, uint64_matrix, uint64_matrix, xleftdiv) - -DEFNDBINOP_FN (lt, uint64_matrix, uint64_matrix, uint64_array, uint64_array, mx_el_lt) -DEFNDBINOP_FN (le, uint64_matrix, uint64_matrix, uint64_array, uint64_array, mx_el_le) -DEFNDBINOP_FN (eq, uint64_matrix, uint64_matrix, uint64_array, uint64_array, mx_el_eq) -DEFNDBINOP_FN (ge, uint64_matrix, uint64_matrix, uint64_array, uint64_array, mx_el_ge) -DEFNDBINOP_FN (gt, uint64_matrix, uint64_matrix, uint64_array, uint64_array, mx_el_gt) -DEFNDBINOP_FN (ne, uint64_matrix, uint64_matrix, uint64_array, uint64_array, mx_el_ne) +OCTAVE_SM_INT_CMP_OPS (uint64, uint64) +OCTAVE_SM_INT_BOOL_OPS (uint64, uint64) -//DEFNDBINOP_FN (el_mul, uint64_matrix, uint64_matrix, uint64_array, uint64_array, product) - -//DEFNDBINOP_FN (el_div, uint64_matrix, uint64_matrix, uint64_array, uint64_array, quotient) - -//DEFNDBINOP_FN (el_pow, uint64_matrix, uint64_matrix, uint64_array, uint64_array, elem_xpow) +OCTAVE_MS_INT_CMP_OPS (uint64, uint64) +OCTAVE_MS_INT_BOOL_OPS (uint64, uint64) -//DEFBINOP (el_ldiv, uint64_matrix, uint64_matrix) -//{ -// CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); -// -// return octave_value (quotient (v2.array_value (), v1.array_value ())); -//} - -DEFNDBINOP_FN (el_and, uint64_matrix, uint64_matrix, uint64_array, uint64_array, mx_el_and) -DEFNDBINOP_FN (el_or, uint64_matrix, uint64_matrix, uint64_array, uint64_array, mx_el_or) - -DEFNDASSIGNOP_FN (assign, uint64_matrix, uint64_matrix, uint64_array, assign) +OCTAVE_M_INT_UNOPS (uint64) +OCTAVE_MM_INT_CMP_OPS (uint64, uint64) +OCTAVE_MM_INT_BOOL_OPS (uint64, uint64) +OCTAVE_MM_INT_ASSIGN_OPS (uint64) void install_ui64_ui64_ops (void) { - INSTALL_UNOP (op_not, octave_uint64_matrix, not); - INSTALL_UNOP (op_uminus, octave_uint64_matrix, uminus); - INSTALL_UNOP (op_transpose, octave_uint64_matrix, transpose); - INSTALL_UNOP (op_hermitian, octave_uint64_matrix, transpose); + OCTAVE_INSTALL_S_INT_UNOPS (uint64); + OCTAVE_INSTALL_SS_INT_CMP_OPS (uint64, uint64); + OCTAVE_INSTALL_SS_INT_BOOL_OPS (uint64, uint64); - // INSTALL_NCUNOP (op_incr, octave_uint64_matrix, incr); - // INSTALL_NCUNOP (op_decr, octave_uint64_matrix, decr); + OCTAVE_INSTALL_SM_INT_CMP_OPS (uint64, uint64); + OCTAVE_INSTALL_SM_INT_BOOL_OPS (uint64, uint64); - // INSTALL_BINOP (op_add, octave_uint64_matrix, octave_uint64_matrix, add); - // INSTALL_BINOP (op_sub, octave_uint64_matrix, octave_uint64_matrix, sub); - // INSTALL_BINOP (op_mul, octave_uint64_matrix, octave_uint64_matrix, mul); - // INSTALL_BINOP (op_div, octave_uint64_matrix, octave_uint64_matrix, div); - // INSTALL_BINOP (op_pow, octave_uint64_matrix, octave_uint64_matrix, pow); - // INSTALL_BINOP (op_ldiv, octave_uint64_matrix, octave_uint64_matrix, ldiv); - INSTALL_BINOP (op_lt, octave_uint64_matrix, octave_uint64_matrix, lt); - INSTALL_BINOP (op_le, octave_uint64_matrix, octave_uint64_matrix, le); - INSTALL_BINOP (op_eq, octave_uint64_matrix, octave_uint64_matrix, eq); - INSTALL_BINOP (op_ge, octave_uint64_matrix, octave_uint64_matrix, ge); - INSTALL_BINOP (op_gt, octave_uint64_matrix, octave_uint64_matrix, gt); - INSTALL_BINOP (op_ne, octave_uint64_matrix, octave_uint64_matrix, ne); - // INSTALL_BINOP (op_el_mul, octave_uint64_matrix, octave_uint64_matrix, el_mul); - // INSTALL_BINOP (op_el_div, octave_uint64_matrix, octave_uint64_matrix, el_div); - // INSTALL_BINOP (op_el_pow, octave_uint64_matrix, octave_uint64_matrix, el_pow); - // INSTALL_BINOP (op_el_ldiv, octave_uint64_matrix, octave_uint64_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_uint64_matrix, octave_uint64_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_uint64_matrix, octave_uint64_matrix, el_or); + OCTAVE_INSTALL_MS_INT_CMP_OPS (uint64, uint64); + OCTAVE_INSTALL_MS_INT_BOOL_OPS (uint64, uint64); - INSTALL_ASSIGNOP (op_asn_eq, octave_uint64_matrix, octave_uint64_matrix, assign); + OCTAVE_INSTALL_M_INT_UNOPS (uint64); + OCTAVE_INSTALL_MM_INT_CMP_OPS (uint64, uint64); + OCTAVE_INSTALL_MM_INT_BOOL_OPS (uint64, uint64); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (uint64); } /* diff -r 71229573b6bf -r f7a337f3fd9e src/OPERATORS/op-ui8-ui8.cc --- a/src/OPERATORS/op-ui8-ui8.cc Mon Jun 14 19:33:53 2004 +0000 +++ b/src/OPERATORS/op-ui8-ui8.cc Thu Jun 17 04:14:36 2004 +0000 @@ -37,99 +37,14 @@ #include "xdiv.h" #include "xpow.h" -// matrix unary ops. - -DEFNDUNOP_OP (not, uint8_matrix, uint8_array, !) -DEFNDUNOP_OP (uminus, uint8_matrix, uint8_array, -) - -DEFUNOP (transpose, uint8_matrix) -{ - CAST_UNOP_ARG (const octave_uint8_matrix&); - - if (v.ndims () > 2) - { - error ("transpose not defined for N-d objects"); - return octave_value (); - } - else - return octave_value (v.uint8_array_value().transpose ()); -} - -//DEFNCUNOP_METHOD (incr, uint8_matrix, increment) -//DEFNCUNOP_METHOD (decr, uint8_matrix, decrement) - -// matrix by matrix ops. - -DEFNDBINOP_OP (add, uint8_matrix, uint8_matrix, uint8_array, uint8_array, +) -DEFNDBINOP_OP (sub, uint8_matrix, uint8_matrix, uint8_array, uint8_array, -) - -//DEFBINOP_OP (mul, uint8_matrix, uint8_matrix, *) -//DEFBINOP_FN (div, uint8_matrix, uint8_matrix, xdiv) +#include "op-int.h" -DEFBINOPX (pow, uint8_matrix, uint8_matrix) -{ - error ("can't do A ^ B for A and B both matrices"); - return octave_value (); -} - -//DEFBINOP_FN (ldiv, uint8_matrix, uint8_matrix, xleftdiv) - -DEFNDBINOP_FN (lt, uint8_matrix, uint8_matrix, uint8_array, uint8_array, mx_el_lt) -DEFNDBINOP_FN (le, uint8_matrix, uint8_matrix, uint8_array, uint8_array, mx_el_le) -DEFNDBINOP_FN (eq, uint8_matrix, uint8_matrix, uint8_array, uint8_array, mx_el_eq) -DEFNDBINOP_FN (ge, uint8_matrix, uint8_matrix, uint8_array, uint8_array, mx_el_ge) -DEFNDBINOP_FN (gt, uint8_matrix, uint8_matrix, uint8_array, uint8_array, mx_el_gt) -DEFNDBINOP_FN (ne, uint8_matrix, uint8_matrix, uint8_array, uint8_array, mx_el_ne) - -DEFNDBINOP_FN (el_mul, uint8_matrix, uint8_matrix, uint8_array, uint8_array, product) - -DEFNDBINOP_FN (el_div, uint8_matrix, uint8_matrix, uint8_array, uint8_array, quotient) - -//DEFNDBINOP_FN (el_pow, uint8_matrix, uint8_matrix, uint8_array, uint8_array, elem_xpow) - -//DEFBINOP (el_ldiv, uint8_matrix, uint8_matrix) -//{ -// CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); -// -// return octave_value (quotient (v2.array_value (), v1.array_value ())); -//} - -DEFNDBINOP_FN (el_and, uint8_matrix, uint8_matrix, uint8_array, uint8_array, mx_el_and) -DEFNDBINOP_FN (el_or, uint8_matrix, uint8_matrix, uint8_array, uint8_array, mx_el_or) - -DEFNDASSIGNOP_FN (assign, uint8_matrix, uint8_matrix, uint8_array, assign) +OCTAVE_INT_OPS (uint8) void install_ui8_ui8_ops (void) { - INSTALL_UNOP (op_not, octave_uint8_matrix, not); - INSTALL_UNOP (op_uminus, octave_uint8_matrix, uminus); - INSTALL_UNOP (op_transpose, octave_uint8_matrix, transpose); - INSTALL_UNOP (op_hermitian, octave_uint8_matrix, transpose); - - // INSTALL_NCUNOP (op_incr, octave_uint8_matrix, incr); - // INSTALL_NCUNOP (op_decr, octave_uint8_matrix, decr); - - INSTALL_BINOP (op_add, octave_uint8_matrix, octave_uint8_matrix, add); - INSTALL_BINOP (op_sub, octave_uint8_matrix, octave_uint8_matrix, sub); - // INSTALL_BINOP (op_mul, octave_uint8_matrix, octave_uint8_matrix, mul); - // INSTALL_BINOP (op_div, octave_uint8_matrix, octave_uint8_matrix, div); - // INSTALL_BINOP (op_pow, octave_uint8_matrix, octave_uint8_matrix, pow); - // INSTALL_BINOP (op_ldiv, octave_uint8_matrix, octave_uint8_matrix, ldiv); - INSTALL_BINOP (op_lt, octave_uint8_matrix, octave_uint8_matrix, lt); - INSTALL_BINOP (op_le, octave_uint8_matrix, octave_uint8_matrix, le); - INSTALL_BINOP (op_eq, octave_uint8_matrix, octave_uint8_matrix, eq); - INSTALL_BINOP (op_ge, octave_uint8_matrix, octave_uint8_matrix, ge); - INSTALL_BINOP (op_gt, octave_uint8_matrix, octave_uint8_matrix, gt); - INSTALL_BINOP (op_ne, octave_uint8_matrix, octave_uint8_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_uint8_matrix, octave_uint8_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_uint8_matrix, octave_uint8_matrix, el_div); - // INSTALL_BINOP (op_el_pow, octave_uint8_matrix, octave_uint8_matrix, el_pow); - // INSTALL_BINOP (op_el_ldiv, octave_uint8_matrix, octave_uint8_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_uint8_matrix, octave_uint8_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_uint8_matrix, octave_uint8_matrix, el_or); - - INSTALL_ASSIGNOP (op_asn_eq, octave_uint8_matrix, octave_uint8_matrix, assign); + OCTAVE_INSTALL_INT_OPS (uint8) } /*