Mercurial > hg > octave-nkf
changeset 4953:7a3a480e8645
[project @ 2004-09-01 21:10:28 by jwe]
author | jwe |
---|---|
date | Wed, 01 Sep 2004 21:10:28 +0000 |
parents | bfd57b466752 |
children | ed0f3cb6d3d4 |
files | liboctave/ChangeLog liboctave/mx-ops liboctave/oct-inttypes.h src/ChangeLog src/OPERATORS/op-i16-i16.cc src/OPERATORS/op-i32-i32.cc src/OPERATORS/op-i64-i64.cc src/OPERATORS/op-i8-i8.cc src/OPERATORS/op-int.h src/OPERATORS/op-ui16-ui16.cc src/OPERATORS/op-ui32-ui32.cc src/OPERATORS/op-ui64-ui64.cc src/OPERATORS/op-ui8-ui8.cc src/ov-complex.h |
diffstat | 14 files changed, 865 insertions(+), 330 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,14 @@ +2004-09-01 John W. Eaton <jwe@octave.org> + + * oct-inttypes.h (pow, operator +, operator -, operator *, + operator /): Handle mixed integer/double ops. If op generates a + NaN, set result to 0. + (octave_int::operator - (void)): Convert to double, then negate, + then fit to range. + + * mx-ops: Define integer types. Include declarations for mixed + integer/double ops. + 2004-08-31 John W. Eaton <jwe@octave.org> * oct-inttypes.h (pow): Args now const reference.
--- a/liboctave/mx-ops +++ b/liboctave/mx-ops @@ -1,4 +1,14 @@ # types +# +# key typename object-type header fwd-decl-ok +# +# object-type is one of +# +# S: scalar +# M: matrix +# DM: diagonal matrix +# ND: N-d array +# b bool S NONE NO bm boolMatrix ND boolMatrix.h YES bnda boolNDArray ND boolNDArray.h YES @@ -10,7 +20,27 @@ m Matrix M dMatrix.h YES nda NDArray ND dNDArray.h YES s double S NONE NO +i8 octave_int8 S oct-inttypes.h YES +ui8 octave_uint8 S oct-inttypes.h YES +i16 octave_int16 S oct-inttypes.h YES +ui16 octave_uint16 S oct-inttypes.h YES +i32 octave_int32 S oct-inttypes.h YES +ui32 octave_uint32 S oct-inttypes.h YES +i8nda int8NDArray ND int8NDArray.h YES +ui8nda uint8NDArray ND uint8NDArray.h YES +i16nda int16NDArray ND int16NDArray.h YES +ui16nda uint16NDArray ND uint16NDArray.h YES +i32nda int32NDArray ND int32NDArray.h YES +ui32nda uint32NDArray ND uint32NDArray.h YES # ops +# result_t lhs_t rhs_t op-type lhs_conv rhs_conv zero_val headers ... +# +# op-type is one of +# +# B: binary ops, + - * / +# C: comparison ops, < <= == != >= > +# L: logical ops, & | +# cdm cdm dm B cdm dm cdm B cm cs cdm B @@ -41,3 +71,15 @@ m dm s B m m dm B 0.0 m s dm B +i8nda s i8nda BCL NONE NONE 0 boolMatrix.h boolNDArray.h +i8nda i8nda s BCL NONE NONE 0 boolMatrix.h boolNDArray.h +ui8nda s ui8nda BCL NONE NONE 0 boolMatrix.h boolNDArray.h +ui8nda ui8nda s BCL NONE NONE 0 boolMatrix.h boolNDArray.h +i16nda s i16nda BCL NONE NONE 0 boolMatrix.h boolNDArray.h +i16nda i16nda s BCL NONE NONE 0 boolMatrix.h boolNDArray.h +ui16nda s ui16nda BCL NONE NONE 0 boolMatrix.h boolNDArray.h +ui16nda ui16nda s BCL NONE NONE 0 boolMatrix.h boolNDArray.h +i32nda s i32nda BCL NONE NONE 0 boolMatrix.h boolNDArray.h +i32nda i32nda s BCL NONE NONE 0 boolMatrix.h boolNDArray.h +ui32nda s ui32nda BCL NONE NONE 0 boolMatrix.h boolNDArray.h +ui32nda ui32nda s BCL NONE NONE 0 boolMatrix.h boolNDArray.h
--- a/liboctave/oct-inttypes.h +++ b/liboctave/oct-inttypes.h @@ -28,6 +28,7 @@ #include <iostream> #include "data-conv.h" +#include "lo-ieee.h" typedef signed char octave_int8_t; typedef TWO_BYTE_INT octave_int16_t; @@ -246,7 +247,13 @@ octave_int<T> operator - (void) const { - return std::numeric_limits<T>::is_signed ? -ival : 0; + // Can't just return -ival because signed types are not + // symmetric, which causes things like -intmin("int32") to be the + // same as intmin("int32") instead of intmax("int32") (which is + // what we should get with saturation semantics). + + return std::numeric_limits<T>::is_signed ? + OCTAVE_INT_FIT_TO_RANGE (- static_cast<double> (ival), T) : 0; } operator double (void) const { return static_cast<double> (value ()); } @@ -279,7 +286,8 @@ { double t = static_cast<double> (value ()); double tx = static_cast<double> (x.value ()); - ival = OCTAVE_INT_FIT_TO_RANGE (t / tx, T); + double r = (t == 0 && tx == 0) ? 0 : round (t / tx); + ival = OCTAVE_INT_FIT_TO_RANGE (r, T); return *this; } @@ -310,13 +318,13 @@ }; template <class T> -T -pow (const T& a, const T& b) +octave_int<T> +pow (const octave_int<T>& a, const octave_int<T>& b) { - T retval; + octave_int<T> retval; - T zero = T (0); - T one = T (1); + octave_int<T> zero = octave_int<T> (0); + octave_int<T> one = octave_int<T> (1); if (b == zero) retval = one; @@ -324,8 +332,8 @@ retval = zero; else { - T a_val = a; - T b_val = b; + octave_int<T> a_val = a; + octave_int<T> b_val = b; retval = a; @@ -347,6 +355,26 @@ } template <class T> +octave_int<T> +pow (double a, const octave_int<T>& b) +{ + double tb = static_cast<double> (b.value ()); + double r = pow (a, tb); + r = lo_ieee_isnan (r) ? 0 : round (r); + return OCTAVE_INT_FIT_TO_RANGE (r, T); +} + +template <class T> +octave_int<T> +pow (const octave_int<T>& a, double b) +{ + double ta = static_cast<double> (a.value ()); + double r = pow (ta, b); + r = lo_ieee_isnan (r) ? 0 : round (r); + return OCTAVE_INT_FIT_TO_RANGE (r, T); +} + +template <class T> std::ostream& operator << (std::ostream& os, const octave_int<T>& ival) { @@ -389,7 +417,50 @@ OCTAVE_INT_BIN_OP(+) OCTAVE_INT_BIN_OP(-) OCTAVE_INT_BIN_OP(*) -OCTAVE_INT_BIN_OP(/) + +template <class T1, class T2> +octave_int<typename octave_int_binop_traits<T1, T2>::TR> +operator / (const octave_int<T1>& x, const octave_int<T2>& y) +{ + double tx = static_cast<double> (x.value ()); + double ty = static_cast<double> (y.value ()); + double r = (tx == 0 && ty == 0) ? 0 : tx / ty; + return OCTAVE_INT_FIT_TO_RANGE2 (r, T1, T2); +} + +#define OCTAVE_INT_DOUBLE_BIN_OP(OP) \ + \ + template <class T> \ + octave_int<T> \ + operator OP (const octave_int<T>& x, double y) \ + { \ + double tx = static_cast<double> (x.value ()); \ + double r = round (tx OP y); \ + r = lo_ieee_isnan (r) ? 0 : round (r); \ + return OCTAVE_INT_FIT_TO_RANGE (r, T); \ + } + +OCTAVE_INT_DOUBLE_BIN_OP(+) +OCTAVE_INT_DOUBLE_BIN_OP(-) +OCTAVE_INT_DOUBLE_BIN_OP(*) +OCTAVE_INT_DOUBLE_BIN_OP(/) + +#define OCTAVE_DOUBLE_INT_BIN_OP(OP) \ + \ + template <class T> \ + octave_int<T> \ + operator OP (double x, const octave_int<T>& y) \ + { \ + double ty = static_cast<double> (y.value ()); \ + double r = x OP ty; \ + r = lo_ieee_isnan (r) ? 0 : round (r); \ + return OCTAVE_INT_FIT_TO_RANGE (r, T); \ + } + +OCTAVE_DOUBLE_INT_BIN_OP(+) +OCTAVE_DOUBLE_INT_BIN_OP(-) +OCTAVE_DOUBLE_INT_BIN_OP(*) +OCTAVE_DOUBLE_INT_BIN_OP(/) #define OCTAVE_INT_BITCMP_OP(OP) \ \
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2004-09-01 John W. Eaton <jwe@octave.org> + + * OPERATORS/op-i8-i8.cc, OPERATORS/op-i16-i16.cc, + OPERATORS/op-i32-i32.cc, OPERATORS/op-i64-i64.cc, + OPERATORS/op-ui8-ui8.cc, OPERATORS/op-ui16-ui16.cc, + OPERATORS/op-ui32-ui32.cc, OPERATORS/op-ui64-ui64.cc: + Define and install mixed assignment ops. + * op-int.h: Define mixed integer/double ops. + Define simple division ops. + + * ov-complex.h (octave_complex_scalar): New typedef to simplify + various macros where naming consistency matters. + 2004-08-31 David Bateman <dbateman@free.fr> * OPERATORS/op-int.h (ss_pow, ms_el_pow, mm_el_pow): New power
--- a/src/OPERATORS/op-i16-i16.cc +++ b/src/OPERATORS/op-i16-i16.cc @@ -32,6 +32,17 @@ #include "oct-obj.h" #include "ov.h" #include "ov-int16.h" +#include "ov-int32.h" +#include "ov-int64.h" +#include "ov-int8.h" +#include "ov-uint16.h" +#include "ov-uint32.h" +#include "ov-uint64.h" +#include "ov-uint8.h" +#include "ov-scalar.h" +#include "ov-complex.h" +#include "ov-re-mat.h" +#include "ov-cx-mat.h" #include "ov-typeinfo.h" #include "ops.h" #include "xdiv.h" @@ -41,10 +52,42 @@ OCTAVE_INT_OPS (int16) +OCTAVE_MS_INT_ASSIGN_OPS (mi8, int16_, int8_, int8_) +OCTAVE_MS_INT_ASSIGN_OPS (mui8, int16_, uint8_, uint8_) +OCTAVE_MS_INT_ASSIGN_OPS (mui16, int16_, uint16_, uint16_) +OCTAVE_MS_INT_ASSIGN_OPS (mi32, int16_, int32_, int32_) +OCTAVE_MS_INT_ASSIGN_OPS (mui32, int16_, uint32_, uint32_) +OCTAVE_MS_INT_ASSIGN_OPS (mi64, int16_, int64_, int64_) +OCTAVE_MS_INT_ASSIGN_OPS (mui64, int16_, uint64_, uint64_) + +OCTAVE_MM_INT_ASSIGN_OPS (mmi8, int16_, int8_, int8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui8, int16_, uint8_, uint8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui16, int16_, uint16_, uint16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi32, int16_, int32_, int32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui32, int16_, uint32_, uint32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi64, int16_, int64_, int64_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui64, int16_, uint64_, uint64_) + void install_i16_i16_ops (void) { OCTAVE_INSTALL_INT_OPS (int16); + + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, int16_, int8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, int16_, uint8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, int16_, uint16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, int16_, int32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, int16_, uint32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, int16_, int64_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, int16_, uint64_); + + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, int16_, int8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, int16_, uint8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, int16_, uint16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, int16_, int32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, int16_, uint32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, int16_, int64_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, int16_, uint64_); } /*
--- a/src/OPERATORS/op-i32-i32.cc +++ b/src/OPERATORS/op-i32-i32.cc @@ -31,7 +31,18 @@ #include "gripes.h" #include "oct-obj.h" #include "ov.h" +#include "ov-int16.h" #include "ov-int32.h" +#include "ov-int64.h" +#include "ov-int8.h" +#include "ov-uint16.h" +#include "ov-uint32.h" +#include "ov-uint64.h" +#include "ov-uint8.h" +#include "ov-scalar.h" +#include "ov-complex.h" +#include "ov-re-mat.h" +#include "ov-cx-mat.h" #include "ov-typeinfo.h" #include "ops.h" #include "xdiv.h" @@ -41,10 +52,42 @@ OCTAVE_INT_OPS (int32) +OCTAVE_MS_INT_ASSIGN_OPS (mi8, int32_, int8_, int8_) +OCTAVE_MS_INT_ASSIGN_OPS (mui8, int32_, uint8_, uint8_) +OCTAVE_MS_INT_ASSIGN_OPS (mi16, int32_, int16_, int16_) +OCTAVE_MS_INT_ASSIGN_OPS (mui16, int32_, uint16_, uint16_) +OCTAVE_MS_INT_ASSIGN_OPS (mui32, int32_, uint32_, uint32_) +OCTAVE_MS_INT_ASSIGN_OPS (mi64, int32_, int64_, int64_) +OCTAVE_MS_INT_ASSIGN_OPS (mui64, int32_, uint64_, uint64_) + +OCTAVE_MM_INT_ASSIGN_OPS (mmi8, int32_, int8_, int8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui8, int32_, uint8_, uint8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi16, int32_, int16_, int16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui16, int32_, uint16_, uint16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui32, int32_, uint32_, uint32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi64, int32_, int64_, int64_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui64, int32_, uint64_, uint64_) + void install_i32_i32_ops (void) { OCTAVE_INSTALL_INT_OPS (int32); + + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, int32_, int8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, int32_, uint8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, int32_, int16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, int32_, uint16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, int32_, uint32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, int32_, int64_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, int32_, uint64_); + + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, int32_, int8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, int32_, uint8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, int32_, int16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, int32_, uint16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, int32_, uint32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, int32_, int64_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, int32_, uint64_); } /*
--- a/src/OPERATORS/op-i64-i64.cc +++ b/src/OPERATORS/op-i64-i64.cc @@ -31,7 +31,18 @@ #include "gripes.h" #include "oct-obj.h" #include "ov.h" +#include "ov-int16.h" +#include "ov-int32.h" #include "ov-int64.h" +#include "ov-int8.h" +#include "ov-uint16.h" +#include "ov-uint32.h" +#include "ov-uint64.h" +#include "ov-uint8.h" +#include "ov-scalar.h" +#include "ov-complex.h" +#include "ov-re-mat.h" +#include "ov-cx-mat.h" #include "ov-typeinfo.h" #include "ops.h" #include "xdiv.h" @@ -40,37 +51,79 @@ #include "op-int.h" OCTAVE_S_INT_UNOPS (int64) -OCTAVE_SS_INT_CMP_OPS (int64, int64) -OCTAVE_SS_INT_BOOL_OPS (int64, int64) +OCTAVE_SS_INT_CMP_OPS (ss, int64_, int64_) +OCTAVE_SS_INT_BOOL_OPS (ss, int64_, int64_) + +OCTAVE_SM_INT_CMP_OPS (sm, int64_, int64_) +OCTAVE_SM_INT_BOOL_OPS (sm, int64_, int64_) -OCTAVE_SM_INT_CMP_OPS (int64, int64) -OCTAVE_SM_INT_BOOL_OPS (int64, int64) - -OCTAVE_MS_INT_CMP_OPS (int64, int64) -OCTAVE_MS_INT_BOOL_OPS (int64, int64) +OCTAVE_MS_INT_CMP_OPS (ms, int64_, int64_) +OCTAVE_MS_INT_BOOL_OPS (ms, int64_, int64_) +OCTAVE_MS_INT_ASSIGN_OPS (ms, int64_, int64_, int64_) +OCTAVE_MS_INT_ASSIGN_OPS (mx, int64_, , ) +OCTAVE_MS_INT_ASSIGN_OPS (mc, int64_, complex_, ) 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) +OCTAVE_MM_INT_ASSIGN_OPS (mm, int64_, int64_, int64_) +OCTAVE_MM_INT_ASSIGN_OPS (mmx, int64_, , ) +OCTAVE_MM_INT_ASSIGN_OPS (mmc, int64_, complex_, ) + +OCTAVE_MS_INT_ASSIGN_OPS (mi8, int64_, int8_, int8_) +OCTAVE_MS_INT_ASSIGN_OPS (mui8, int64_, uint8_, uint8_) +OCTAVE_MS_INT_ASSIGN_OPS (mi16, int64_, int16_, int16_) +OCTAVE_MS_INT_ASSIGN_OPS (mui16, int64_, uint16_, uint16_) +OCTAVE_MS_INT_ASSIGN_OPS (mi32, int64_, int32_, int32_) +OCTAVE_MS_INT_ASSIGN_OPS (mui32, int64_, uint32_, uint32_) +OCTAVE_MS_INT_ASSIGN_OPS (mui64, int64_, uint64_, uint64_) + +OCTAVE_MM_INT_ASSIGN_OPS (mmi8, int64_, int8_, int8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui8, int64_, uint8_, uint8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi16, int64_, int16_, int16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui16, int64_, uint16_, uint16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi32, int64_, int32_, int32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui32, int64_, uint32_, uint32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui64, int64_, uint64_, uint64_) void install_i64_i64_ops (void) { OCTAVE_INSTALL_S_INT_UNOPS (int64); - OCTAVE_INSTALL_SS_INT_CMP_OPS (int64, int64); - OCTAVE_INSTALL_SS_INT_BOOL_OPS (int64, int64); + OCTAVE_INSTALL_SS_INT_CMP_OPS (ss, int64_, int64_); + OCTAVE_INSTALL_SS_INT_BOOL_OPS (ss, int64_, int64_); + + OCTAVE_INSTALL_SM_INT_CMP_OPS (sm, int64_, int64_); + OCTAVE_INSTALL_SM_INT_BOOL_OPS (sm, int64_, int64_); - OCTAVE_INSTALL_SM_INT_CMP_OPS (int64, int64); - OCTAVE_INSTALL_SM_INT_BOOL_OPS (int64, int64); - - OCTAVE_INSTALL_MS_INT_CMP_OPS (int64, int64); - OCTAVE_INSTALL_MS_INT_BOOL_OPS (int64, int64); + OCTAVE_INSTALL_MS_INT_CMP_OPS (ms, int64_, int64_); + OCTAVE_INSTALL_MS_INT_BOOL_OPS (ms, int64_, int64_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (ms, int64_, int64_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mx, int64_, ); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mc, int64_, complex_); 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); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mm, int64_, int64_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmx, int64_, ); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmc, int64_, complex_); + + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, int64_, int8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, int64_, uint8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, int64_, int16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, int64_, uint16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, int64_, int32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, int64_, uint32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, int64_, uint64_); + + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, int64_, int8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, int64_, uint8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, int64_, int16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, int64_, uint16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, int64_, int32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, int64_, uint32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, int64_, uint64_); } /*
--- a/src/OPERATORS/op-i8-i8.cc +++ b/src/OPERATORS/op-i8-i8.cc @@ -31,7 +31,18 @@ #include "gripes.h" #include "oct-obj.h" #include "ov.h" +#include "ov-int16.h" +#include "ov-int32.h" +#include "ov-int64.h" #include "ov-int8.h" +#include "ov-uint16.h" +#include "ov-uint32.h" +#include "ov-uint64.h" +#include "ov-uint8.h" +#include "ov-scalar.h" +#include "ov-complex.h" +#include "ov-re-mat.h" +#include "ov-cx-mat.h" #include "ov-typeinfo.h" #include "ops.h" #include "xdiv.h" @@ -41,10 +52,42 @@ OCTAVE_INT_OPS (int8) +OCTAVE_MS_INT_ASSIGN_OPS (mui8, int8_, uint8_, uint8_) +OCTAVE_MS_INT_ASSIGN_OPS (mi16, int8_, int16_, int16_) +OCTAVE_MS_INT_ASSIGN_OPS (mui16, int8_, uint16_, uint16_) +OCTAVE_MS_INT_ASSIGN_OPS (mi32, int8_, int32_, int32_) +OCTAVE_MS_INT_ASSIGN_OPS (mui32, int8_, uint32_, uint32_) +OCTAVE_MS_INT_ASSIGN_OPS (mi64, int8_, int64_, int64_) +OCTAVE_MS_INT_ASSIGN_OPS (mui64, int8_, uint64_, uint64_) + +OCTAVE_MM_INT_ASSIGN_OPS (mmui8, int8_, uint8_, uint8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi16, int8_, int16_, int16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui16, int8_, uint16_, uint16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi32, int8_, int32_, int32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui32, int8_, uint32_, uint32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi64, int8_, int64_, int64_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui64, int8_, uint64_, uint64_) + void install_i8_i8_ops (void) { OCTAVE_INSTALL_INT_OPS (int8); + + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, int8_, uint8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, int8_, int16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, int8_, uint16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, int8_, int32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, int8_, uint32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, int8_, int64_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, int8_, uint64_); + + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, int8_, uint8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, int8_, int16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, int8_, uint16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, int8_, int32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, int8_, uint32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, int8_, int64_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, int8_, uint64_); } /*
--- a/src/OPERATORS/op-int.h +++ b/src/OPERATORS/op-int.h @@ -45,170 +45,184 @@ /* DEFNCUNOP_METHOD (s_incr, TYPE ## _scalar, increment) */ \ /* DEFNCUNOP_METHOD (s_decr, TYPE ## _scalar, decrement) */ -#define OCTAVE_SS_INT_ARITH_OPS(T1, T2) \ +#define OCTAVE_SS_INT_ARITH_OPS(PFX, 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_OP (PFX ## _add, T1 ## scalar, T2 ## scalar, +) \ + DEFBINOP_OP (PFX ## _sub, T1 ## scalar, T2 ## scalar, -) \ + DEFBINOP_OP (PFX ## _mul, T1 ## scalar, T2 ## scalar, *) \ \ - DEFBINOP (ss_div, T1 ## _scalar, T2 ## _scalar) \ + DEFBINOP (PFX ## _div, T1 ## scalar, T2 ## scalar) \ { \ - CAST_BINOP_ARGS (const octave_ ## T1 ## _scalar&, const octave_ ## T2 ## _scalar&); \ + CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \ \ - double d = v2.T2 ## _scalar_value (); \ - \ - if (d == 0.0) \ + if (! v2.T2 ## scalar_value ()) \ gripe_divide_by_zero (); \ \ - return octave_value (v1.T1 ## _scalar_value () / d); \ + return octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \ } \ \ - DEFBINOP_FN (ss_pow, T1 ## _scalar, T2 ## _scalar, xpow) \ + DEFBINOP_FN (PFX ## _pow, T1 ## scalar, T2 ## scalar, xpow) \ \ - DEFBINOP (ss_ldiv, T1 ## _scalar, T2 ## _scalar) \ + DEFBINOP (PFX ## _ldiv, T1 ## scalar, T2 ## scalar) \ { \ - CAST_BINOP_ARGS (const octave_ ## T1 ## _scalar&, const octave_ ## T2 ## _scalar&); \ + CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \ \ - double d = v1.T1 ## _scalar_value (); \ - \ - if (d == 0.0) \ + if (! v1.T1 ## scalar_value ()) \ gripe_divide_by_zero (); \ \ - return octave_value (v2.T2 ## _scalar_value () / d); \ + return octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \ + } \ + \ + DEFBINOP_OP (PFX ## _el_mul, T1 ## scalar, T2 ## scalar, *) \ + \ + DEFBINOP (PFX ## _el_div, T1 ## scalar, T2 ## scalar) \ + { \ + CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \ + \ + if (! v2.T2 ## scalar_value ()) \ + gripe_divide_by_zero (); \ + \ + return octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \ } \ \ - DEFBINOP_OP (ss_el_mul, T1 ## _scalar, T2 ## _scalar, *) \ + DEFBINOP_FN (PFX ## _el_pow, T1 ## scalar, T2 ## scalar, xpow) \ \ - DEFBINOP (ss_el_div, T1 ## _scalar, T2 ## _scalar) \ + DEFBINOP (PFX ## _el_ldiv, T1 ## scalar, T2 ## scalar) \ { \ - CAST_BINOP_ARGS (const octave_ ## T1 ## _scalar&, const octave_ ## T2 ## _scalar&); \ + CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \ \ - double d = v2.T2 ## _scalar_value (); \ - \ - if (d == 0.0) \ + if (! v1.T1 ## scalar_value ()) \ gripe_divide_by_zero (); \ \ - return octave_value (v1.T1 ## _scalar_value () / d); \ + return octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \ + } \ + +#define OCTAVE_SS_INT_BOOL_OPS(PFX, T1, T2) \ + /* DEFBINOP_OP (PFX ## _el_and, T1 ## scalar, T2 ## scalar, &&) */ \ + /* DEFBINOP_OP (PFX ## _el_or, T1 ## scalar, T2 ## scalar, ||) */ + +#define OCTAVE_SS_INT_CMP_OPS(PFX, T1, T2) \ + DEFBINOP_OP (PFX ## _lt, T1 ## scalar, T2 ## scalar, <) \ + DEFBINOP_OP (PFX ## _le, T1 ## scalar, T2 ## scalar, <=) \ + DEFBINOP_OP (PFX ## _eq, T1 ## scalar, T2 ## scalar, ==) \ + DEFBINOP_OP (PFX ## _ge, T1 ## scalar, T2 ## scalar, >=) \ + DEFBINOP_OP (PFX ## _gt, T1 ## scalar, T2 ## scalar, >) \ + DEFBINOP_OP (PFX ## _ne, T1 ## scalar, T2 ## scalar, !=) + +#define OCTAVE_SS_POW_OPS(T1, T2) \ + octave_value \ + xpow (const octave_ ## T1& a, const octave_ ## T2& b) \ + { \ + return pow (a, b); \ } \ \ - DEFBINOP_FN (ss_el_pow, T1 ## _scalar, T2 ## _scalar, xpow) \ - \ - DEFBINOP (ss_el_ldiv, T1 ## _scalar, T2 ## _scalar) \ + octave_value \ + xpow (const octave_ ## T1& a, double b) \ { \ - 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); \ + return pow (a, b); \ } \ - -#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_POW_OPS(T1, T2) \ - octave_value xpow (octave_ ## T1 a, octave_ ## T2 b) {return pow (a, b);} + \ + octave_value \ + xpow (double a, const octave_ ## T1& b) \ + { \ + return pow (a, b); \ + } #define OCTAVE_SS_INT_OPS(TYPE) \ OCTAVE_S_INT_UNOPS (TYPE) \ OCTAVE_SS_POW_OPS (TYPE, TYPE) \ - OCTAVE_SS_INT_ARITH_OPS (TYPE, TYPE) \ - OCTAVE_SS_INT_CMP_OPS (TYPE, TYPE) \ - OCTAVE_SS_INT_BOOL_OPS (TYPE, TYPE) + OCTAVE_SS_INT_ARITH_OPS (ss, TYPE ## _, TYPE ## _) \ + OCTAVE_SS_INT_ARITH_OPS (sx, TYPE ## _, ) \ + OCTAVE_SS_INT_ARITH_OPS (xs, , TYPE ## _) \ + OCTAVE_SS_INT_CMP_OPS (ss, TYPE ## _, TYPE ## _) \ + OCTAVE_SS_INT_CMP_OPS (sx, TYPE ## _, ) \ + OCTAVE_SS_INT_CMP_OPS (xs, , TYPE ## _) \ + OCTAVE_SS_INT_BOOL_OPS (ss, TYPE ## _, TYPE ## _) \ + OCTAVE_SS_INT_BOOL_OPS (sx, TYPE ## _, ) \ + OCTAVE_SS_INT_BOOL_OPS (xs, , 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) + OCTAVE_SS_INT_ARITH_OPS (ss, T1, T2) \ + OCTAVE_SS_INT_CMP_OPS (ss, T1, T2) \ + OCTAVE_SS_INT_BOOL_OPS (ss, T1, T2) -#define OCTAVE_SM_INT_ARITH_OPS(TS, TM) \ +#define OCTAVE_SM_INT_ARITH_OPS(PFX, 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, *) \ + DEFNDBINOP_OP (PFX ## _add, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, +) \ + DEFNDBINOP_OP (PFX ## _sub, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, -) \ + DEFNDBINOP_OP (PFX ## _mul, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, *) \ \ - /* DEFBINOP (sm_div, TS ## _scalar, TM ## _matrix) */ \ + /* DEFBINOP (PFX ## _div, TS ## scalar, TM ## matrix) */ \ /* { */ \ - /* CAST_BINOP_ARGS (const octave_ ## TS ## _scalar&, const octave_ ## 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 (); */ \ + /* 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_FN (PFX ## _pow, TS ## scalar, TM ## matrix, xpow) */ \ + \ + DEFBINOP (PFX ## _ldiv, TS ## scalar, TM ## matrix) \ + { \ + CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); \ \ - /* 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); */ \ - /* } */ \ + if (! v1.TS ## scalar_value ()) \ + gripe_divide_by_zero (); \ \ - 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) \ + return octave_value (v2.TS ## scalar_value () / v1.TS ## scalar_value ()); \ + } \ + \ + DEFNDBINOP_OP (PFX ## _el_mul, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, *) \ + /* DEFNDBINOP_FN (PFX ## _el_div, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, x_el_div) */ \ + DEFNDBINOP_FN (PFX ## _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); */ \ - /* } */ \ + DEFBINOP (PFX ## _el_ldiv, TS ## scalar, TM ## matrix) \ + { \ + CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); \ + \ + if (! v1.TS ## scalar_value ()) \ + gripe_divide_by_zero (); \ + \ + return octave_value (v2.TM ## array_value () / v1.TS ## scalar_value ()); \ + } -#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_CMP_OPS(PFX, TS, TM) \ + DEFNDBINOP_FN (PFX ## _lt, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_lt) \ + DEFNDBINOP_FN (PFX ## _le, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_le) \ + DEFNDBINOP_FN (PFX ## _eq, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_eq) \ + DEFNDBINOP_FN (PFX ## _ge, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_ge) \ + DEFNDBINOP_FN (PFX ## _gt, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_gt) \ + DEFNDBINOP_FN (PFX ## _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_BOOL_OPS(PFX, TS, TM) \ + /* DEFNDBINOP_FN (PFX ## _el_and, TS ## scalar, TYPE ## matrix, TS ## scalar, TYPE ## array, mx_el_and) */ \ + /* DEFNDBINOP_FN (PFX ## _el_or, TS ## scalar, TYPE ## matrix, TS ## scalar, TYPE ## array, mx_el_or) */ #define OCTAVE_SM_POW_OPS(T1, T2) \ -octave_value elem_xpow (octave_ ## T1 a, T2 ## NDArray b) \ -{ \ - T2 ## NDArray result (b.dims ()); \ - for (int i = 0; i < b.length (); i++) \ - { \ - OCTAVE_QUIT; \ - result (i) = pow (a, b(i)); \ - } \ - return octave_value (result); \ -} + octave_value \ + elem_xpow (const octave_ ## T1& a, const T2 ## NDArray& b) \ + { \ + T2 ## NDArray result (b.dims ()); \ + for (int i = 0; i < b.length (); i++) \ + { \ + OCTAVE_QUIT; \ + result (i) = pow (a, b(i)); \ + } \ + return octave_value (result); \ + } #define OCTAVE_SM_INT_OPS(TYPE) \ OCTAVE_SM_POW_OPS (TYPE, TYPE) \ - OCTAVE_SM_INT_ARITH_OPS (TYPE, TYPE) \ - OCTAVE_SM_INT_CMP_OPS (TYPE, TYPE) \ - OCTAVE_SM_INT_BOOL_OPS (TYPE, TYPE) \ + OCTAVE_SM_INT_ARITH_OPS (sm, TYPE ## _, TYPE ## _) \ + OCTAVE_SM_INT_ARITH_OPS (xm, , TYPE ## _) \ + OCTAVE_SM_INT_CMP_OPS (sm, TYPE ## _, TYPE ## _) \ + OCTAVE_SM_INT_CMP_OPS (xm, , TYPE ## _) \ + OCTAVE_SM_INT_BOOL_OPS (sm, TYPE ## _, TYPE ## _) \ + OCTAVE_SM_INT_BOOL_OPS (xm, , TYPE ## _) \ \ /* DEFCONV (TYPE ## _matrix_conv, TYPE ## _scalar, TYPE ## _matrix) */ \ /* { */ \ @@ -218,79 +232,75 @@ /* } */ #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) + OCTAVE_SM_INT_ARITH_OPS (sm, TS, TM) \ + OCTAVE_SM_INT_CMP_OPS (sm, TS, TM) \ + OCTAVE_SM_INT_BOOL_OPS (sm, TS, TM) -#define OCTAVE_MS_INT_ARITH_OPS(TM, TS) \ +#define OCTAVE_MS_INT_ARITH_OPS(PFX, 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, *) \ + DEFNDBINOP_OP (PFX ## _add, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, +) \ + DEFNDBINOP_OP (PFX ## _sub, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, -) \ + DEFNDBINOP_OP (PFX ## _mul, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, *) \ + \ + DEFBINOP (PFX ## _div, TM ## matrix, TS ## scalar) \ + { \ + CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); \ \ - /* DEFBINOP (ms_div, TM ## _matrix, TS ## _scalar) */ \ + if (! v2.TS ## scalar_value ()) \ + gripe_divide_by_zero (); \ + \ + return octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \ + } \ + \ + /* DEFBINOP_FN (PFX ## _pow, TM ## matrix, TS ## scalar, xpow) */ \ + \ + /* DEFBINOP (PFX ## _ldiv, TM ## matrix, TS ## scalar) */ \ /* { */ \ - /* CAST_BINOP_ARGS (const octave_ ## TM ## _matrix&, const octave_ ## TS ## _scalar&); */ \ - /* */ \ - /* double d = v2.TM ## _ ## TS ## _scalar_value (); */ \ + /* CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); */ \ /* */ \ - /* 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 (); */ \ + /* 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, *) \ + DEFNDBINOP_OP (PFX ## _el_mul, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, *) \ + \ + DEFBINOP (PFX ## _el_div, TM ## matrix, TS ## scalar) \ + { \ + CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); \ \ - /* DEFBINOP (ms_el_div, TM ## _matrix, TS ## _scalar) */ \ + if (! v2.TS ## scalar_value ()) \ + gripe_divide_by_zero (); \ + \ + return octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \ + } \ + \ + DEFNDBINOP_FN (PFX ## _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&); */ \ - /* */ \ - /* double d = v2.TM ## _ ## TS ## _scalar_value (); */ \ - /* */ \ - /* if (d == 0.0) */ \ - /* gripe_divide_by_zero (); */ \ + /* CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); */ \ /* */ \ - /* 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 ()); */ \ + /* 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_CMP_OPS(PFX, TM, TS) \ + DEFNDBINOP_FN (PFX ## _lt, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_lt) \ + DEFNDBINOP_FN (PFX ## _le, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_le) \ + DEFNDBINOP_FN (PFX ## _eq, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_eq) \ + DEFNDBINOP_FN (PFX ## _ge, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_ge) \ + DEFNDBINOP_FN (PFX ## _gt, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_gt) \ + DEFNDBINOP_FN (PFX ## _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_BOOL_OPS(PFX, TM, TS) \ + /* DEFNDBINOP_FN (PFX ## _el_and, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_and) */ \ + /* DEFNDBINOP_FN (PFX ## _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_ASSIGN_OPS(PFX, TM, TS, TE) \ + DEFNDASSIGNOP_FN (PFX ## _assign, TM ## matrix, TS ## scalar, TE ## array, assign) #define OCTAVE_MS_POW_OPS(T1, T2) \ octave_value elem_xpow (T1 ## NDArray a, octave_ ## T2 b) \ @@ -306,10 +316,15 @@ #define OCTAVE_MS_INT_OPS(TYPE) \ OCTAVE_MS_POW_OPS (TYPE, 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) + OCTAVE_MS_INT_ARITH_OPS (ms, TYPE ## _, TYPE ## _) \ + OCTAVE_MS_INT_ARITH_OPS (mx, TYPE ## _, ) \ + OCTAVE_MS_INT_CMP_OPS (ms, TYPE ## _, TYPE ## _) \ + OCTAVE_MS_INT_CMP_OPS (mx, TYPE ## _, ) \ + OCTAVE_MS_INT_BOOL_OPS (ms, TYPE ## _, TYPE ## _) \ + OCTAVE_MS_INT_BOOL_OPS (mx, TYPE ## _, ) \ + OCTAVE_MS_INT_ASSIGN_OPS (ms, TYPE ## _, TYPE ## _, TYPE ## _) \ + OCTAVE_MS_INT_ASSIGN_OPS (mx, TYPE ## _, , ) \ + OCTAVE_MS_INT_ASSIGN_OPS (mc, TYPE ## _, complex_, ) #define OCTAVE_M_INT_UNOPS(TYPE) \ /* matrix unary ops. */ \ @@ -358,7 +373,7 @@ \ /* DEFBINOP (mm_el_ldiv, T1 ## _matrix, T2 ## _matrix) */ \ /* { */ \ - /* CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); */ \ + /* CAST_BINOP_ARGS (const octavematrix&, const octavematrix&); */ \ /* */ \ /* return octave_value (quotient (v2.array_value (), v1.array_value ())); */ \ /* } */ @@ -375,27 +390,28 @@ 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_ASSIGN_OPS(PFX, TLHS, TRHS, TE) \ + DEFNDASSIGNOP_FN (PFX ## _assign, TLHS ## matrix, TRHS ## matrix, TE ## array, assign) #define OCTAVE_MM_POW_OPS(T1, T2) \ -octave_value elem_xpow (T1 ## NDArray a, T2 ## NDArray b) \ -{ \ - dim_vector a_dims = a.dims (); \ - dim_vector b_dims = b.dims (); \ - if (a_dims != b_dims) \ - { \ - gripe_nonconformant ("operator .^", a_dims, b_dims); \ - return octave_value (); \ - } \ - T1 ## NDArray result (a_dims); \ - for (int i = 0; i < a.length (); i++) \ - { \ - OCTAVE_QUIT; \ - result (i) = pow (a(i), b(i)); \ - } \ - return octave_value (result); \ -} + octave_value \ + elem_xpow (const T1 ## NDArray& a, const T2 ## NDArray& b) \ + { \ + dim_vector a_dims = a.dims (); \ + dim_vector b_dims = b.dims (); \ + if (a_dims != b_dims) \ + { \ + gripe_nonconformant ("operator .^", a_dims, b_dims); \ + return octave_value (); \ + } \ + T1 ## NDArray result (a_dims); \ + for (int i = 0; i < a.length (); i++) \ + { \ + OCTAVE_QUIT; \ + result (i) = pow (a(i), b(i)); \ + } \ + return octave_value (result); \ + } #define OCTAVE_MM_INT_OPS(TYPE) \ OCTAVE_M_INT_UNOPS (TYPE) \ @@ -403,12 +419,14 @@ 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) + OCTAVE_MM_INT_ASSIGN_OPS (mm, TYPE ## _, TYPE ## _, TYPE ## _) \ + OCTAVE_MM_INT_ASSIGN_OPS (mmx, TYPE ## _, , ) \ + OCTAVE_MM_INT_ASSIGN_OPS (mmc, TYPE ## _, complex_, ) #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) + OCTAVE_MM_INT_ARITH_OPS (mm, T1, T2) \ + OCTAVE_MM_INT_CMP_OPS (mm, T1, T2) \ + OCTAVE_MM_INT_BOOL_OPS (mm, T1, T2) #define OCTAVE_INT_OPS(TYPE) \ OCTAVE_SS_INT_OPS (TYPE) \ @@ -426,118 +444,130 @@ /* 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_ARITH_OPS(PFX, T1, T2) \ + INSTALL_BINOP (op_add, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _add); \ + INSTALL_BINOP (op_sub, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _sub); \ + INSTALL_BINOP (op_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _mul); \ + INSTALL_BINOP (op_div, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _div); \ + INSTALL_BINOP (op_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _pow); \ + INSTALL_BINOP (op_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ldiv); \ + INSTALL_BINOP (op_el_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_mul); \ + INSTALL_BINOP (op_el_div, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_div); \ + INSTALL_BINOP (op_el_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_pow); \ + INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _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_CMP_OPS(PFX, T1, T2) \ + INSTALL_BINOP (op_lt, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _lt); \ + INSTALL_BINOP (op_le, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _le); \ + INSTALL_BINOP (op_eq, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _eq); \ + INSTALL_BINOP (op_ge, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ge); \ + INSTALL_BINOP (op_gt, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _gt); \ + INSTALL_BINOP (op_ne, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _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_BOOL_OPS(PFX, T1, T2) \ + /* INSTALL_BINOP (op_el_and, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_and); */ \ + /* INSTALL_BINOP (op_el_or, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _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) \ + OCTAVE_INSTALL_SS_INT_ARITH_OPS (ss, TYPE ## _, TYPE ## _) \ + OCTAVE_INSTALL_SS_INT_ARITH_OPS (sx, TYPE ## _, ) \ + OCTAVE_INSTALL_SS_INT_ARITH_OPS (xs, , TYPE ## _) \ + OCTAVE_INSTALL_SS_INT_CMP_OPS (ss, TYPE ## _, TYPE ## _) \ + OCTAVE_INSTALL_SS_INT_CMP_OPS (sx, TYPE ## _, ) \ + OCTAVE_INSTALL_SS_INT_CMP_OPS (xs, , TYPE ## _) \ + OCTAVE_INSTALL_SS_INT_BOOL_OPS (ss, TYPE ## _, TYPE ## _) \ + OCTAVE_INSTALL_SS_INT_BOOL_OPS (sx, TYPE ## _, ) \ + OCTAVE_INSTALL_SS_INT_BOOL_OPS (xs, , 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) + OCTAVE_INSTALL_SS_INT_ARITH_OPS (ss, T1, T2) \ + OCTAVE_INSTALL_SS_INT_CMP_OPS (ss, T1, T2) \ + OCTAVE_INSTALL_SS_INT_BOOL_OPS (ss, 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_ARITH_OPS(PFX, T1, T2) \ + INSTALL_BINOP (op_add, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _add); \ + INSTALL_BINOP (op_sub, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _sub); \ + INSTALL_BINOP (op_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _mul); \ + /* INSTALL_BINOP (op_div, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _div); */ \ + /* INSTALL_BINOP (op_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _pow); */ \ + INSTALL_BINOP (op_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ldiv); \ + INSTALL_BINOP (op_el_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_mul); \ + /* INSTALL_BINOP (op_el_div, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_div); */ \ + INSTALL_BINOP (op_el_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_pow); \ + INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _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_CMP_OPS(PFX, T1, T2) \ + INSTALL_BINOP (op_lt, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _lt); \ + INSTALL_BINOP (op_le, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _le); \ + INSTALL_BINOP (op_eq, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _eq); \ + INSTALL_BINOP (op_ge, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ge); \ + INSTALL_BINOP (op_gt, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _gt); \ + INSTALL_BINOP (op_ne, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _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_BOOL_OPS(PFX, T1, T2) \ + /* INSTALL_BINOP (op_el_and, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_and); */ \ + /* INSTALL_BINOP (op_el_or, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _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) \ + OCTAVE_INSTALL_SM_INT_ARITH_OPS (sm, TYPE ## _, TYPE ## _) \ + OCTAVE_INSTALL_SM_INT_ARITH_OPS (xm, , TYPE ## _) \ + OCTAVE_INSTALL_SM_INT_CMP_OPS (sm, TYPE ## _, TYPE ## _) \ + OCTAVE_INSTALL_SM_INT_CMP_OPS (xm, , TYPE ## _) \ + OCTAVE_INSTALL_SM_INT_BOOL_OPS (sm, TYPE ## _, TYPE ## _) \ + OCTAVE_INSTALL_SM_INT_BOOL_OPS (xm, , 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); */ + OCTAVE_INSTALL_SM_INT_ARITH_OPS (sm, T1, T2) \ + OCTAVE_INSTALL_SM_INT_CMP_OPS (sm, T1, T2) \ + OCTAVE_INSTALL_SM_INT_BOOL_OPS (sm, T1, T2) -#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); \ +#define OCTAVE_INSTALL_MS_INT_ARITH_OPS(PFX, T1, T2) \ + INSTALL_BINOP (op_add, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _add); \ + INSTALL_BINOP (op_sub, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _sub); \ + INSTALL_BINOP (op_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _mul); \ + INSTALL_BINOP (op_div, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _div); \ + /* INSTALL_BINOP (op_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _pow); */ \ + /* INSTALL_BINOP (op_ldiv, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ldiv); */ \ \ - 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); + INSTALL_BINOP (op_el_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_mul); \ + INSTALL_BINOP (op_el_div, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_div); \ + INSTALL_BINOP (op_el_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_pow); \ + /* INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_ldiv); */ -#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_CMP_OPS(PFX, T1, T2) \ + INSTALL_BINOP (op_lt, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _lt); \ + INSTALL_BINOP (op_le, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _le); \ + INSTALL_BINOP (op_eq, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _eq); \ + INSTALL_BINOP (op_ge, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ge); \ + INSTALL_BINOP (op_gt, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _gt); \ + INSTALL_BINOP (op_ne, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ne); + +#define OCTAVE_INSTALL_MS_INT_BOOL_OPS(PFX, T1, T2) \ + /* INSTALL_BINOP (op_el_and, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_and); */ \ + /* INSTALL_BINOP (op_el_or, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_or); */ + +#define OCTAVE_INSTALL_MS_INT_ASSIGN_OPS(PFX, TLHS, TRHS) \ + INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign) #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) + OCTAVE_INSTALL_MS_INT_ARITH_OPS (ms, TYPE ## _, TYPE ## _) \ + OCTAVE_INSTALL_MS_INT_ARITH_OPS (mx, TYPE ## _, ) \ + OCTAVE_INSTALL_MS_INT_CMP_OPS (ms, TYPE ## _, TYPE ## _) \ + OCTAVE_INSTALL_MS_INT_CMP_OPS (mx, TYPE ## _, ) \ + OCTAVE_INSTALL_MS_INT_BOOL_OPS (ms, TYPE ## _, TYPE ## _) \ + OCTAVE_INSTALL_MS_INT_BOOL_OPS (mx, TYPE ## _, ) \ + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (ms, TYPE ## _, TYPE ## _) \ + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mx, TYPE ## _, ) \ + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mc, TYPE ## _, complex_) #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) + OCTAVE_INSTALL_MS_INT_ARITH_OPS (ms, T1, T2) \ + OCTAVE_INSTALL_MS_INT_CMP_OPS (ms, T1, T2) \ + OCTAVE_INSTALL_MS_INT_BOOL_OPS (ms, T1, T2) #define OCTAVE_INSTALL_M_INT_UNOPS(TYPE) \ INSTALL_UNOP (op_not, octave_ ## TYPE ## _matrix, m_not); \ @@ -572,15 +602,17 @@ 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_ASSIGN_OPS(PFX, TLHS, TRHS) \ + INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _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) + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mm, TYPE ## _, TYPE ## _) \ + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmx, TYPE ## _, ) \ + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmc, TYPE ## _, complex_) #define OCTAVE_INSTALL_MM_INT_OPS2(T1, T2) \ OCTAVE_INSTALL_MM_INT_ARITH_OPS (T1, T2) \
--- a/src/OPERATORS/op-ui16-ui16.cc +++ b/src/OPERATORS/op-ui16-ui16.cc @@ -31,7 +31,18 @@ #include "gripes.h" #include "oct-obj.h" #include "ov.h" +#include "ov-int16.h" +#include "ov-int32.h" +#include "ov-int64.h" +#include "ov-int8.h" #include "ov-uint16.h" +#include "ov-uint32.h" +#include "ov-uint64.h" +#include "ov-uint8.h" +#include "ov-scalar.h" +#include "ov-complex.h" +#include "ov-re-mat.h" +#include "ov-cx-mat.h" #include "ov-typeinfo.h" #include "ops.h" #include "xdiv.h" @@ -41,10 +52,42 @@ OCTAVE_INT_OPS (uint16) +OCTAVE_MS_INT_ASSIGN_OPS (mi8, uint16_, int8_, int8_) +OCTAVE_MS_INT_ASSIGN_OPS (mui8, uint16_, uint8_, uint8_) +OCTAVE_MS_INT_ASSIGN_OPS (mi16, uint16_, int16_, int16_) +OCTAVE_MS_INT_ASSIGN_OPS (mi32, uint16_, int32_, int32_) +OCTAVE_MS_INT_ASSIGN_OPS (mui32, uint16_, uint32_, uint32_) +OCTAVE_MS_INT_ASSIGN_OPS (mi64, uint16_, int64_, int64_) +OCTAVE_MS_INT_ASSIGN_OPS (mui64, uint16_, uint64_, uint64_) + +OCTAVE_MM_INT_ASSIGN_OPS (mmi8, uint16_, int8_, int8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui8, uint16_, uint8_, uint8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi16, uint16_, int16_, int16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi32, uint16_, int32_, int32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui32, uint16_, uint32_, uint32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi64, uint16_, int64_, int64_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui64, uint16_, uint64_, uint64_) + void install_ui16_ui16_ops (void) { OCTAVE_INSTALL_INT_OPS (uint16); + + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, uint16_, int8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, uint16_, uint8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, uint16_, int16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, uint16_, int32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, uint16_, uint32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, uint16_, int64_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, uint16_, uint64_); + + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, uint16_, int8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, uint16_, uint8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, uint16_, int16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, uint16_, int32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, uint16_, uint32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, uint16_, int64_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, uint16_, uint64_); } /*
--- a/src/OPERATORS/op-ui32-ui32.cc +++ b/src/OPERATORS/op-ui32-ui32.cc @@ -31,7 +31,18 @@ #include "gripes.h" #include "oct-obj.h" #include "ov.h" +#include "ov-int16.h" +#include "ov-int32.h" +#include "ov-int64.h" +#include "ov-int8.h" +#include "ov-uint16.h" #include "ov-uint32.h" +#include "ov-uint64.h" +#include "ov-uint8.h" +#include "ov-scalar.h" +#include "ov-complex.h" +#include "ov-re-mat.h" +#include "ov-cx-mat.h" #include "ov-typeinfo.h" #include "ops.h" #include "xdiv.h" @@ -41,10 +52,42 @@ OCTAVE_INT_OPS (uint32) +OCTAVE_MS_INT_ASSIGN_OPS (mi8, uint32_, int8_, int8_) +OCTAVE_MS_INT_ASSIGN_OPS (mui8, uint32_, uint8_, uint8_) +OCTAVE_MS_INT_ASSIGN_OPS (mi16, uint32_, int16_, int16_) +OCTAVE_MS_INT_ASSIGN_OPS (mui16, uint32_, uint16_, uint16_) +OCTAVE_MS_INT_ASSIGN_OPS (mi32, uint32_, int32_, int32_) +OCTAVE_MS_INT_ASSIGN_OPS (mi64, uint32_, int64_, int64_) +OCTAVE_MS_INT_ASSIGN_OPS (mui64, uint32_, uint64_, uint64_) + +OCTAVE_MM_INT_ASSIGN_OPS (mmi8, uint32_, int8_, int8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui8, uint32_, uint8_, uint8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi16, uint32_, int16_, int16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui16, uint32_, uint16_, uint16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi32, uint32_, int32_, int32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi64, uint32_, int64_, int64_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui64, uint32_, uint64_, uint64_) + void install_ui32_ui32_ops (void) { OCTAVE_INSTALL_INT_OPS (uint32); + + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, uint32_, int8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, uint32_, uint8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, uint32_, int16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, uint32_, uint16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, uint32_, int32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, uint32_, int64_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, uint32_, uint64_); + + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, uint32_, int8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, uint32_, uint8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, uint32_, int16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, uint32_, uint16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, uint32_, int32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, uint32_, int64_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, uint32_, uint64_); } /*
--- a/src/OPERATORS/op-ui64-ui64.cc +++ b/src/OPERATORS/op-ui64-ui64.cc @@ -31,7 +31,18 @@ #include "gripes.h" #include "oct-obj.h" #include "ov.h" +#include "ov-int16.h" +#include "ov-int32.h" +#include "ov-int64.h" +#include "ov-int8.h" +#include "ov-uint16.h" +#include "ov-uint32.h" #include "ov-uint64.h" +#include "ov-uint8.h" +#include "ov-scalar.h" +#include "ov-complex.h" +#include "ov-re-mat.h" +#include "ov-cx-mat.h" #include "ov-typeinfo.h" #include "ops.h" #include "xdiv.h" @@ -40,37 +51,79 @@ #include "op-int.h" OCTAVE_S_INT_UNOPS (uint64) -OCTAVE_SS_INT_CMP_OPS (uint64, uint64) -OCTAVE_SS_INT_BOOL_OPS (uint64, uint64) +OCTAVE_SS_INT_CMP_OPS (ss, uint64_, uint64_) +OCTAVE_SS_INT_BOOL_OPS (ss, uint64_, uint64_) + +OCTAVE_SM_INT_CMP_OPS (sm, uint64_, uint64_) +OCTAVE_SM_INT_BOOL_OPS (sm, uint64_, uint64_) -OCTAVE_SM_INT_CMP_OPS (uint64, uint64) -OCTAVE_SM_INT_BOOL_OPS (uint64, uint64) - -OCTAVE_MS_INT_CMP_OPS (uint64, uint64) -OCTAVE_MS_INT_BOOL_OPS (uint64, uint64) +OCTAVE_MS_INT_CMP_OPS (ms, uint64_, uint64_) +OCTAVE_MS_INT_BOOL_OPS (ms, uint64_, uint64_) +OCTAVE_MS_INT_ASSIGN_OPS (ms, uint64_, uint64_, uint64_) +OCTAVE_MS_INT_ASSIGN_OPS (mx, uint64_, , ) +OCTAVE_MS_INT_ASSIGN_OPS (mc, uint64_, complex_, ) 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) +OCTAVE_MM_INT_ASSIGN_OPS (mm, uint64_, uint64_, uint64_) +OCTAVE_MM_INT_ASSIGN_OPS (mmx, uint64_, , ) +OCTAVE_MM_INT_ASSIGN_OPS (mmc, uint64_, complex_, ) + +OCTAVE_MS_INT_ASSIGN_OPS (mi8, uint64_, int8_, int8_) +OCTAVE_MS_INT_ASSIGN_OPS (mui8, uint64_, uint8_, uint8_) +OCTAVE_MS_INT_ASSIGN_OPS (mi16, uint64_, int16_, int16_) +OCTAVE_MS_INT_ASSIGN_OPS (mui16, uint64_, uint16_, uint16_) +OCTAVE_MS_INT_ASSIGN_OPS (mi32, uint64_, int32_, int32_) +OCTAVE_MS_INT_ASSIGN_OPS (mui32, uint64_, uint32_, uint32_) +OCTAVE_MS_INT_ASSIGN_OPS (mi64, uint64_, int64_, int64_) + +OCTAVE_MM_INT_ASSIGN_OPS (mmi8, uint64_, int8_, int8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui8, uint64_, uint8_, uint8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi16, uint64_, int16_, int16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui16, uint64_, uint16_, uint16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi32, uint64_, int32_, int32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui32, uint64_, uint32_, uint32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi64, uint64_, int64_, int64_) void install_ui64_ui64_ops (void) { OCTAVE_INSTALL_S_INT_UNOPS (uint64); - OCTAVE_INSTALL_SS_INT_CMP_OPS (uint64, uint64); - OCTAVE_INSTALL_SS_INT_BOOL_OPS (uint64, uint64); + OCTAVE_INSTALL_SS_INT_CMP_OPS (ss, uint64_, uint64_); + OCTAVE_INSTALL_SS_INT_BOOL_OPS (ss, uint64_, uint64_); + + OCTAVE_INSTALL_SM_INT_CMP_OPS (sm, uint64_, uint64_); + OCTAVE_INSTALL_SM_INT_BOOL_OPS (sm, uint64_, uint64_); - OCTAVE_INSTALL_SM_INT_CMP_OPS (uint64, uint64); - OCTAVE_INSTALL_SM_INT_BOOL_OPS (uint64, uint64); - - OCTAVE_INSTALL_MS_INT_CMP_OPS (uint64, uint64); - OCTAVE_INSTALL_MS_INT_BOOL_OPS (uint64, uint64); + OCTAVE_INSTALL_MS_INT_CMP_OPS (ms, uint64_, uint64_); + OCTAVE_INSTALL_MS_INT_BOOL_OPS (ms, uint64_, uint64_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (ms, uint64_, uint64_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mx, uint64_, ); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mc, uint64_, complex_); 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); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mm, uint64_, uint64_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmx, uint64_, ); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmc, uint64_, complex_); + + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, uint64_, int8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, uint64_, uint8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, uint64_, int16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, uint64_, uint16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, uint64_, int32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, uint64_, uint32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, uint64_, int64_); + + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, uint64_, int8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, uint64_, uint8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, uint64_, int16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, uint64_, uint16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, uint64_, int32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, uint64_, uint32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, uint64_, int64_); } /*
--- a/src/OPERATORS/op-ui8-ui8.cc +++ b/src/OPERATORS/op-ui8-ui8.cc @@ -31,7 +31,18 @@ #include "gripes.h" #include "oct-obj.h" #include "ov.h" +#include "ov-int16.h" +#include "ov-int32.h" +#include "ov-int64.h" +#include "ov-int8.h" +#include "ov-uint16.h" +#include "ov-uint32.h" +#include "ov-uint64.h" #include "ov-uint8.h" +#include "ov-scalar.h" +#include "ov-complex.h" +#include "ov-re-mat.h" +#include "ov-cx-mat.h" #include "ov-typeinfo.h" #include "ops.h" #include "xdiv.h" @@ -41,10 +52,42 @@ OCTAVE_INT_OPS (uint8) +OCTAVE_MS_INT_ASSIGN_OPS (mi8, uint8_, int8_, int8_) +OCTAVE_MS_INT_ASSIGN_OPS (mi16, uint8_, int16_, int16_) +OCTAVE_MS_INT_ASSIGN_OPS (mui16, uint8_, uint16_, uint16_) +OCTAVE_MS_INT_ASSIGN_OPS (mi32, uint8_, int32_, int32_) +OCTAVE_MS_INT_ASSIGN_OPS (mui32, uint8_, uint32_, uint32_) +OCTAVE_MS_INT_ASSIGN_OPS (mi64, uint8_, int64_, int64_) +OCTAVE_MS_INT_ASSIGN_OPS (mui64, uint8_, uint64_, uint64_) + +OCTAVE_MM_INT_ASSIGN_OPS (mmi8, uint8_, int8_, int8_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi16, uint8_, int16_, int16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui16, uint8_, uint16_, uint16_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi32, uint8_, int32_, int32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui32, uint8_, uint32_, uint32_) +OCTAVE_MM_INT_ASSIGN_OPS (mmi64, uint8_, int64_, int64_) +OCTAVE_MM_INT_ASSIGN_OPS (mmui64, uint8_, uint64_, uint64_) + void install_ui8_ui8_ops (void) { OCTAVE_INSTALL_INT_OPS (uint8) + + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, uint8_, int8_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, uint8_, int16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, uint8_, uint16_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, uint8_, int32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, uint8_, uint32_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, uint8_, int64_); + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, uint8_, uint64_); + + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, uint8_, int8_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, uint8_, int16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, uint8_, uint16_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, uint8_, int32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, uint8_, uint32_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, uint8_, int64_); + OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, uint8_, uint64_); } /*