00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "quit.h"
00024
00025 #define DEFINTBINOP_OP(name, t1, t2, op, t3) \
00026 BINOPDECL (name, a1, a2) \
00027 { \
00028 CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
00029 octave_value retval = octave_value \
00030 (v1.t1 ## _value () op v2.t2 ## _value ()); \
00031 if (octave_ ## t3 ::get_math_trunc_flag ()) \
00032 gripe_binop_integer_math_truncated (#op, v1.type_name (). c_str (), \
00033 v2.type_name (). c_str ()); \
00034 octave_ ## t3 ::clear_conv_flag (); \
00035 return retval; \
00036 }
00037
00038 #define DEFINTNDBINOP_OP(name, t1, t2, e1, e2, op, t3) \
00039 BINOPDECL (name, a1, a2) \
00040 { \
00041 CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
00042 octave_value retval = octave_value \
00043 (v1.e1 ## _value () op v2.e2 ## _value ()); \
00044 if (octave_ ## t3 ::get_math_trunc_flag ()) \
00045 gripe_binop_integer_math_truncated (#op, v1.type_name (). c_str (), \
00046 v2.type_name (). c_str ()); \
00047 octave_ ## t3 ::clear_conv_flag (); \
00048 return retval; \
00049 }
00050
00051 #define DEFINTBINOP_FN(name, t1, t2, f, t3, op) \
00052 BINOPDECL (name, a1, a2) \
00053 { \
00054 CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
00055 octave_value retval = octave_value (f (v1.t1 ## _value (), v2.t2 ## _value ())); \
00056 if (octave_ ## t3 ::get_math_trunc_flag ()) \
00057 gripe_binop_integer_math_truncated (#op, v1.type_name (). c_str (), \
00058 v2.type_name (). c_str ()); \
00059 octave_ ## t3 ::clear_conv_flag (); \
00060 return retval; \
00061 }
00062
00063 #define DEFINTNDBINOP_FN(name, t1, t2, e1, e2, f, t3, op) \
00064 BINOPDECL (name, a1, a2) \
00065 { \
00066 CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
00067 octave_value retval = octave_value (f (v1.e1 ## _value (), v2.e2 ## _value ())); \
00068 if (octave_ ## t3 ::get_math_trunc_flag ()) \
00069 gripe_binop_integer_math_truncated (#op, v1.type_name (). c_str (), \
00070 v2.type_name (). c_str ()); \
00071 octave_ ## t3 ::clear_conv_flag (); \
00072 return retval; \
00073 }
00074
00075 #define OCTAVE_CONCAT_FN2(T1, T2) \
00076 DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _s_s, T1 ## _scalar, T2 ## _scalar, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat) \
00077 DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _s_m, T1 ## _scalar, T2 ## _matrix, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat) \
00078 DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _m_s, T1 ## _matrix, T2 ## _scalar, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat) \
00079 DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _m_m, T1 ## _matrix, T2 ## _matrix, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat)
00080
00081 #define OCTAVE_INSTALL_CONCAT_FN2(T1, T2) \
00082 INSTALL_CATOP (octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, T1 ## _ ## T2 ## _s_s) \
00083 INSTALL_CATOP (octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, T1 ## _ ## T2 ## _s_m) \
00084 INSTALL_CATOP (octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, T1 ## _ ## T2 ## _m_s) \
00085 INSTALL_CATOP (octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, T1 ## _ ## T2 ## _m_m)
00086
00087 #define OCTAVE_DOUBLE_INT_CONCAT_FN(TYPE) \
00088 DEFNDCATOP_FN2 (double ## _ ## TYPE ## _s_s, scalar, TYPE ## _scalar, TYPE ## NDArray, , array, TYPE ## _array, concat) \
00089 DEFNDCATOP_FN2 (double ## _ ## TYPE ## _s_m, scalar, TYPE ## _matrix, TYPE ## NDArray, , array, TYPE ## _array, concat) \
00090 DEFNDCATOP_FN2 (double ## _ ## TYPE ## _m_s, matrix, TYPE ## _scalar, TYPE ## NDArray, , array, TYPE ## _array, concat) \
00091 DEFNDCATOP_FN2 (double ## _ ## TYPE ## _m_m, matrix, TYPE ## _matrix, TYPE ## NDArray, , array, TYPE ## _array, concat)
00092
00093 #define OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN(TYPE) \
00094 INSTALL_CATOP (octave_scalar, octave_ ## TYPE ## _scalar, double ## _ ## TYPE ## _s_s) \
00095 INSTALL_CATOP (octave_scalar, octave_ ## TYPE ## _matrix, double ## _ ## TYPE ## _s_m) \
00096 INSTALL_CATOP (octave_matrix, octave_ ## TYPE ## _scalar, double ## _ ## TYPE ## _m_s) \
00097 INSTALL_CATOP (octave_matrix, octave_ ## TYPE ## _matrix, double ## _ ## TYPE ## _m_m)
00098
00099 #define OCTAVE_INT_DOUBLE_CONCAT_FN(TYPE) \
00100 DEFNDCATOP_FN2 (TYPE ## _ ## double ## _s_s, TYPE ## _scalar, scalar, , TYPE ## NDArray, TYPE ## _array, array, concat) \
00101 DEFNDCATOP_FN2 (TYPE ## _ ## double ## _s_m, TYPE ## _scalar, matrix, , TYPE ## NDArray, TYPE ## _array, array, concat) \
00102 DEFNDCATOP_FN2 (TYPE ## _ ## double ## _m_s, TYPE ## _matrix, scalar, , TYPE ## NDArray, TYPE ## _array, array, concat) \
00103 DEFNDCATOP_FN2 (TYPE ## _ ## double ## _m_m, TYPE ## _matrix, matrix, , TYPE ## NDArray, TYPE ## _array, array, concat)
00104
00105 #define OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN(TYPE) \
00106 INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_scalar, TYPE ## _ ## double ## _s_s) \
00107 INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_matrix, TYPE ## _ ## double ## _s_m) \
00108 INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_scalar, TYPE ## _ ## double ## _m_s) \
00109 INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_matrix, TYPE ## _ ## double ## _m_m)
00110
00111 #define OCTAVE_FLOAT_INT_CONCAT_FN(TYPE) \
00112 DEFNDCATOP_FN2 (float ## _ ## TYPE ## _s_s, float_scalar, TYPE ## _scalar, TYPE ## NDArray, , float_array, TYPE ## _array, concat) \
00113 DEFNDCATOP_FN2 (float ## _ ## TYPE ## _s_m, float_scalar, TYPE ## _matrix, TYPE ## NDArray, , float_array, TYPE ## _array, concat) \
00114 DEFNDCATOP_FN2 (float ## _ ## TYPE ## _m_s, float_matrix, TYPE ## _scalar, TYPE ## NDArray, , float_array, TYPE ## _array, concat) \
00115 DEFNDCATOP_FN2 (float ## _ ## TYPE ## _m_m, float_matrix, TYPE ## _matrix, TYPE ## NDArray, , float_array, TYPE ## _array, concat)
00116
00117 #define OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN(TYPE) \
00118 INSTALL_CATOP (octave_float_scalar, octave_ ## TYPE ## _scalar, float ## _ ## TYPE ## _s_s) \
00119 INSTALL_CATOP (octave_float_scalar, octave_ ## TYPE ## _matrix, float ## _ ## TYPE ## _s_m) \
00120 INSTALL_CATOP (octave_float_matrix, octave_ ## TYPE ## _scalar, float ## _ ## TYPE ## _m_s) \
00121 INSTALL_CATOP (octave_float_matrix, octave_ ## TYPE ## _matrix, float ## _ ## TYPE ## _m_m)
00122
00123 #define OCTAVE_INT_FLOAT_CONCAT_FN(TYPE) \
00124 DEFNDCATOP_FN2 (TYPE ## _ ## float ## _s_s, TYPE ## _scalar, float_scalar, , TYPE ## NDArray, TYPE ## _array, float_array, concat) \
00125 DEFNDCATOP_FN2 (TYPE ## _ ## float ## _s_m, TYPE ## _scalar, float_matrix, , TYPE ## NDArray, TYPE ## _array, float_array, concat) \
00126 DEFNDCATOP_FN2 (TYPE ## _ ## float ## _m_s, TYPE ## _matrix, float_scalar, , TYPE ## NDArray, TYPE ## _array, float_array, concat) \
00127 DEFNDCATOP_FN2 (TYPE ## _ ## float ## _m_m, TYPE ## _matrix, float_matrix, , TYPE ## NDArray, TYPE ## _array, float_array, concat)
00128
00129 #define OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN(TYPE) \
00130 INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_float_scalar, TYPE ## _ ## float ## _s_s) \
00131 INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_float_matrix, TYPE ## _ ## float ## _s_m) \
00132 INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_float_scalar, TYPE ## _ ## float ## _m_s) \
00133 INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_float_matrix, TYPE ## _ ## float ## _m_m)
00134
00135
00136
00137
00138 #define OCTAVE_CHAR_INT_CONCAT_FN(TYPE) \
00139 DEFNDCHARCATOP_FN (char ## _ ## TYPE ## _m_s, char_matrix, TYPE ## _scalar, concat) \
00140 DEFNDCHARCATOP_FN (char ## _ ## TYPE ## _m_m, char_matrix, TYPE ## _matrix, concat)
00141
00142 #define OCTAVE_INSTALL_CHAR_INT_CONCAT_FN(TYPE) \
00143 INSTALL_CATOP (octave_char_matrix_str, octave_ ## TYPE ## _scalar, char ## _ ## TYPE ## _m_s) \
00144 INSTALL_CATOP (octave_char_matrix_str, octave_ ## TYPE ## _matrix, char ## _ ## TYPE ## _m_m) \
00145 INSTALL_CATOP (octave_char_matrix_sq_str, octave_ ## TYPE ## _scalar, char ## _ ## TYPE ## _m_s) \
00146 INSTALL_CATOP (octave_char_matrix_sq_str, octave_ ## TYPE ## _matrix, char ## _ ## TYPE ## _m_m)
00147
00148 #define OCTAVE_INT_CHAR_CONCAT_FN(TYPE) \
00149 DEFNDCHARCATOP_FN (TYPE ## _ ## char ## _s_m, TYPE ## _scalar, char_matrix, concat) \
00150 DEFNDCHARCATOP_FN (TYPE ## _ ## char ## _m_m, TYPE ## _matrix, char_matrix, concat)
00151
00152 #define OCTAVE_INSTALL_INT_CHAR_CONCAT_FN(TYPE) \
00153 INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_char_matrix_str, TYPE ## _ ## char ## _s_m) \
00154 INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_char_matrix_str, TYPE ## _ ## char ## _m_m) \
00155 INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_char_matrix_sq_str, TYPE ## _ ## char ## _s_m) \
00156 INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_char_matrix_sq_str, TYPE ## _ ## char ## _m_m)
00157
00158 #define OCTAVE_CONCAT_FN(TYPE) \
00159 DEFNDCATOP_FN (TYPE ## _s_s, TYPE ## _scalar, TYPE ## _scalar, TYPE ## _array, TYPE ## _array, concat) \
00160 DEFNDCATOP_FN (TYPE ## _s_m, TYPE ## _scalar, TYPE ## _matrix, TYPE ## _array, TYPE ## _array, concat) \
00161 DEFNDCATOP_FN (TYPE ## _m_s, TYPE ## _matrix, TYPE ## _scalar, TYPE ## _array, TYPE ## _array, concat) \
00162 DEFNDCATOP_FN (TYPE ## _m_m, TYPE ## _matrix, TYPE ## _matrix, TYPE ## _array, TYPE ## _array, concat)
00163
00164 #define OCTAVE_INSTALL_CONCAT_FN(TYPE) \
00165 INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _scalar, TYPE ## _s_s) \
00166 INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, TYPE ## _s_m) \
00167 INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _scalar, TYPE ## _m_s) \
00168 INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _matrix, TYPE ## _m_m)
00169
00170 #define OCTAVE_S_INT_UNOPS(TYPE) \
00171 \
00172 \
00173 DEFUNOP_OP (s_not, TYPE ## _scalar, !) \
00174 DEFUNOP_OP (s_uplus, TYPE ## _scalar, ) \
00175 DEFUNOP (s_uminus, TYPE ## _scalar) \
00176 { \
00177 CAST_UNOP_ARG (const octave_ ## TYPE ## _scalar &); \
00178 octave_value retval = octave_value (- v. TYPE ## _scalar_value ()); \
00179 if (octave_ ## TYPE ::get_math_trunc_flag ()) \
00180 gripe_unop_integer_math_truncated ("-", v.type_name (). c_str ()); \
00181 octave_ ## TYPE ::clear_conv_flag (); \
00182 return retval; \
00183 } \
00184 DEFUNOP_OP (s_transpose, TYPE ## _scalar, ) \
00185 DEFUNOP_OP (s_hermitian, TYPE ## _scalar, ) \
00186 \
00187 DEFNCUNOP_METHOD (s_incr, TYPE ## _scalar, increment) \
00188 DEFNCUNOP_METHOD (s_decr, TYPE ## _scalar, decrement)
00189
00190 #define OCTAVE_SS_INT_ARITH_OPS(PFX, T1, T2, T3) \
00191 \
00192 \
00193 DEFINTBINOP_OP (PFX ## _add, T1 ## scalar, T2 ## scalar, +, T3) \
00194 DEFINTBINOP_OP (PFX ## _sub, T1 ## scalar, T2 ## scalar, -, T3) \
00195 DEFINTBINOP_OP (PFX ## _mul, T1 ## scalar, T2 ## scalar, *, T3) \
00196 \
00197 DEFBINOP (PFX ## _div, T1 ## scalar, T2 ## scalar) \
00198 { \
00199 CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
00200 \
00201 if (! v2.T2 ## scalar_value ()) \
00202 gripe_divide_by_zero (); \
00203 \
00204 octave_value retval = octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \
00205 if (octave_ ## T3 ::get_math_trunc_flag ()) \
00206 gripe_binop_integer_math_truncated ("/", v1.type_name (). c_str (), \
00207 v2.type_name (). c_str ()); \
00208 octave_ ## T3 ::clear_conv_flag (); \
00209 return retval; \
00210 } \
00211 \
00212 DEFINTBINOP_FN (PFX ## _pow, T1 ## scalar, T2 ## scalar, xpow, T3, ^) \
00213 \
00214 DEFBINOP (PFX ## _ldiv, T1 ## scalar, T2 ## scalar) \
00215 { \
00216 CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
00217 \
00218 if (! v1.T1 ## scalar_value ()) \
00219 gripe_divide_by_zero (); \
00220 \
00221 octave_value retval = octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \
00222 if (octave_ ## T3 ::get_math_trunc_flag ()) \
00223 gripe_binop_integer_math_truncated ("\\", v1.type_name (). c_str (), \
00224 v2.type_name (). c_str ()); \
00225 octave_ ## T3 ::clear_conv_flag (); \
00226 return retval; \
00227 } \
00228 \
00229 DEFINTBINOP_OP (PFX ## _el_mul, T1 ## scalar, T2 ## scalar, *, T3) \
00230 \
00231 DEFBINOP (PFX ## _el_div, T1 ## scalar, T2 ## scalar) \
00232 { \
00233 CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
00234 \
00235 if (! v2.T2 ## scalar_value ()) \
00236 gripe_divide_by_zero (); \
00237 \
00238 octave_value retval = octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \
00239 if (octave_ ## T3 ::get_math_trunc_flag ()) \
00240 gripe_binop_integer_math_truncated (".\\", v1.type_name (). c_str (), \
00241 v2.type_name (). c_str ()); \
00242 octave_ ## T3 ::clear_conv_flag (); \
00243 return retval; \
00244 } \
00245 \
00246 DEFINTBINOP_FN (PFX ## _el_pow, T1 ## scalar, T2 ## scalar, xpow, T3, .^) \
00247 \
00248 DEFBINOP (PFX ## _el_ldiv, T1 ## scalar, T2 ## scalar) \
00249 { \
00250 CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
00251 \
00252 if (! v1.T1 ## scalar_value ()) \
00253 gripe_divide_by_zero (); \
00254 \
00255 octave_value retval = octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \
00256 if (octave_ ## T3 ::get_math_trunc_flag ()) \
00257 gripe_binop_integer_math_truncated (".\\", v1.type_name (). c_str (), \
00258 v2.type_name (). c_str ()); \
00259 octave_ ## T3 ::clear_conv_flag (); \
00260 return retval; \
00261 } \
00262
00263 #define OCTAVE_SS_INT_BOOL_OPS(PFX, T1, T2, Z1, Z2) \
00264 DEFBINOP (PFX ## _el_and, T2, T2) \
00265 { \
00266 CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
00267 \
00268 return v1.T1 ## scalar_value () != Z1 && v2.T2 ## scalar_value () != Z2; \
00269 } \
00270 \
00271 DEFBINOP (PFX ## _el_or, T1, T2) \
00272 { \
00273 CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
00274 \
00275 return v1.T1 ## scalar_value () != Z1 || v2.T2 ## scalar_value () != Z2; \
00276 }
00277
00278 #define OCTAVE_SS_INT_CMP_OPS(PFX, T1, T2) \
00279 DEFBINOP_OP (PFX ## _lt, T1 ## scalar, T2 ## scalar, <) \
00280 DEFBINOP_OP (PFX ## _le, T1 ## scalar, T2 ## scalar, <=) \
00281 DEFBINOP_OP (PFX ## _eq, T1 ## scalar, T2 ## scalar, ==) \
00282 DEFBINOP_OP (PFX ## _ge, T1 ## scalar, T2 ## scalar, >=) \
00283 DEFBINOP_OP (PFX ## _gt, T1 ## scalar, T2 ## scalar, >) \
00284 DEFBINOP_OP (PFX ## _ne, T1 ## scalar, T2 ## scalar, !=)
00285
00286 #define OCTAVE_SS_POW_OPS(T1, T2) \
00287 octave_value \
00288 xpow (const octave_ ## T1& a, const octave_ ## T2& b) \
00289 { \
00290 return pow (a, b); \
00291 } \
00292 \
00293 octave_value \
00294 xpow (const octave_ ## T1& a, double b) \
00295 { \
00296 return pow (a, b); \
00297 } \
00298 \
00299 octave_value \
00300 xpow (double a, const octave_ ## T1& b) \
00301 { \
00302 return pow (a, b); \
00303 } \
00304 \
00305 octave_value \
00306 xpow (const octave_ ## T1& a, float b) \
00307 { \
00308 return powf (a, b); \
00309 } \
00310 \
00311 octave_value \
00312 xpow (float a, const octave_ ## T1& b) \
00313 { \
00314 return powf (a, b); \
00315 }
00316
00317 #define OCTAVE_SS_INT_OPS(TYPE) \
00318 OCTAVE_S_INT_UNOPS (TYPE) \
00319 OCTAVE_SS_POW_OPS (TYPE, TYPE) \
00320 OCTAVE_SS_INT_ARITH_OPS (ss, TYPE ## _, TYPE ## _, TYPE) \
00321 OCTAVE_SS_INT_ARITH_OPS (ssx, TYPE ## _, , TYPE) \
00322 OCTAVE_SS_INT_ARITH_OPS (sxs, , TYPE ## _, TYPE) \
00323 OCTAVE_SS_INT_ARITH_OPS (ssfx, TYPE ## _, float_, TYPE) \
00324 OCTAVE_SS_INT_ARITH_OPS (sfxs, float_, TYPE ## _, TYPE) \
00325 OCTAVE_SS_INT_CMP_OPS (ss, TYPE ## _, TYPE ## _) \
00326 OCTAVE_SS_INT_CMP_OPS (sx, TYPE ## _, ) \
00327 OCTAVE_SS_INT_CMP_OPS (xs, , TYPE ## _) \
00328 OCTAVE_SS_INT_CMP_OPS (sfx, TYPE ## _, float_) \
00329 OCTAVE_SS_INT_CMP_OPS (fxs, float_, TYPE ## _) \
00330 OCTAVE_SS_INT_BOOL_OPS (ss, TYPE ## _, TYPE ## _, octave_ ## TYPE (0), octave_ ## TYPE (0)) \
00331 OCTAVE_SS_INT_BOOL_OPS (sx, TYPE ## _, , octave_ ## TYPE (0), 0) \
00332 OCTAVE_SS_INT_BOOL_OPS (xs, , TYPE ## _, 0, octave_ ## TYPE (0)) \
00333 OCTAVE_SS_INT_BOOL_OPS (sfx, TYPE ## _, float_, octave_ ## TYPE (0), 0) \
00334 OCTAVE_SS_INT_BOOL_OPS (fxs, float_, TYPE ## _, 0, octave_ ## TYPE (0))
00335
00336 #define OCTAVE_SM_INT_ARITH_OPS(PFX, TS, TM, TI) \
00337 \
00338 \
00339 DEFINTNDBINOP_OP (PFX ## _add, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, +, TI) \
00340 DEFINTNDBINOP_OP (PFX ## _sub, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, -, TI) \
00341 DEFINTNDBINOP_OP (PFX ## _mul, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, *, TI) \
00342 \
00343 \
00344 \
00345 \
00346 \
00347 \
00348 \
00349 \
00350 \
00351 \
00352 \
00353 \
00354 \
00355 DEFBINOP (PFX ## _ldiv, TS ## scalar, TM ## matrix) \
00356 { \
00357 CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); \
00358 \
00359 if (! v1.TS ## scalar_value ()) \
00360 gripe_divide_by_zero (); \
00361 \
00362 octave_value retval = octave_value (v2.TS ## scalar_value () / v1.TS ## scalar_value ()); \
00363 if (octave_ ## TI ::get_math_trunc_flag ()) \
00364 gripe_binop_integer_math_truncated ("\\", v1.type_name (). c_str (), \
00365 v2.type_name (). c_str ()); \
00366 octave_ ## TI ::clear_conv_flag (); \
00367 return retval; \
00368 } \
00369 \
00370 DEFINTNDBINOP_OP (PFX ## _el_mul, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, *, TI) \
00371 DEFBINOP (PFX ## _el_div, TS ## scalar, TM ## matrix) \
00372 { \
00373 CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); \
00374 \
00375 octave_value retval = octave_value (v1.TS ## scalar_value () / v2.TM ## array_value ()); \
00376 if (octave_ ## TI ::get_math_trunc_flag ()) \
00377 gripe_binop_integer_math_truncated (".\\", v1.type_name (). c_str (), \
00378 v2.type_name (). c_str ()); \
00379 octave_ ## TI ::clear_conv_flag (); \
00380 return retval; \
00381 } \
00382 \
00383 DEFINTNDBINOP_FN (PFX ## _el_pow, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, elem_xpow, TI, .^) \
00384 \
00385 DEFBINOP (PFX ## _el_ldiv, TS ## scalar, TM ## matrix) \
00386 { \
00387 CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); \
00388 \
00389 if (! v1.TS ## scalar_value ()) \
00390 gripe_divide_by_zero (); \
00391 \
00392 octave_value retval = octave_value (v2.TM ## array_value () / v1.TS ## scalar_value ()); \
00393 if (octave_ ## TI ::get_math_trunc_flag ()) \
00394 gripe_binop_integer_math_truncated (".\\", v1.type_name (). c_str (), \
00395 v2.type_name (). c_str ()); \
00396 octave_ ## TI ::clear_conv_flag (); \
00397 return retval; \
00398 }
00399
00400 #define OCTAVE_SM_INT_CMP_OPS(PFX, TS, TM) \
00401 DEFNDBINOP_FN (PFX ## _lt, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_lt) \
00402 DEFNDBINOP_FN (PFX ## _le, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_le) \
00403 DEFNDBINOP_FN (PFX ## _eq, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_eq) \
00404 DEFNDBINOP_FN (PFX ## _ge, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_ge) \
00405 DEFNDBINOP_FN (PFX ## _gt, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_gt) \
00406 DEFNDBINOP_FN (PFX ## _ne, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_ne)
00407
00408 #define OCTAVE_SM_INT_BOOL_OPS(PFX, TS, TM) \
00409 DEFNDBINOP_FN (PFX ## _el_and, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_and) \
00410 DEFNDBINOP_FN (PFX ## _el_or, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_or) \
00411 DEFNDBINOP_FN (PFX ## _el_and_not, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_and_not) \
00412 DEFNDBINOP_FN (PFX ## _el_or_not, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_or_not)
00413
00414 #define OCTAVE_SM_POW_OPS(T1, T2) \
00415 octave_value \
00416 elem_xpow (const octave_ ## T1& a, const T2 ## NDArray& b) \
00417 { \
00418 T2 ## NDArray result (b.dims ()); \
00419 for (int i = 0; i < b.length (); i++) \
00420 { \
00421 OCTAVE_QUIT; \
00422 result (i) = pow (a, b(i)); \
00423 } \
00424 return octave_value (result); \
00425 } \
00426 \
00427 octave_value \
00428 elem_xpow (const octave_ ## T1& a, const NDArray& b) \
00429 { \
00430 T1 ## NDArray result (b.dims ()); \
00431 for (int i = 0; i < b.length (); i++) \
00432 { \
00433 OCTAVE_QUIT; \
00434 result (i) = pow (a, b(i)); \
00435 } \
00436 return octave_value (result); \
00437 } \
00438 \
00439 octave_value \
00440 elem_xpow (double a, const T2 ## NDArray& b) \
00441 { \
00442 T2 ## NDArray result (b.dims ()); \
00443 for (int i = 0; i < b.length (); i++) \
00444 { \
00445 OCTAVE_QUIT; \
00446 result (i) = pow (a, b(i)); \
00447 } \
00448 return octave_value (result); \
00449 } \
00450 \
00451 octave_value \
00452 elem_xpow (const octave_ ## T1& a, const FloatNDArray& b) \
00453 { \
00454 T1 ## NDArray result (b.dims ()); \
00455 for (int i = 0; i < b.length (); i++) \
00456 { \
00457 OCTAVE_QUIT; \
00458 result (i) = powf (a, b(i)); \
00459 } \
00460 return octave_value (result); \
00461 } \
00462 \
00463 octave_value \
00464 elem_xpow (float a, const T2 ## NDArray& b) \
00465 { \
00466 T2 ## NDArray result (b.dims ()); \
00467 for (int i = 0; i < b.length (); i++) \
00468 { \
00469 OCTAVE_QUIT; \
00470 result (i) = powf (a, b(i)); \
00471 } \
00472 return octave_value (result); \
00473 }
00474
00475
00476 #define OCTAVE_SM_CONV(TS, TM) \
00477 DEFCONV (TS ## s_ ## TM ## m_conv, TM ## scalar, TM ## matrix) \
00478 { \
00479 CAST_CONV_ARG (const octave_ ## TS ## scalar&); \
00480 \
00481 return new octave_ ## TM ## matrix (v.TM ## array_value ()); \
00482 }
00483
00484 #define OCTAVE_SM_INT_OPS(TYPE) \
00485 OCTAVE_SM_POW_OPS (TYPE, TYPE) \
00486 OCTAVE_SM_INT_ARITH_OPS (sm, TYPE ## _, TYPE ## _, TYPE) \
00487 OCTAVE_SM_INT_ARITH_OPS (smx, TYPE ## _, , TYPE) \
00488 OCTAVE_SM_INT_ARITH_OPS (sxm, , TYPE ## _, TYPE) \
00489 OCTAVE_SM_INT_ARITH_OPS (smfx, TYPE ## _, float_, TYPE) \
00490 OCTAVE_SM_INT_ARITH_OPS (sfxm, float_, TYPE ## _, TYPE) \
00491 OCTAVE_SM_INT_CMP_OPS (sm, TYPE ## _, TYPE ## _) \
00492 OCTAVE_SM_INT_CMP_OPS (xm, , TYPE ## _) \
00493 OCTAVE_SM_INT_CMP_OPS (smx, TYPE ## _, ) \
00494 OCTAVE_SM_INT_CMP_OPS (fxm, float_, TYPE ## _) \
00495 OCTAVE_SM_INT_CMP_OPS (smfx, TYPE ## _, float_) \
00496 OCTAVE_SM_INT_BOOL_OPS (sm, TYPE ## _, TYPE ## _) \
00497 OCTAVE_SM_INT_BOOL_OPS (xm, , TYPE ## _) \
00498 OCTAVE_SM_INT_BOOL_OPS (smx, TYPE ## _, ) \
00499 OCTAVE_SM_INT_BOOL_OPS (fxm, float_, TYPE ## _) \
00500 OCTAVE_SM_INT_BOOL_OPS (smfx, TYPE ## _, float_) \
00501 OCTAVE_SM_CONV (TYPE ## _, TYPE ## _) \
00502 OCTAVE_SM_CONV (TYPE ## _, complex_) \
00503 OCTAVE_SM_CONV (TYPE ## _, float_complex_)
00504
00505 #define OCTAVE_MS_INT_ARITH_OPS(PFX, TM, TS, TI) \
00506 \
00507 \
00508 DEFINTNDBINOP_OP (PFX ## _add, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, +, TI) \
00509 DEFINTNDBINOP_OP (PFX ## _sub, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, -, TI) \
00510 DEFINTNDBINOP_OP (PFX ## _mul, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, *, TI) \
00511 \
00512 DEFBINOP (PFX ## _div, TM ## matrix, TS ## scalar) \
00513 { \
00514 CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); \
00515 \
00516 if (! v2.TS ## scalar_value ()) \
00517 gripe_divide_by_zero (); \
00518 \
00519 octave_value retval = octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \
00520 if (octave_ ## TI ::get_math_trunc_flag ()) \
00521 gripe_binop_integer_math_truncated ("/", v1.type_name (). c_str (), \
00522 v2.type_name (). c_str ()); \
00523 octave_ ## TI ::clear_conv_flag (); \
00524 return retval; \
00525 } \
00526 \
00527 \
00528 \
00529 \
00530 \
00531 \
00532 \
00533 \
00534 \
00535 \
00536 \
00537 \
00538 \
00539 DEFINTNDBINOP_OP (PFX ## _el_mul, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, *, TI) \
00540 \
00541 DEFBINOP (PFX ## _el_div, TM ## matrix, TS ## scalar) \
00542 { \
00543 CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); \
00544 \
00545 if (! v2.TS ## scalar_value ()) \
00546 gripe_divide_by_zero (); \
00547 \
00548 octave_value retval = octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \
00549 if (octave_ ## TI ::get_math_trunc_flag ()) \
00550 gripe_binop_integer_math_truncated ("./", v1.type_name (). c_str (), \
00551 v2.type_name (). c_str ()); \
00552 octave_ ## TI ::clear_conv_flag (); \
00553 return retval; \
00554 } \
00555 \
00556 DEFINTNDBINOP_FN (PFX ## _el_pow, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, elem_xpow, TI, .^) \
00557 \
00558 DEFBINOP (PFX ## _el_ldiv, TM ## matrix, TS ## scalar) \
00559 { \
00560 CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); \
00561 \
00562 octave_value retval = v2.TS ## scalar_value () / v1.TM ## array_value (); \
00563 if (octave_ ## TI ::get_math_trunc_flag ()) \
00564 gripe_binop_integer_math_truncated (".^", v1.type_name (). c_str (), \
00565 v2.type_name (). c_str ()); \
00566 octave_ ## TI ::clear_conv_flag (); \
00567 return retval; \
00568 }
00569
00570 #define OCTAVE_MS_INT_CMP_OPS(PFX, TM, TS) \
00571 DEFNDBINOP_FN (PFX ## _lt, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_lt) \
00572 DEFNDBINOP_FN (PFX ## _le, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_le) \
00573 DEFNDBINOP_FN (PFX ## _eq, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_eq) \
00574 DEFNDBINOP_FN (PFX ## _ge, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_ge) \
00575 DEFNDBINOP_FN (PFX ## _gt, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_gt) \
00576 DEFNDBINOP_FN (PFX ## _ne, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_ne)
00577
00578 #define OCTAVE_MS_INT_BOOL_OPS(PFX, TM, TS) \
00579 DEFNDBINOP_FN (PFX ## _el_and, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_and) \
00580 DEFNDBINOP_FN (PFX ## _el_or, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_or) \
00581 DEFNDBINOP_FN (PFX ## _el_not_and, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_not_and) \
00582 DEFNDBINOP_FN (PFX ## _el_not_or, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_not_or)
00583
00584 #define OCTAVE_MS_INT_ASSIGN_OPS(PFX, TM, TS, TE) \
00585 DEFNDASSIGNOP_FN (PFX ## _assign, TM ## matrix, TS ## scalar, TM ## scalar, assign)
00586
00587 #define OCTAVE_MS_INT_ASSIGNEQ_OPS(PFX, TM) \
00588 DEFNDASSIGNOP_OP (PFX ## _assign_add, TM ## matrix, TM ## scalar, TM ## scalar, +=) \
00589 DEFNDASSIGNOP_OP (PFX ## _assign_sub, TM ## matrix, TM ## scalar, TM ## scalar, -=) \
00590 DEFNDASSIGNOP_OP (PFX ## _assign_mul, TM ## matrix, TM ## scalar, TM ## scalar, *=) \
00591 DEFNDASSIGNOP_OP (PFX ## _assign_div, TM ## matrix, TM ## scalar, TM ## scalar, /=)
00592
00593 #define OCTAVE_MS_POW_OPS(T1, T2) \
00594 octave_value elem_xpow (T1 ## NDArray a, octave_ ## T2 b) \
00595 { \
00596 T1 ## NDArray result (a.dims ()); \
00597 for (int i = 0; i < a.length (); i++) \
00598 { \
00599 OCTAVE_QUIT; \
00600 result (i) = pow (a(i), b); \
00601 } \
00602 return octave_value (result); \
00603 } \
00604 \
00605 octave_value elem_xpow (T1 ## NDArray a, double b) \
00606 { \
00607 T1 ## NDArray result (a.dims ()); \
00608 for (int i = 0; i < a.length (); i++) \
00609 { \
00610 OCTAVE_QUIT; \
00611 result (i) = pow (a(i), b); \
00612 } \
00613 return octave_value (result); \
00614 } \
00615 \
00616 octave_value elem_xpow (NDArray a, octave_ ## T2 b) \
00617 { \
00618 T2 ## NDArray result (a.dims ()); \
00619 for (int i = 0; i < a.length (); i++) \
00620 { \
00621 OCTAVE_QUIT; \
00622 result (i) = pow (a(i), b); \
00623 } \
00624 return octave_value (result); \
00625 } \
00626 \
00627 octave_value elem_xpow (T1 ## NDArray a, float b) \
00628 { \
00629 T1 ## NDArray result (a.dims ()); \
00630 for (int i = 0; i < a.length (); i++) \
00631 { \
00632 OCTAVE_QUIT; \
00633 result (i) = powf (a(i), b); \
00634 } \
00635 return octave_value (result); \
00636 } \
00637 \
00638 octave_value elem_xpow (FloatNDArray a, octave_ ## T2 b) \
00639 { \
00640 T2 ## NDArray result (a.dims ()); \
00641 for (int i = 0; i < a.length (); i++) \
00642 { \
00643 OCTAVE_QUIT; \
00644 result (i) = powf (a(i), b); \
00645 } \
00646 return octave_value (result); \
00647 }
00648
00649
00650 #define OCTAVE_MS_INT_OPS(TYPE) \
00651 OCTAVE_MS_POW_OPS (TYPE, TYPE) \
00652 OCTAVE_MS_INT_ARITH_OPS (ms, TYPE ## _, TYPE ## _, TYPE) \
00653 OCTAVE_MS_INT_ARITH_OPS (msx, TYPE ## _, , TYPE) \
00654 OCTAVE_MS_INT_ARITH_OPS (mxs, , TYPE ## _, TYPE) \
00655 OCTAVE_MS_INT_ARITH_OPS (msfx, TYPE ## _, float_, TYPE) \
00656 OCTAVE_MS_INT_ARITH_OPS (mfxs, float_, TYPE ## _, TYPE) \
00657 OCTAVE_MS_INT_CMP_OPS (ms, TYPE ## _, TYPE ## _) \
00658 OCTAVE_MS_INT_CMP_OPS (mx, TYPE ## _, ) \
00659 OCTAVE_MS_INT_CMP_OPS (mxs, , TYPE ## _) \
00660 OCTAVE_MS_INT_CMP_OPS (mfx, TYPE ## _, float_) \
00661 OCTAVE_MS_INT_CMP_OPS (mfxs, float_, TYPE ## _) \
00662 OCTAVE_MS_INT_BOOL_OPS (ms, TYPE ## _, TYPE ## _) \
00663 OCTAVE_MS_INT_BOOL_OPS (mx, TYPE ## _, ) \
00664 OCTAVE_MS_INT_BOOL_OPS (mxs, , TYPE ## _) \
00665 OCTAVE_MS_INT_BOOL_OPS (mfx, TYPE ## _, float_) \
00666 OCTAVE_MS_INT_BOOL_OPS (mfxs, float_, TYPE ## _) \
00667 OCTAVE_MS_INT_ASSIGN_OPS (ms, TYPE ## _, TYPE ## _, TYPE ## _) \
00668 OCTAVE_MS_INT_ASSIGNEQ_OPS (mse, TYPE ## _) \
00669 OCTAVE_MS_INT_ASSIGN_OPS (mx, TYPE ## _, , ) \
00670 OCTAVE_MS_INT_ASSIGN_OPS (mfx, TYPE ## _, float_, float_)
00671
00672 #define OCTAVE_M_INT_UNOPS(TYPE) \
00673 \
00674 \
00675 DEFNDUNOP_OP (m_not, TYPE ## _matrix, TYPE ## _array, !) \
00676 DEFNDUNOP_OP (m_uplus, TYPE ## _matrix, TYPE ## _array, ) \
00677 DEFUNOP (m_uminus, TYPE ## _matrix) \
00678 { \
00679 CAST_UNOP_ARG (const octave_ ## TYPE ## _matrix &); \
00680 octave_value retval = octave_value (- v. TYPE ## _array_value ()); \
00681 if (octave_ ## TYPE ::get_math_trunc_flag ()) \
00682 gripe_unop_integer_math_truncated ("-", v.type_name (). c_str ()); \
00683 octave_ ## TYPE ::clear_conv_flag (); \
00684 return retval; \
00685 } \
00686 \
00687 DEFUNOP (m_transpose, TYPE ## _matrix) \
00688 { \
00689 CAST_UNOP_ARG (const octave_ ## TYPE ## _matrix&); \
00690 \
00691 if (v.ndims () > 2) \
00692 { \
00693 error ("transpose not defined for N-d objects"); \
00694 return octave_value (); \
00695 } \
00696 else \
00697 return octave_value (v.TYPE ## _array_value().transpose ()); \
00698 } \
00699 \
00700 DEFNCUNOP_METHOD (m_incr, TYPE ## _matrix, increment) \
00701 DEFNCUNOP_METHOD (m_decr, TYPE ## _matrix, decrement) \
00702 DEFNCUNOP_METHOD (m_changesign, TYPE ## _matrix, changesign)
00703
00704 #define OCTAVE_MM_INT_ARITH_OPS(PFX, T1, T2, T3) \
00705 \
00706 \
00707 DEFINTNDBINOP_OP (PFX ## _add, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, +, T3) \
00708 DEFINTNDBINOP_OP (PFX ## _sub, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, -, T3) \
00709 \
00710 \
00711 \
00712 \
00713 DEFBINOPX (PFX ## _pow, T1 ## matrix, T2 ## matrix) \
00714 { \
00715 error ("can't do A ^ B for A and B both matrices"); \
00716 return octave_value (); \
00717 } \
00718 \
00719 \
00720 \
00721 DEFINTNDBINOP_FN (PFX ## _el_mul, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, product, T3, .*) \
00722 \
00723 DEFINTNDBINOP_FN (PFX ## _el_div, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, quotient, T3, ./) \
00724 \
00725 DEFINTNDBINOP_FN (PFX ## _el_pow, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, elem_xpow, T3, .^) \
00726 \
00727 DEFBINOP (PFX ## _el_ldiv, T1 ## matrix, T2 ## matrix) \
00728 { \
00729 CAST_BINOP_ARGS (const octave_ ## T1 ## matrix&, const octave_ ## T2 ## matrix&); \
00730 \
00731 octave_value retval = octave_value (quotient (v2.T2 ## array_value (), v1.T1 ## array_value ())); \
00732 if (octave_ ## T3 ::get_math_trunc_flag ()) \
00733 gripe_binop_integer_math_truncated (".\\", v1.type_name (). c_str (), \
00734 v2.type_name (). c_str ()); \
00735 octave_ ## T3 ::clear_conv_flag (); \
00736 return retval; \
00737 }
00738
00739 #define OCTAVE_MM_INT_CMP_OPS(PFX, T1, T2) \
00740 DEFNDBINOP_FN (PFX ## _lt, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_lt) \
00741 DEFNDBINOP_FN (PFX ## _le, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_le) \
00742 DEFNDBINOP_FN (PFX ## _eq, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_eq) \
00743 DEFNDBINOP_FN (PFX ## _ge, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_ge) \
00744 DEFNDBINOP_FN (PFX ## _gt, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_gt) \
00745 DEFNDBINOP_FN (PFX ## _ne, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_ne)
00746
00747 #define OCTAVE_MM_INT_BOOL_OPS(PFX, T1, T2) \
00748 DEFNDBINOP_FN (PFX ## _el_and, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_and) \
00749 DEFNDBINOP_FN (PFX ## _el_or, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_or) \
00750 DEFNDBINOP_FN (PFX ## _el_not_and, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_not_and) \
00751 DEFNDBINOP_FN (PFX ## _el_not_or, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_not_or) \
00752 DEFNDBINOP_FN (PFX ## _el_and_not, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_and_not) \
00753 DEFNDBINOP_FN (PFX ## _el_or_not, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_or_not)
00754
00755 #define OCTAVE_MM_INT_ASSIGN_OPS(PFX, TLHS, TRHS, TE) \
00756 DEFNDASSIGNOP_FN (PFX ## _assign, TLHS ## matrix, TRHS ## matrix, TLHS ## array, assign)
00757
00758 #define OCTAVE_MM_INT_ASSIGNEQ_OPS(PFX, TM) \
00759 DEFNDASSIGNOP_OP (PFX ## _assign_add, TM ## matrix, TM ## matrix, TM ## array, +=) \
00760 DEFNDASSIGNOP_OP (PFX ## _assign_sub, TM ## matrix, TM ## matrix, TM ## array, -=) \
00761 DEFNDASSIGNOP_FNOP (PFX ## _assign_el_mul, TM ## matrix, TM ## matrix, TM ## array, product_eq) \
00762 DEFNDASSIGNOP_FNOP (PFX ## _assign_el_div, TM ## matrix, TM ## matrix, TM ## array, quotient_eq)
00763
00764 #define OCTAVE_MM_POW_OPS(T1, T2) \
00765 octave_value \
00766 elem_xpow (const T1 ## NDArray& a, const T2 ## NDArray& b) \
00767 { \
00768 dim_vector a_dims = a.dims (); \
00769 dim_vector b_dims = b.dims (); \
00770 if (a_dims != b_dims) \
00771 { \
00772 gripe_nonconformant ("operator .^", a_dims, b_dims); \
00773 return octave_value (); \
00774 } \
00775 T1 ## NDArray result (a_dims); \
00776 for (int i = 0; i < a.length (); i++) \
00777 { \
00778 OCTAVE_QUIT; \
00779 result (i) = pow (a(i), b(i)); \
00780 } \
00781 return octave_value (result); \
00782 } \
00783 \
00784 octave_value \
00785 elem_xpow (const T1 ## NDArray& a, const NDArray& b) \
00786 { \
00787 dim_vector a_dims = a.dims (); \
00788 dim_vector b_dims = b.dims (); \
00789 if (a_dims != b_dims) \
00790 { \
00791 gripe_nonconformant ("operator .^", a_dims, b_dims); \
00792 return octave_value (); \
00793 } \
00794 T1 ## NDArray result (a_dims); \
00795 for (int i = 0; i < a.length (); i++) \
00796 { \
00797 OCTAVE_QUIT; \
00798 result (i) = pow (a(i), b(i)); \
00799 } \
00800 return octave_value (result); \
00801 } \
00802 \
00803 octave_value \
00804 elem_xpow (const NDArray& a, const T2 ## NDArray& b) \
00805 { \
00806 dim_vector a_dims = a.dims (); \
00807 dim_vector b_dims = b.dims (); \
00808 if (a_dims != b_dims) \
00809 { \
00810 gripe_nonconformant ("operator .^", a_dims, b_dims); \
00811 return octave_value (); \
00812 } \
00813 T2 ## NDArray result (a_dims); \
00814 for (int i = 0; i < a.length (); i++) \
00815 { \
00816 OCTAVE_QUIT; \
00817 result (i) = pow (a(i), b(i)); \
00818 } \
00819 return octave_value (result); \
00820 } \
00821 \
00822 octave_value \
00823 elem_xpow (const T1 ## NDArray& a, const FloatNDArray& b) \
00824 { \
00825 dim_vector a_dims = a.dims (); \
00826 dim_vector b_dims = b.dims (); \
00827 if (a_dims != b_dims) \
00828 { \
00829 gripe_nonconformant ("operator .^", a_dims, b_dims); \
00830 return octave_value (); \
00831 } \
00832 T1 ## NDArray result (a_dims); \
00833 for (int i = 0; i < a.length (); i++) \
00834 { \
00835 OCTAVE_QUIT; \
00836 result (i) = powf (a(i), b(i)); \
00837 } \
00838 return octave_value (result); \
00839 } \
00840 \
00841 octave_value \
00842 elem_xpow (const FloatNDArray& a, const T2 ## NDArray& b) \
00843 { \
00844 dim_vector a_dims = a.dims (); \
00845 dim_vector b_dims = b.dims (); \
00846 if (a_dims != b_dims) \
00847 { \
00848 gripe_nonconformant ("operator .^", a_dims, b_dims); \
00849 return octave_value (); \
00850 } \
00851 T2 ## NDArray result (a_dims); \
00852 for (int i = 0; i < a.length (); i++) \
00853 { \
00854 OCTAVE_QUIT; \
00855 result (i) = powf (a(i), b(i)); \
00856 } \
00857 return octave_value (result); \
00858 }
00859
00860
00861 #define OCTAVE_MM_CONV(T1, T2) \
00862 DEFCONV (T1 ## m_ ## T2 ## m_conv, T1 ## matrix, T2 ## matrix) \
00863 { \
00864 CAST_CONV_ARG (const octave_ ## T1 ## matrix&); \
00865 \
00866 return new octave_ ## T2 ## matrix (v.T2 ## array_value ()); \
00867 }
00868
00869 #define OCTAVE_MM_INT_OPS(TYPE) \
00870 OCTAVE_M_INT_UNOPS (TYPE) \
00871 OCTAVE_MM_POW_OPS (TYPE, TYPE) \
00872 OCTAVE_MM_INT_ARITH_OPS (mm, TYPE ## _, TYPE ## _, TYPE) \
00873 OCTAVE_MM_INT_ARITH_OPS (mmx, TYPE ## _, , TYPE) \
00874 OCTAVE_MM_INT_ARITH_OPS (mxm, , TYPE ## _, TYPE) \
00875 OCTAVE_MM_INT_ARITH_OPS (mmfx, TYPE ## _, float_, TYPE) \
00876 OCTAVE_MM_INT_ARITH_OPS (mfxm, float_, TYPE ## _, TYPE) \
00877 OCTAVE_MM_INT_CMP_OPS (mm, TYPE ## _, TYPE ## _) \
00878 OCTAVE_MM_INT_CMP_OPS (mmx, TYPE ## _, ) \
00879 OCTAVE_MM_INT_CMP_OPS (mfxm, float_, TYPE ## _) \
00880 OCTAVE_MM_INT_CMP_OPS (mmfx, TYPE ## _, float_) \
00881 OCTAVE_MM_INT_CMP_OPS (mxm, , TYPE ## _) \
00882 OCTAVE_MM_INT_BOOL_OPS (mm, TYPE ## _, TYPE ## _) \
00883 OCTAVE_MM_INT_BOOL_OPS (mmx, TYPE ## _, ) \
00884 OCTAVE_MM_INT_BOOL_OPS (mxm, , TYPE ## _) \
00885 OCTAVE_MM_INT_BOOL_OPS (mmfx, TYPE ## _, float_) \
00886 OCTAVE_MM_INT_BOOL_OPS (mfxm, float_, TYPE ## _) \
00887 OCTAVE_MM_INT_ASSIGN_OPS (mm, TYPE ## _, TYPE ## _, TYPE ## _) \
00888 OCTAVE_MM_INT_ASSIGNEQ_OPS (mme, TYPE ## _) \
00889 OCTAVE_MM_INT_ASSIGN_OPS (mmx, TYPE ## _, , ) \
00890 OCTAVE_MM_INT_ASSIGN_OPS (mmfx, TYPE ## _, float_, float_) \
00891 OCTAVE_MM_CONV(TYPE ## _, complex_) \
00892 OCTAVE_MM_CONV(TYPE ## _, float_complex_)
00893
00894 #define OCTAVE_RE_INT_ASSIGN_OPS(TYPE) \
00895 DEFNDASSIGNOP_FN (TYPE ## ms_assign, matrix, TYPE ## _scalar, array, assign) \
00896 DEFNDASSIGNOP_FN (TYPE ## mm_assign, matrix, TYPE ## _matrix, array, assign)
00897
00898 #define OCTAVE_FLT_RE_INT_ASSIGN_OPS(TYPE) \
00899 DEFNDASSIGNOP_FN (TYPE ## fms_assign, float_matrix, TYPE ## _scalar, float_array, assign) \
00900 DEFNDASSIGNOP_FN (TYPE ## fmm_assign, float_matrix, TYPE ## _matrix, float_array, assign)
00901
00902 #define OCTAVE_CX_INT_ASSIGN_OPS(TYPE) \
00903 DEFNDASSIGNOP_FN (TYPE ## cms_assign, complex_matrix, TYPE ## _scalar, complex_array, assign) \
00904 DEFNDASSIGNOP_FN (TYPE ## cmm_assign, complex_matrix, TYPE ## _matrix, complex_array, assign)
00905
00906 #define OCTAVE_FLT_CX_INT_ASSIGN_OPS(TYPE) \
00907 DEFNDASSIGNOP_FN (TYPE ## fcms_assign, float_complex_matrix, TYPE ## _scalar, float_complex_array, assign) \
00908 DEFNDASSIGNOP_FN (TYPE ## fcmm_assign, float_complex_matrix, TYPE ## _matrix, float_complex_array, assign)
00909
00910 #define OCTAVE_INT_NULL_ASSIGN_OPS(TYPE) \
00911 DEFNULLASSIGNOP_FN (TYPE ## null_assign, TYPE ## _matrix, delete_elements)
00912
00913 #define OCTAVE_INT_OPS(TYPE) \
00914 OCTAVE_SS_INT_OPS (TYPE) \
00915 OCTAVE_SM_INT_OPS (TYPE) \
00916 OCTAVE_MS_INT_OPS (TYPE) \
00917 OCTAVE_MM_INT_OPS (TYPE) \
00918 OCTAVE_CONCAT_FN (TYPE) \
00919 OCTAVE_RE_INT_ASSIGN_OPS (TYPE) \
00920 OCTAVE_FLT_RE_INT_ASSIGN_OPS (TYPE) \
00921 OCTAVE_CX_INT_ASSIGN_OPS (TYPE) \
00922 OCTAVE_FLT_CX_INT_ASSIGN_OPS (TYPE) \
00923 OCTAVE_INT_NULL_ASSIGN_OPS(TYPE)
00924
00925 #define OCTAVE_INSTALL_S_INT_UNOPS(TYPE) \
00926 INSTALL_UNOP (op_not, octave_ ## TYPE ## _scalar, s_not); \
00927 INSTALL_UNOP (op_uplus, octave_ ## TYPE ## _scalar, s_uplus); \
00928 INSTALL_UNOP (op_uminus, octave_ ## TYPE ## _scalar, s_uminus); \
00929 INSTALL_UNOP (op_transpose, octave_ ## TYPE ## _scalar, s_transpose); \
00930 INSTALL_UNOP (op_hermitian, octave_ ## TYPE ## _scalar, s_hermitian); \
00931 \
00932 INSTALL_NCUNOP (op_incr, octave_ ## TYPE ## _scalar, s_incr); \
00933 INSTALL_NCUNOP (op_decr, octave_ ## TYPE ## _scalar, s_decr);
00934
00935 #define OCTAVE_INSTALL_SS_INT_ARITH_OPS(PFX, T1, T2) \
00936 INSTALL_BINOP (op_add, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _add); \
00937 INSTALL_BINOP (op_sub, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _sub); \
00938 INSTALL_BINOP (op_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _mul); \
00939 INSTALL_BINOP (op_div, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _div); \
00940 INSTALL_BINOP (op_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _pow); \
00941 INSTALL_BINOP (op_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ldiv); \
00942 INSTALL_BINOP (op_el_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_mul); \
00943 INSTALL_BINOP (op_el_div, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_div); \
00944 INSTALL_BINOP (op_el_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_pow); \
00945 INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_ldiv);
00946
00947 #define OCTAVE_INSTALL_SS_INT_CMP_OPS(PFX, T1, T2) \
00948 INSTALL_BINOP (op_lt, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _lt); \
00949 INSTALL_BINOP (op_le, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _le); \
00950 INSTALL_BINOP (op_eq, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _eq); \
00951 INSTALL_BINOP (op_ge, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ge); \
00952 INSTALL_BINOP (op_gt, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _gt); \
00953 INSTALL_BINOP (op_ne, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ne);
00954
00955 #define OCTAVE_INSTALL_SS_INT_BOOL_OPS(PFX, T1, T2) \
00956 INSTALL_BINOP (op_el_and, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_and); \
00957 INSTALL_BINOP (op_el_or, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_or);
00958
00959 #define OCTAVE_INSTALL_SS_INT_OPS(TYPE) \
00960 OCTAVE_INSTALL_S_INT_UNOPS (TYPE) \
00961 OCTAVE_INSTALL_SS_INT_ARITH_OPS (ss, TYPE ## _, TYPE ## _) \
00962 OCTAVE_INSTALL_SS_INT_ARITH_OPS (ssx, TYPE ## _, ) \
00963 OCTAVE_INSTALL_SS_INT_ARITH_OPS (sxs, , TYPE ## _) \
00964 OCTAVE_INSTALL_SS_INT_ARITH_OPS (ssfx, TYPE ## _, float_) \
00965 OCTAVE_INSTALL_SS_INT_ARITH_OPS (sfxs, float_, TYPE ## _) \
00966 OCTAVE_INSTALL_SS_INT_CMP_OPS (ss, TYPE ## _, TYPE ## _) \
00967 OCTAVE_INSTALL_SS_INT_CMP_OPS (sx, TYPE ## _, ) \
00968 OCTAVE_INSTALL_SS_INT_CMP_OPS (xs, , TYPE ## _) \
00969 OCTAVE_INSTALL_SS_INT_CMP_OPS (sfx, TYPE ## _, float_) \
00970 OCTAVE_INSTALL_SS_INT_CMP_OPS (fxs, float_, TYPE ## _) \
00971 OCTAVE_INSTALL_SS_INT_BOOL_OPS (ss, TYPE ## _, TYPE ## _) \
00972 OCTAVE_INSTALL_SS_INT_BOOL_OPS (sx, TYPE ## _, ) \
00973 OCTAVE_INSTALL_SS_INT_BOOL_OPS (xs, , TYPE ## _) \
00974 OCTAVE_INSTALL_SS_INT_BOOL_OPS (sfx, TYPE ## _, float_) \
00975 OCTAVE_INSTALL_SS_INT_BOOL_OPS (fxs, float_, TYPE ## _) \
00976 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix) \
00977 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_scalar, octave_ ## TYPE ## _matrix) \
00978 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_float_scalar, octave_ ## TYPE ## _matrix) \
00979 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_complex_scalar, octave_complex_matrix) \
00980 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_float_complex_scalar, octave_float_complex_matrix)
00981
00982 #define OCTAVE_INSTALL_SM_INT_ARITH_OPS(PFX, T1, T2) \
00983 INSTALL_BINOP (op_add, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _add); \
00984 INSTALL_BINOP (op_sub, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _sub); \
00985 INSTALL_BINOP (op_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _mul); \
00986 \
00987 \
00988 INSTALL_BINOP (op_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ldiv); \
00989 INSTALL_BINOP (op_el_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_mul); \
00990 INSTALL_BINOP (op_el_div, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_div); \
00991 INSTALL_BINOP (op_el_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_pow); \
00992 INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_ldiv);
00993
00994 #define OCTAVE_INSTALL_SM_INT_CMP_OPS(PFX, T1, T2) \
00995 INSTALL_BINOP (op_lt, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _lt); \
00996 INSTALL_BINOP (op_le, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _le); \
00997 INSTALL_BINOP (op_eq, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _eq); \
00998 INSTALL_BINOP (op_ge, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ge); \
00999 INSTALL_BINOP (op_gt, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _gt); \
01000 INSTALL_BINOP (op_ne, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ne);
01001
01002 #define OCTAVE_INSTALL_SM_INT_BOOL_OPS(PFX, T1, T2) \
01003 INSTALL_BINOP (op_el_and, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_and); \
01004 INSTALL_BINOP (op_el_or, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_or); \
01005 INSTALL_BINOP (op_el_and_not, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_and_not); \
01006 INSTALL_BINOP (op_el_or_not, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_or_not);
01007
01008 #define OCTAVE_INSTALL_SM_INT_OPS(TYPE) \
01009 OCTAVE_INSTALL_SM_INT_ARITH_OPS (sm, TYPE ## _, TYPE ## _) \
01010 OCTAVE_INSTALL_SM_INT_ARITH_OPS (smx, TYPE ## _, ) \
01011 OCTAVE_INSTALL_SM_INT_ARITH_OPS (sxm, , TYPE ## _) \
01012 OCTAVE_INSTALL_SM_INT_ARITH_OPS (smfx, TYPE ## _, float_) \
01013 OCTAVE_INSTALL_SM_INT_ARITH_OPS (sfxm, float_, TYPE ## _) \
01014 OCTAVE_INSTALL_SM_INT_CMP_OPS (sm, TYPE ## _, TYPE ## _) \
01015 OCTAVE_INSTALL_SM_INT_CMP_OPS (xm, , TYPE ## _) \
01016 OCTAVE_INSTALL_SM_INT_CMP_OPS (smx, TYPE ## _, ) \
01017 OCTAVE_INSTALL_SM_INT_CMP_OPS (fxm, float_, TYPE ## _) \
01018 OCTAVE_INSTALL_SM_INT_CMP_OPS (smfx, TYPE ## _, float_) \
01019 OCTAVE_INSTALL_SM_INT_BOOL_OPS (sm, TYPE ## _, TYPE ## _) \
01020 OCTAVE_INSTALL_SM_INT_BOOL_OPS (xm, , TYPE ## _) \
01021 OCTAVE_INSTALL_SM_INT_BOOL_OPS (smx, TYPE ## _, ) \
01022 OCTAVE_INSTALL_SM_INT_BOOL_OPS (fxm, float_, TYPE ## _) \
01023 OCTAVE_INSTALL_SM_INT_BOOL_OPS (smfx, TYPE ## _, float_) \
01024 INSTALL_WIDENOP (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, TYPE ## _s_ ## TYPE ## _m_conv) \
01025 INSTALL_WIDENOP (octave_ ## TYPE ## _scalar, octave_complex_matrix, TYPE ## _s_complex_m_conv) \
01026 INSTALL_WIDENOP (octave_ ## TYPE ## _scalar, octave_float_complex_matrix, TYPE ## _s_float_complex_m_conv) \
01027 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _matrix) \
01028 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_matrix, octave_ ## TYPE ## _matrix) \
01029 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_float_matrix, octave_ ## TYPE ## _matrix) \
01030 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_complex_matrix, octave_complex_matrix) \
01031 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_float_complex_matrix, octave_float_complex_matrix)
01032
01033 #define OCTAVE_INSTALL_MS_INT_ARITH_OPS(PFX, T1, T2) \
01034 INSTALL_BINOP (op_add, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _add); \
01035 INSTALL_BINOP (op_sub, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _sub); \
01036 INSTALL_BINOP (op_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _mul); \
01037 INSTALL_BINOP (op_div, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _div); \
01038 \
01039 \
01040 \
01041 INSTALL_BINOP (op_el_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_mul); \
01042 INSTALL_BINOP (op_el_div, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_div); \
01043 INSTALL_BINOP (op_el_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_pow); \
01044 INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_ldiv);
01045
01046 #define OCTAVE_INSTALL_MS_INT_CMP_OPS(PFX, T1, T2) \
01047 INSTALL_BINOP (op_lt, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _lt); \
01048 INSTALL_BINOP (op_le, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _le); \
01049 INSTALL_BINOP (op_eq, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _eq); \
01050 INSTALL_BINOP (op_ge, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ge); \
01051 INSTALL_BINOP (op_gt, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _gt); \
01052 INSTALL_BINOP (op_ne, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ne);
01053
01054 #define OCTAVE_INSTALL_MS_INT_BOOL_OPS(PFX, T1, T2) \
01055 INSTALL_BINOP (op_el_and, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_and); \
01056 INSTALL_BINOP (op_el_or, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_or); \
01057 INSTALL_BINOP (op_el_not_and, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_not_and); \
01058 INSTALL_BINOP (op_el_not_or, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_not_or);
01059
01060 #define OCTAVE_INSTALL_MS_INT_ASSIGN_OPS(PFX, TLHS, TRHS) \
01061 INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign)
01062
01063 #define OCTAVE_INSTALL_MS_INT_ASSIGNEQ_OPS(PFX, TLHS, TRHS) \
01064 INSTALL_ASSIGNOP (op_add_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_add) \
01065 INSTALL_ASSIGNOP (op_sub_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_sub) \
01066 INSTALL_ASSIGNOP (op_mul_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_mul) \
01067 INSTALL_ASSIGNOP (op_div_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_div)
01068
01069 #define OCTAVE_INSTALL_MS_INT_OPS(TYPE) \
01070 OCTAVE_INSTALL_MS_INT_ARITH_OPS (ms, TYPE ## _, TYPE ## _) \
01071 OCTAVE_INSTALL_MS_INT_ARITH_OPS (msx, TYPE ## _, ) \
01072 OCTAVE_INSTALL_MS_INT_ARITH_OPS (mxs, , TYPE ## _) \
01073 OCTAVE_INSTALL_MS_INT_ARITH_OPS (msfx, TYPE ## _, float_) \
01074 OCTAVE_INSTALL_MS_INT_ARITH_OPS (mfxs, float_, TYPE ## _) \
01075 OCTAVE_INSTALL_MS_INT_CMP_OPS (ms, TYPE ## _, TYPE ## _) \
01076 OCTAVE_INSTALL_MS_INT_CMP_OPS (mx, TYPE ## _, ) \
01077 OCTAVE_INSTALL_MS_INT_CMP_OPS (mxs, , TYPE ## _) \
01078 OCTAVE_INSTALL_MS_INT_CMP_OPS (mfx, TYPE ## _, float_) \
01079 OCTAVE_INSTALL_MS_INT_CMP_OPS (mfxs, float_, TYPE ## _) \
01080 OCTAVE_INSTALL_MS_INT_BOOL_OPS (ms, TYPE ## _, TYPE ## _) \
01081 OCTAVE_INSTALL_MS_INT_BOOL_OPS (mx, TYPE ## _, ) \
01082 OCTAVE_INSTALL_MS_INT_BOOL_OPS (mxs, , TYPE ## _) \
01083 OCTAVE_INSTALL_MS_INT_BOOL_OPS (mfx, TYPE ## _, float_) \
01084 OCTAVE_INSTALL_MS_INT_BOOL_OPS (mfxs, float_, TYPE ## _) \
01085 OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (ms, TYPE ## _, TYPE ## _) \
01086 OCTAVE_INSTALL_MS_INT_ASSIGNEQ_OPS (mse, TYPE ## _, TYPE ## _) \
01087 OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mx, TYPE ## _, ) \
01088 OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mfx, TYPE ## _, float_) \
01089 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _matrix, octave_complex_scalar, octave_complex_matrix) \
01090 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _matrix, octave_float_complex_scalar, octave_float_complex_matrix)
01091
01092 #define OCTAVE_INSTALL_M_INT_UNOPS(TYPE) \
01093 INSTALL_UNOP (op_not, octave_ ## TYPE ## _matrix, m_not); \
01094 INSTALL_UNOP (op_uplus, octave_ ## TYPE ## _matrix, m_uplus); \
01095 INSTALL_UNOP (op_uminus, octave_ ## TYPE ## _matrix, m_uminus); \
01096 INSTALL_UNOP (op_transpose, octave_ ## TYPE ## _matrix, m_transpose); \
01097 INSTALL_UNOP (op_hermitian, octave_ ## TYPE ## _matrix, m_transpose); \
01098 \
01099 INSTALL_NCUNOP (op_incr, octave_ ## TYPE ## _matrix, m_incr); \
01100 INSTALL_NCUNOP (op_decr, octave_ ## TYPE ## _matrix, m_decr); \
01101 INSTALL_NCUNOP (op_uminus, octave_ ## TYPE ## _matrix, m_changesign);
01102
01103 #define OCTAVE_INSTALL_MM_INT_ARITH_OPS(PFX, T1, T2) \
01104 INSTALL_BINOP (op_add, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _add); \
01105 INSTALL_BINOP (op_sub, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _sub); \
01106 \
01107 \
01108 INSTALL_BINOP (op_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _pow); \
01109 \
01110 INSTALL_BINOP (op_el_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_mul); \
01111 INSTALL_BINOP (op_el_div, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_div); \
01112 INSTALL_BINOP (op_el_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_pow); \
01113 INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_ldiv);
01114
01115 #define OCTAVE_INSTALL_MM_INT_CMP_OPS(PFX, T1, T2) \
01116 INSTALL_BINOP (op_lt, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _lt); \
01117 INSTALL_BINOP (op_le, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _le); \
01118 INSTALL_BINOP (op_eq, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _eq); \
01119 INSTALL_BINOP (op_ge, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _ge); \
01120 INSTALL_BINOP (op_gt, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _gt); \
01121 INSTALL_BINOP (op_ne, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _ne);
01122
01123 #define OCTAVE_INSTALL_MM_INT_BOOL_OPS(PFX, T1, T2) \
01124 INSTALL_BINOP (op_el_and, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_and); \
01125 INSTALL_BINOP (op_el_or, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_or); \
01126 INSTALL_BINOP (op_el_not_and, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_not_and); \
01127 INSTALL_BINOP (op_el_not_or, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_not_or); \
01128 INSTALL_BINOP (op_el_and_not, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_and_not); \
01129 INSTALL_BINOP (op_el_or_not, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_or_not);
01130
01131 #define OCTAVE_INSTALL_MM_INT_ASSIGN_OPS(PFX, TLHS, TRHS) \
01132 INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign)
01133
01134 #define OCTAVE_INSTALL_MM_INT_ASSIGNEQ_OPS(PFX, TLHS, TRHS) \
01135 INSTALL_ASSIGNOP (op_add_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_add) \
01136 INSTALL_ASSIGNOP (op_sub_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_sub) \
01137 INSTALL_ASSIGNOP (op_el_mul_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_el_mul) \
01138 INSTALL_ASSIGNOP (op_el_div_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_el_div)
01139
01140 #define OCTAVE_INSTALL_MM_INT_OPS(TYPE) \
01141 OCTAVE_INSTALL_M_INT_UNOPS (TYPE) \
01142 OCTAVE_INSTALL_MM_INT_ARITH_OPS (mm, TYPE ##_, TYPE ## _) \
01143 OCTAVE_INSTALL_MM_INT_ARITH_OPS (mmx, TYPE ##_, ) \
01144 OCTAVE_INSTALL_MM_INT_ARITH_OPS (mxm, , TYPE ##_) \
01145 OCTAVE_INSTALL_MM_INT_ARITH_OPS (mmfx, TYPE ##_, float_) \
01146 OCTAVE_INSTALL_MM_INT_ARITH_OPS (mfxm, float_, TYPE ##_) \
01147 OCTAVE_INSTALL_MM_INT_CMP_OPS (mm, TYPE ## _, TYPE ## _) \
01148 OCTAVE_INSTALL_MM_INT_CMP_OPS (mmx, TYPE ## _, ) \
01149 OCTAVE_INSTALL_MM_INT_CMP_OPS (mxm, , TYPE ## _) \
01150 OCTAVE_INSTALL_MM_INT_CMP_OPS (mmfx, TYPE ## _, float_) \
01151 OCTAVE_INSTALL_MM_INT_CMP_OPS (mfxm, float_, TYPE ## _) \
01152 OCTAVE_INSTALL_MM_INT_BOOL_OPS (mm, TYPE ## _, TYPE ## _) \
01153 OCTAVE_INSTALL_MM_INT_BOOL_OPS (mmx, TYPE ## _, ) \
01154 OCTAVE_INSTALL_MM_INT_BOOL_OPS (mxm, , TYPE ## _) \
01155 OCTAVE_INSTALL_MM_INT_BOOL_OPS (mmfx, TYPE ## _, float_) \
01156 OCTAVE_INSTALL_MM_INT_BOOL_OPS (mfxm, float_, TYPE ## _) \
01157 OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mm, TYPE ## _, TYPE ## _) \
01158 OCTAVE_INSTALL_MM_INT_ASSIGNEQ_OPS (mme, TYPE ## _, TYPE ## _) \
01159 OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmx, TYPE ## _, ) \
01160 OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmfx, TYPE ## _, float_) \
01161 INSTALL_WIDENOP (octave_ ## TYPE ## _matrix, octave_complex_matrix, TYPE ## _m_complex_m_conv) \
01162 INSTALL_WIDENOP (octave_ ## TYPE ## _matrix, octave_float_complex_matrix, TYPE ## _m_float_complex_m_conv) \
01163 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _matrix, octave_complex_matrix, octave_complex_matrix) \
01164 INSTALL_ASSIGNCONV (octave_ ## TYPE ## _matrix, octave_float_complex_matrix, octave_float_complex_matrix)
01165
01166 #define OCTAVE_INSTALL_RE_INT_ASSIGN_OPS(TYPE) \
01167 INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_ ## TYPE ## _scalar, TYPE ## ms_assign) \
01168 INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_ ## TYPE ## _matrix, TYPE ## mm_assign) \
01169 INSTALL_ASSIGNCONV (octave_scalar, octave_ ## TYPE ## _scalar, octave_matrix) \
01170 INSTALL_ASSIGNCONV (octave_matrix, octave_ ## TYPE ## _matrix, octave_matrix)
01171
01172 #define OCTAVE_INSTALL_FLT_RE_INT_ASSIGN_OPS(TYPE) \
01173 INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_ ## TYPE ## _scalar, TYPE ## fms_assign) \
01174 INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_ ## TYPE ## _matrix, TYPE ## fmm_assign) \
01175 INSTALL_ASSIGNCONV (octave_float_scalar, octave_ ## TYPE ## _scalar, octave_float_matrix) \
01176 INSTALL_ASSIGNCONV (octave_float_matrix, octave_ ## TYPE ## _matrix, octave_float_matrix)
01177
01178 #define OCTAVE_INSTALL_CX_INT_ASSIGN_OPS(TYPE) \
01179 INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_ ## TYPE ## _scalar, TYPE ## cms_assign) \
01180 INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_ ## TYPE ## _matrix, TYPE ## cmm_assign) \
01181 INSTALL_ASSIGNCONV (octave_complex_scalar, octave_ ## TYPE ## _scalar, octave_complex_matrix) \
01182 INSTALL_ASSIGNCONV (octave_complex_matrix, octave_ ## TYPE ## _matrix, octave_complex_matrix)
01183
01184 #define OCTAVE_INSTALL_FLT_CX_INT_ASSIGN_OPS(TYPE) \
01185 INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_ ## TYPE ## _scalar, TYPE ## fcms_assign) \
01186 INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_ ## TYPE ## _matrix, TYPE ## fcmm_assign) \
01187 INSTALL_ASSIGNCONV (octave_float_complex_scalar, octave_ ## TYPE ## _scalar, octave_complex_matrix) \
01188 INSTALL_ASSIGNCONV (octave_float_complex_matrix, octave_ ## TYPE ## _matrix, octave_complex_matrix)
01189
01190 #define OCTAVE_INSTALL_INT_NULL_ASSIGN_OPS(TYPE) \
01191 INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TYPE ## _matrix, octave_null_matrix, TYPE ## null_assign) \
01192 INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TYPE ## _matrix, octave_null_str, TYPE ## null_assign) \
01193 INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TYPE ## _matrix, octave_null_sq_str, TYPE ## null_assign)
01194
01195 #define OCTAVE_INSTALL_INT_OPS(TYPE) \
01196 OCTAVE_INSTALL_SS_INT_OPS (TYPE) \
01197 OCTAVE_INSTALL_SM_INT_OPS (TYPE) \
01198 OCTAVE_INSTALL_MS_INT_OPS (TYPE) \
01199 OCTAVE_INSTALL_MM_INT_OPS (TYPE) \
01200 OCTAVE_INSTALL_CONCAT_FN (TYPE) \
01201 OCTAVE_INSTALL_RE_INT_ASSIGN_OPS (TYPE) \
01202 OCTAVE_INSTALL_FLT_RE_INT_ASSIGN_OPS (TYPE) \
01203 OCTAVE_INSTALL_CX_INT_ASSIGN_OPS (TYPE) \
01204 OCTAVE_INSTALL_FLT_CX_INT_ASSIGN_OPS (TYPE) \
01205 OCTAVE_INSTALL_INT_NULL_ASSIGN_OPS(TYPE)
01206
01207 #define OCTAVE_INSTALL_SM_INT_ASSIGNCONV(TLHS, TRHS) \
01208 INSTALL_ASSIGNCONV (octave_ ## TLHS ## _scalar, octave_ ## TRHS ## _scalar, octave_ ## TLHS ## _matrix) \
01209 INSTALL_ASSIGNCONV (octave_ ## TLHS ## _scalar, octave_ ## TRHS ## _matrix, octave_ ## TLHS ## _matrix)
01210
01211 #define OCTAVE_MIXED_INT_CMP_OPS(T1, T2) \
01212 OCTAVE_SS_INT_CMP_OPS (T1 ## _ ## T2 ## _ss, T1 ## _, T2 ## _) \
01213 OCTAVE_SM_INT_CMP_OPS (T1 ## _ ## T2 ## _sm, T1 ## _, T2 ## _) \
01214 OCTAVE_MS_INT_CMP_OPS (T1 ## _ ## T2 ## _ms, T1 ## _, T2 ## _) \
01215 OCTAVE_MM_INT_CMP_OPS (T1 ## _ ## T2 ## _mm, T1 ## _, T2 ## _)
01216
01217 #define OCTAVE_INSTALL_MIXED_INT_CMP_OPS(T1, T2) \
01218 OCTAVE_INSTALL_SS_INT_CMP_OPS (T1 ## _ ## T2 ## _ss, T1 ## _, T2 ## _) \
01219 OCTAVE_INSTALL_SM_INT_CMP_OPS (T1 ## _ ## T2 ## _sm, T1 ## _, T2 ## _) \
01220 OCTAVE_INSTALL_MS_INT_CMP_OPS (T1 ## _ ## T2 ## _ms, T1 ## _, T2 ## _) \
01221 OCTAVE_INSTALL_MM_INT_CMP_OPS (T1 ## _ ## T2 ## _mm, T1 ## _, T2 ## _)
01222
01223
01224
01225
01226
01227