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