GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
op-int.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2024 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_op_int_h)
27 #define octave_op_int_h 1
28 
29 #include "octave-config.h"
30 
31 #include "quit.h"
32 #include "bsxfun.h"
33 
34 #define DEFINTBINOP_OP(name, t1, t2, op, t3) \
35  static octave_value \
36  CONCAT2 (oct_binop_, name) (const octave_base_value& a1, \
37  const octave_base_value& a2) \
38  { \
39  OCTAVE_CAST_BASE_VALUE (const octave_ ## t1&, v1, a1); \
40  OCTAVE_CAST_BASE_VALUE (const octave_ ## t2&, v2, a2); \
41  octave_value retval = octave_value \
42  (v1.t1 ## _value () op v2.t2 ## _value ()); \
43  return retval; \
44  }
45 
46 #define DEFINTNDBINOP_OP(name, t1, t2, e1, e2, op, t3) \
47  static octave_value \
48  CONCAT2 (oct_binop_, name) (const octave_base_value& a1, \
49  const octave_base_value& a2) \
50  { \
51  OCTAVE_CAST_BASE_VALUE (const octave_ ## t1&, v1, a1); \
52  OCTAVE_CAST_BASE_VALUE (const octave_ ## t2&, v2, a2); \
53  octave_value retval = octave_value \
54  (v1.e1 ## _value () op v2.e2 ## _value ()); \
55  return retval; \
56  }
57 
58 #define DEFINTBINOP_FN(name, t1, t2, f, t3, op) \
59  static octave_value \
60  CONCAT2 (oct_binop_, name) (const octave_base_value& a1, \
61  const octave_base_value& a2) \
62  { \
63  OCTAVE_CAST_BASE_VALUE (const octave_ ## t1&, v1, a1); \
64  OCTAVE_CAST_BASE_VALUE (const octave_ ## t2&, v2, a2); \
65  octave_value retval = octave_value (f (v1.t1 ## _value (), v2.t2 ## _value ())); \
66  return retval; \
67  }
68 
69 #define DEFINTNDBINOP_FN(name, t1, t2, e1, e2, f, t3, op) \
70  static octave_value \
71  CONCAT2 (oct_binop_, name) (const octave_base_value& a1, \
72  const octave_base_value& a2) \
73  { \
74  OCTAVE_CAST_BASE_VALUE (const octave_ ## t1&, v1, a1); \
75  OCTAVE_CAST_BASE_VALUE (const octave_ ## t2&, v2, a2); \
76  octave_value retval = octave_value (f (v1.e1 ## _value (), v2.e2 ## _value ())); \
77  return retval; \
78  }
79 
80 #define OCTAVE_CONCAT_FN2(T1, T2) \
81  DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _s_s, T1 ## _scalar, T2 ## _scalar, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat) \
82  DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _s_m, T1 ## _scalar, T2 ## _matrix, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat) \
83  DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _m_s, T1 ## _matrix, T2 ## _scalar, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat) \
84  DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _m_m, T1 ## _matrix, T2 ## _matrix, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat)
85 
86 #define OCTAVE_INSTALL_CONCAT_FN2(T1, T2) \
87  INSTALL_CATOP_TI (ti, octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, T1 ## _ ## T2 ## _s_s) \
88  INSTALL_CATOP_TI (ti, octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, T1 ## _ ## T2 ## _s_m) \
89  INSTALL_CATOP_TI (ti, octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, T1 ## _ ## T2 ## _m_s) \
90  INSTALL_CATOP_TI (ti, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, T1 ## _ ## T2 ## _m_m)
91 
92 #define OCTAVE_DOUBLE_INT_CONCAT_FN(TYPE) \
93  DEFNDCATOP_FN2 (double ## _ ## TYPE ## _s_s, scalar, TYPE ## _scalar, TYPE ## NDArray, , array, TYPE ## _array, concat) \
94  DEFNDCATOP_FN2 (double ## _ ## TYPE ## _s_m, scalar, TYPE ## _matrix, TYPE ## NDArray, , array, TYPE ## _array, concat) \
95  DEFNDCATOP_FN2 (double ## _ ## TYPE ## _m_s, matrix, TYPE ## _scalar, TYPE ## NDArray, , array, TYPE ## _array, concat) \
96  DEFNDCATOP_FN2 (double ## _ ## TYPE ## _m_m, matrix, TYPE ## _matrix, TYPE ## NDArray, , array, TYPE ## _array, concat)
97 
98 #define OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN(TYPE) \
99  INSTALL_CATOP_TI (ti, octave_scalar, octave_ ## TYPE ## _scalar, double ## _ ## TYPE ## _s_s) \
100  INSTALL_CATOP_TI (ti, octave_scalar, octave_ ## TYPE ## _matrix, double ## _ ## TYPE ## _s_m) \
101  INSTALL_CATOP_TI (ti, octave_matrix, octave_ ## TYPE ## _scalar, double ## _ ## TYPE ## _m_s) \
102  INSTALL_CATOP_TI (ti, octave_matrix, octave_ ## TYPE ## _matrix, double ## _ ## TYPE ## _m_m)
103 
104 #define OCTAVE_INT_DOUBLE_CONCAT_FN(TYPE) \
105  DEFNDCATOP_FN2 (TYPE ## _ ## double ## _s_s, TYPE ## _scalar, scalar, , TYPE ## NDArray, TYPE ## _array, array, concat) \
106  DEFNDCATOP_FN2 (TYPE ## _ ## double ## _s_m, TYPE ## _scalar, matrix, , TYPE ## NDArray, TYPE ## _array, array, concat) \
107  DEFNDCATOP_FN2 (TYPE ## _ ## double ## _m_s, TYPE ## _matrix, scalar, , TYPE ## NDArray, TYPE ## _array, array, concat) \
108  DEFNDCATOP_FN2 (TYPE ## _ ## double ## _m_m, TYPE ## _matrix, matrix, , TYPE ## NDArray, TYPE ## _array, array, concat)
109 
110 #define OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN(TYPE) \
111  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _scalar, octave_scalar, TYPE ## _ ## double ## _s_s) \
112  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _scalar, octave_matrix, TYPE ## _ ## double ## _s_m) \
113  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _matrix, octave_scalar, TYPE ## _ ## double ## _m_s) \
114  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _matrix, octave_matrix, TYPE ## _ ## double ## _m_m)
115 
116 #define OCTAVE_FLOAT_INT_CONCAT_FN(TYPE) \
117  DEFNDCATOP_FN2 (float ## _ ## TYPE ## _s_s, float_scalar, TYPE ## _scalar, TYPE ## NDArray, , float_array, TYPE ## _array, concat) \
118  DEFNDCATOP_FN2 (float ## _ ## TYPE ## _s_m, float_scalar, TYPE ## _matrix, TYPE ## NDArray, , float_array, TYPE ## _array, concat) \
119  DEFNDCATOP_FN2 (float ## _ ## TYPE ## _m_s, float_matrix, TYPE ## _scalar, TYPE ## NDArray, , float_array, TYPE ## _array, concat) \
120  DEFNDCATOP_FN2 (float ## _ ## TYPE ## _m_m, float_matrix, TYPE ## _matrix, TYPE ## NDArray, , float_array, TYPE ## _array, concat)
121 
122 #define OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN(TYPE) \
123  INSTALL_CATOP_TI (ti, octave_float_scalar, octave_ ## TYPE ## _scalar, float ## _ ## TYPE ## _s_s) \
124  INSTALL_CATOP_TI (ti, octave_float_scalar, octave_ ## TYPE ## _matrix, float ## _ ## TYPE ## _s_m) \
125  INSTALL_CATOP_TI (ti, octave_float_matrix, octave_ ## TYPE ## _scalar, float ## _ ## TYPE ## _m_s) \
126  INSTALL_CATOP_TI (ti, octave_float_matrix, octave_ ## TYPE ## _matrix, float ## _ ## TYPE ## _m_m)
127 
128 #define OCTAVE_INT_FLOAT_CONCAT_FN(TYPE) \
129  DEFNDCATOP_FN2 (TYPE ## _ ## float ## _s_s, TYPE ## _scalar, float_scalar, , TYPE ## NDArray, TYPE ## _array, float_array, concat) \
130  DEFNDCATOP_FN2 (TYPE ## _ ## float ## _s_m, TYPE ## _scalar, float_matrix, , TYPE ## NDArray, TYPE ## _array, float_array, concat) \
131  DEFNDCATOP_FN2 (TYPE ## _ ## float ## _m_s, TYPE ## _matrix, float_scalar, , TYPE ## NDArray, TYPE ## _array, float_array, concat) \
132  DEFNDCATOP_FN2 (TYPE ## _ ## float ## _m_m, TYPE ## _matrix, float_matrix, , TYPE ## NDArray, TYPE ## _array, float_array, concat)
133 
134 #define OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN(TYPE) \
135  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _scalar, octave_float_scalar, TYPE ## _ ## float ## _s_s) \
136  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _scalar, octave_float_matrix, TYPE ## _ ## float ## _s_m) \
137  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _matrix, octave_float_scalar, TYPE ## _ ## float ## _m_s) \
138  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _matrix, octave_float_matrix, TYPE ## _ ## float ## _m_m)
139 
140 // For compatibility, concatenation with a character always returns a
141 // character.
142 
143 #define OCTAVE_CHAR_INT_CONCAT_FN(TYPE) \
144  DEFNDCHARCATOP_FN (char ## _ ## TYPE ## _m_s, char_matrix, TYPE ## _scalar, concat) \
145  DEFNDCHARCATOP_FN (char ## _ ## TYPE ## _m_m, char_matrix, TYPE ## _matrix, concat)
146 
147 #define OCTAVE_INSTALL_CHAR_INT_CONCAT_FN(TYPE) \
148  INSTALL_CATOP_TI (ti, octave_char_matrix_str, octave_ ## TYPE ## _scalar, char ## _ ## TYPE ## _m_s) \
149  INSTALL_CATOP_TI (ti, octave_char_matrix_str, octave_ ## TYPE ## _matrix, char ## _ ## TYPE ## _m_m) \
150  INSTALL_CATOP_TI (ti, octave_char_matrix_sq_str, octave_ ## TYPE ## _scalar, char ## _ ## TYPE ## _m_s) \
151  INSTALL_CATOP_TI (ti, octave_char_matrix_sq_str, octave_ ## TYPE ## _matrix, char ## _ ## TYPE ## _m_m)
152 
153 #define OCTAVE_INT_CHAR_CONCAT_FN(TYPE) \
154  DEFNDCHARCATOP_FN (TYPE ## _ ## char ## _s_m, TYPE ## _scalar, char_matrix, concat) \
155  DEFNDCHARCATOP_FN (TYPE ## _ ## char ## _m_m, TYPE ## _matrix, char_matrix, concat)
156 
157 #define OCTAVE_INSTALL_INT_CHAR_CONCAT_FN(TYPE) \
158  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _scalar, octave_char_matrix_str, TYPE ## _ ## char ## _s_m) \
159  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _matrix, octave_char_matrix_str, TYPE ## _ ## char ## _m_m) \
160  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _scalar, octave_char_matrix_sq_str, TYPE ## _ ## char ## _s_m) \
161  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _matrix, octave_char_matrix_sq_str, TYPE ## _ ## char ## _m_m)
162 
163 #define OCTAVE_CONCAT_FN(TYPE) \
164  DEFNDCATOP_FN (TYPE ## _s_s, TYPE ## _scalar, TYPE ## _scalar, TYPE ## _array, TYPE ## _array, concat) \
165  DEFNDCATOP_FN (TYPE ## _s_m, TYPE ## _scalar, TYPE ## _matrix, TYPE ## _array, TYPE ## _array, concat) \
166  DEFNDCATOP_FN (TYPE ## _m_s, TYPE ## _matrix, TYPE ## _scalar, TYPE ## _array, TYPE ## _array, concat) \
167  DEFNDCATOP_FN (TYPE ## _m_m, TYPE ## _matrix, TYPE ## _matrix, TYPE ## _array, TYPE ## _array, concat)
168 
169 #define OCTAVE_INSTALL_CONCAT_FN(TYPE) \
170  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _scalar, TYPE ## _s_s) \
171  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, TYPE ## _s_m) \
172  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _scalar, TYPE ## _m_s) \
173  INSTALL_CATOP_TI (ti, octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _matrix, TYPE ## _m_m)
174 
175 // scalar unary ops.
176 #define OCTAVE_S_INT_UNOPS(TYPE) \
177  \
178  DEFUNOP_OP (s_not, TYPE ## _scalar, !) \
179  DEFUNOP_OP (s_uplus, TYPE ## _scalar, /* no-op */) \
180  DEFUNOP (s_uminus, TYPE ## _scalar) \
181  { \
182  OCTAVE_CAST_BASE_VALUE (const octave_ ## TYPE ## _scalar&, v, a); \
183  octave_value retval = octave_value (- v. TYPE ## _scalar_value ()); \
184  return retval; \
185  } \
186  DEFUNOP_OP (s_transpose, TYPE ## _scalar, /* no-op */) \
187  DEFUNOP_OP (s_hermitian, TYPE ## _scalar, /* no-op */) \
188  \
189  DEFNCUNOP_METHOD (s_incr, TYPE ## _scalar, increment) \
190  DEFNCUNOP_METHOD (s_decr, TYPE ## _scalar, decrement)
191 
192 // scalar by scalar ops.
193 #define OCTAVE_SS_INT_ARITH_OPS(PFX, T1, T2, T3) \
194  \
195  DEFINTBINOP_OP (PFX ## _add, T1 ## scalar, T2 ## scalar, +, T3) \
196  DEFINTBINOP_OP (PFX ## _sub, T1 ## scalar, T2 ## scalar, -, T3) \
197  DEFINTBINOP_OP (PFX ## _mul, T1 ## scalar, T2 ## scalar, *, T3) \
198  \
199  DEFBINOP (PFX ## _div, T1 ## scalar, T2 ## scalar) \
200  { \
201  OCTAVE_CAST_BASE_VALUE (const octave_ ## T1 ## scalar&, v1, a1); \
202  OCTAVE_CAST_BASE_VALUE (const octave_ ## T2 ## scalar&, v2, a2); \
203  \
204  return octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \
205  } \
206  \
207  DEFINTBINOP_FN (PFX ## _pow, T1 ## scalar, T2 ## scalar, xpow, T3, ^) \
208  \
209  DEFBINOP (PFX ## _ldiv, T1 ## scalar, T2 ## scalar) \
210  { \
211  OCTAVE_CAST_BASE_VALUE (const octave_ ## T1 ## scalar&, v1, a1); \
212  OCTAVE_CAST_BASE_VALUE (const octave_ ## T2 ## scalar&, v2, a2); \
213  \
214  return octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \
215  } \
216  \
217  DEFINTBINOP_OP (PFX ## _el_mul, T1 ## scalar, T2 ## scalar, *, T3) \
218  \
219  DEFBINOP (PFX ## _el_div, T1 ## scalar, T2 ## scalar) \
220  { \
221  OCTAVE_CAST_BASE_VALUE (const octave_ ## T1 ## scalar&, v1, a1); \
222  OCTAVE_CAST_BASE_VALUE (const octave_ ## T2 ## scalar&, v2, a2); \
223  \
224  return octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \
225  } \
226  \
227  DEFINTBINOP_FN (PFX ## _el_pow, T1 ## scalar, T2 ## scalar, xpow, T3, .^) \
228  \
229  DEFBINOP (PFX ## _el_ldiv, T1 ## scalar, T2 ## scalar) \
230  { \
231  OCTAVE_CAST_BASE_VALUE (const octave_ ## T1 ## scalar&, v1, a1); \
232  OCTAVE_CAST_BASE_VALUE (const octave_ ## T2 ## scalar&, v2, a2); \
233  \
234  return octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \
235  }
236 
237 #define OCTAVE_SS_INT_BOOL_OPS(PFX, T1, T2, Z1, Z2) \
238  DEFBINOP (PFX ## _el_and, T2, T2) \
239  { \
240  OCTAVE_CAST_BASE_VALUE (const octave_ ## T1 ## scalar&, v1, a1); \
241  OCTAVE_CAST_BASE_VALUE (const octave_ ## T2 ## scalar&, v2, a2); \
242  \
243  return v1.T1 ## scalar_value () != Z1 && v2.T2 ## scalar_value () != Z2; \
244  } \
245  \
246  DEFBINOP (PFX ## _el_or, T1, T2) \
247  { \
248  OCTAVE_CAST_BASE_VALUE (const octave_ ## T1 ## scalar&, v1, a1); \
249  OCTAVE_CAST_BASE_VALUE (const octave_ ## T2 ## scalar&, v2, a2); \
250  \
251  return v1.T1 ## scalar_value () != Z1 || v2.T2 ## scalar_value () != Z2; \
252  }
253 
254 #define OCTAVE_SS_INT_CMP_OPS(PFX, T1, T2) \
255  DEFBINOP_OP (PFX ## _lt, T1 ## scalar, T2 ## scalar, <) \
256  DEFBINOP_OP (PFX ## _le, T1 ## scalar, T2 ## scalar, <=) \
257  DEFBINOP_OP (PFX ## _eq, T1 ## scalar, T2 ## scalar, ==) \
258  DEFBINOP_OP (PFX ## _ge, T1 ## scalar, T2 ## scalar, >=) \
259  DEFBINOP_OP (PFX ## _gt, T1 ## scalar, T2 ## scalar, >) \
260  DEFBINOP_OP (PFX ## _ne, T1 ## scalar, T2 ## scalar, !=)
261 
262 #define OCTAVE_SS_POW_OPS(T1, T2) \
263  static octave_value \
264  xpow (const octave_ ## T1& a, const octave_ ## T2& b) \
265  { \
266  return pow (a, b); \
267  } \
268  \
269  static octave_value \
270  xpow (const octave_ ## T1& a, double b) \
271  { \
272  return pow (a, b); \
273  } \
274  \
275  static octave_value \
276  xpow (double a, const octave_ ## T1& b) \
277  { \
278  return pow (a, b); \
279  } \
280  \
281  static octave_value \
282  xpow (const octave_ ## T1& a, float b) \
283  { \
284  return powf (a, b); \
285  } \
286  \
287  static octave_value \
288  xpow (float a, const octave_ ## T1& b) \
289  { \
290  return powf (a, b); \
291  }
292 
293 #define OCTAVE_SS_INT_OPS(TYPE) \
294  OCTAVE_S_INT_UNOPS (TYPE) \
295  OCTAVE_SS_POW_OPS (TYPE, TYPE) \
296  OCTAVE_SS_INT_ARITH_OPS (ss, TYPE ## _, TYPE ## _, TYPE) \
297  OCTAVE_SS_INT_ARITH_OPS (ssx, TYPE ## _, , TYPE) \
298  OCTAVE_SS_INT_ARITH_OPS (sxs, , TYPE ## _, TYPE) \
299  OCTAVE_SS_INT_ARITH_OPS (ssfx, TYPE ## _, float_, TYPE) \
300  OCTAVE_SS_INT_ARITH_OPS (sfxs, float_, TYPE ## _, TYPE) \
301  OCTAVE_SS_INT_CMP_OPS (ss, TYPE ## _, TYPE ## _) \
302  OCTAVE_SS_INT_CMP_OPS (sx, TYPE ## _, ) \
303  OCTAVE_SS_INT_CMP_OPS (xs, , TYPE ## _) \
304  OCTAVE_SS_INT_CMP_OPS (sfx, TYPE ## _, float_) \
305  OCTAVE_SS_INT_CMP_OPS (fxs, float_, TYPE ## _) \
306  OCTAVE_SS_INT_BOOL_OPS (ss, TYPE ## _, TYPE ## _, octave_ ## TYPE (0), octave_ ## TYPE (0)) \
307  OCTAVE_SS_INT_BOOL_OPS (sx, TYPE ## _, , octave_ ## TYPE (0), 0) \
308  OCTAVE_SS_INT_BOOL_OPS (xs, , TYPE ## _, 0, octave_ ## TYPE (0)) \
309  OCTAVE_SS_INT_BOOL_OPS (sfx, TYPE ## _, float_, octave_ ## TYPE (0), 0) \
310  OCTAVE_SS_INT_BOOL_OPS (fxs, float_, TYPE ## _, 0, octave_ ## TYPE (0))
311 
312 // scalar by matrix ops.
313 #define OCTAVE_SM_INT_ARITH_OPS(PFX, TS, TM, TI) \
314  \
315  DEFINTNDBINOP_OP (PFX ## _add, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, +, TI) \
316  DEFINTNDBINOP_OP (PFX ## _sub, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, -, TI) \
317  DEFINTNDBINOP_OP (PFX ## _mul, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, *, TI) \
318  \
319  /* DEFBINOP (PFX ## _div, TS ## scalar, TM ## matrix) */ \
320  /* { */ \
321  /* OCTAVE_CAST_BASE_VALUE (const octave_ ## TS ## scalar&, v1, a1); */ \
322  /* OCTAVE_CAST_BASE_VALUE (const octave_ ## TM ## matrix&, v2, a2); */ \
323  /* */ \
324  /* Matrix m1 = v1.TM ## matrix_value (); */ \
325  /* Matrix m2 = v2.TM ## matrix_value (); */ \
326  /* */ \
327  /* return octave_value (xdiv (m1, m2)); */ \
328  /* } */ \
329  \
330  /* DEFBINOP_FN (PFX ## _pow, TS ## scalar, TM ## matrix, xpow) */ \
331  \
332  DEFBINOP (PFX ## _ldiv, TS ## scalar, TM ## matrix) \
333  { \
334  OCTAVE_CAST_BASE_VALUE (const octave_ ## TS ## scalar&, v1, a1); \
335  OCTAVE_CAST_BASE_VALUE (const octave_ ## TM ## matrix&, v2, a2); \
336  \
337  return octave_value (v2.TM ## array_value () / v1.TS ## scalar_value ()); \
338  } \
339  \
340  DEFINTNDBINOP_OP (PFX ## _el_mul, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, *, TI) \
341  DEFBINOP (PFX ## _el_div, TS ## scalar, TM ## matrix) \
342  { \
343  OCTAVE_CAST_BASE_VALUE (const octave_ ## TS ## scalar&, v1, a1); \
344  OCTAVE_CAST_BASE_VALUE (const octave_ ## TM ## matrix&, v2, a2); \
345  \
346  octave_value retval = octave_value (v1.TS ## scalar_value () / v2.TM ## array_value ()); \
347  return retval; \
348  } \
349  \
350  DEFINTNDBINOP_FN (PFX ## _el_pow, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, elem_xpow, TI, .^) \
351  \
352  DEFBINOP (PFX ## _el_ldiv, TS ## scalar, TM ## matrix) \
353  { \
354  OCTAVE_CAST_BASE_VALUE (const octave_ ## TS ## scalar&, v1, a1); \
355  OCTAVE_CAST_BASE_VALUE (const octave_ ## TM ## matrix&, v2, a2); \
356  \
357  return octave_value (v2.TM ## array_value () / v1.TS ## scalar_value ()); \
358  }
359 
360 #define OCTAVE_SM_INT_CMP_OPS(PFX, TS, TM) \
361  DEFNDBINOP_FN (PFX ## _lt, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_lt) \
362  DEFNDBINOP_FN (PFX ## _le, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_le) \
363  DEFNDBINOP_FN (PFX ## _eq, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_eq) \
364  DEFNDBINOP_FN (PFX ## _ge, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_ge) \
365  DEFNDBINOP_FN (PFX ## _gt, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_gt) \
366  DEFNDBINOP_FN (PFX ## _ne, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_ne)
367 
368 #define OCTAVE_SM_INT_BOOL_OPS(PFX, TS, TM) \
369  DEFNDBINOP_FN (PFX ## _el_and, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_and) \
370  DEFNDBINOP_FN (PFX ## _el_or, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_or) \
371  DEFNDBINOP_FN (PFX ## _el_and_not, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_and_not) \
372  DEFNDBINOP_FN (PFX ## _el_or_not, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_or_not)
373 
374 #define OCTAVE_SM_POW_OPS(T1, T2) \
375  static octave_value \
376  elem_xpow (const octave_ ## T1& a, const T2 ## NDArray& b) \
377  { \
378  T2 ## NDArray result (b.dims ()); \
379  for (int i = 0; i < b.numel (); i++) \
380  { \
381  octave_quit (); \
382  result (i) = pow (a, b(i)); \
383  } \
384  return octave_value (result); \
385  } \
386  \
387  static octave_value \
388  elem_xpow (const octave_ ## T1& a, const NDArray& b) \
389  { \
390  T1 ## NDArray result (b.dims ()); \
391  for (int i = 0; i < b.numel (); i++) \
392  { \
393  octave_quit (); \
394  result (i) = pow (a, b(i)); \
395  } \
396  return octave_value (result); \
397  } \
398  \
399  static octave_value \
400  elem_xpow (double a, const T2 ## NDArray& b) \
401  { \
402  T2 ## NDArray result (b.dims ()); \
403  for (int i = 0; i < b.numel (); i++) \
404  { \
405  octave_quit (); \
406  result (i) = pow (a, b(i)); \
407  } \
408  return octave_value (result); \
409  } \
410  \
411  static octave_value \
412  elem_xpow (const octave_ ## T1& a, const FloatNDArray& b) \
413  { \
414  T1 ## NDArray result (b.dims ()); \
415  for (int i = 0; i < b.numel (); i++) \
416  { \
417  octave_quit (); \
418  result (i) = powf (a, b(i)); \
419  } \
420  return octave_value (result); \
421  } \
422  \
423  static octave_value \
424  elem_xpow (float a, const T2 ## NDArray& b) \
425  { \
426  T2 ## NDArray result (b.dims ()); \
427  for (int i = 0; i < b.numel (); i++) \
428  { \
429  octave_quit (); \
430  result (i) = powf (a, b(i)); \
431  } \
432  return octave_value (result); \
433  }
434 
435 #define OCTAVE_SM_CONV(TS, TM) \
436  DEFCONV (TS ## s_ ## TM ## m_conv, TM ## scalar, TM ## matrix) \
437  { \
438  OCTAVE_CAST_BASE_VALUE (const octave_ ## TS ## scalar&, v, a); \
439  \
440  return new octave_ ## TM ## matrix (v.TM ## array_value ()); \
441  }
442 
443 #define OCTAVE_SM_INT_OPS(TYPE) \
444  OCTAVE_SM_POW_OPS (TYPE, TYPE) \
445  OCTAVE_SM_INT_ARITH_OPS (sm, TYPE ## _, TYPE ## _, TYPE) \
446  OCTAVE_SM_INT_ARITH_OPS (smx, TYPE ## _, , TYPE) \
447  OCTAVE_SM_INT_ARITH_OPS (sxm, , TYPE ## _, TYPE) \
448  OCTAVE_SM_INT_ARITH_OPS (smfx, TYPE ## _, float_, TYPE) \
449  OCTAVE_SM_INT_ARITH_OPS (sfxm, float_, TYPE ## _, TYPE) \
450  OCTAVE_SM_INT_CMP_OPS (sm, TYPE ## _, TYPE ## _) \
451  OCTAVE_SM_INT_CMP_OPS (xm, , TYPE ## _) \
452  OCTAVE_SM_INT_CMP_OPS (smx, TYPE ## _, ) \
453  OCTAVE_SM_INT_CMP_OPS (fxm, float_, TYPE ## _) \
454  OCTAVE_SM_INT_CMP_OPS (smfx, TYPE ## _, float_) \
455  OCTAVE_SM_INT_BOOL_OPS (sm, TYPE ## _, TYPE ## _) \
456  OCTAVE_SM_INT_BOOL_OPS (xm, , TYPE ## _) \
457  OCTAVE_SM_INT_BOOL_OPS (smx, TYPE ## _, ) \
458  OCTAVE_SM_INT_BOOL_OPS (fxm, float_, TYPE ## _) \
459  OCTAVE_SM_INT_BOOL_OPS (smfx, TYPE ## _, float_) \
460  OCTAVE_SM_CONV (TYPE ## _, TYPE ## _) \
461  OCTAVE_SM_CONV (TYPE ## _, complex_) \
462  OCTAVE_SM_CONV (TYPE ## _, float_complex_)
463 
464 // matrix by scalar ops.
465 #define OCTAVE_MS_INT_ARITH_OPS(PFX, TM, TS, TI) \
466  \
467  DEFINTNDBINOP_OP (PFX ## _add, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, +, TI) \
468  DEFINTNDBINOP_OP (PFX ## _sub, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, -, TI) \
469  DEFINTNDBINOP_OP (PFX ## _mul, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, *, TI) \
470  \
471  DEFBINOP (PFX ## _div, TM ## matrix, TS ## scalar) \
472  { \
473  OCTAVE_CAST_BASE_VALUE (const octave_ ## TM ## matrix&, v1, a1); \
474  OCTAVE_CAST_BASE_VALUE (const octave_ ## TS ## scalar&, v2, a2); \
475  \
476  return octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \
477  } \
478  \
479  /* DEFBINOP_FN (PFX ## _pow, TM ## matrix, TS ## scalar, xpow) */ \
480  \
481  /* DEFBINOP (PFX ## _ldiv, TM ## matrix, TS ## scalar) */ \
482  /* { */ \
483  /* OCTAVE_CAST_BASE_VALUE (const octave_ ## TM ## matrix&, v1, a1); */ \
484  /* OCTAVE_CAST_BASE_VALUE (const octave_ ## TS ## scalar&, v2, a2); */ \
485  /* */ \
486  /* Matrix m1 = v1.TM ## matrix_value (); */ \
487  /* Matrix m2 = v2.TM ## matrix_value (); */ \
488  /* */ \
489  /* return octave_value (xleftdiv (m1, m2)); */ \
490  /* } */ \
491  \
492  DEFINTNDBINOP_OP (PFX ## _el_mul, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, *, TI) \
493  \
494  DEFBINOP (PFX ## _el_div, TM ## matrix, TS ## scalar) \
495  { \
496  OCTAVE_CAST_BASE_VALUE (const octave_ ## TM ## matrix&, v1, a1); \
497  OCTAVE_CAST_BASE_VALUE (const octave_ ## TS ## scalar&, v2, a2); \
498  \
499  return octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \
500  } \
501  \
502  DEFINTNDBINOP_FN (PFX ## _el_pow, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, elem_xpow, TI, .^) \
503  \
504  DEFBINOP (PFX ## _el_ldiv, TM ## matrix, TS ## scalar) \
505  { \
506  OCTAVE_CAST_BASE_VALUE (const octave_ ## TM ## matrix&, v1, a1); \
507  OCTAVE_CAST_BASE_VALUE (const octave_ ## TS ## scalar&, v2, a2); \
508  \
509  octave_value retval = v2.TS ## scalar_value () / v1.TM ## array_value (); \
510  return retval; \
511  }
512 
513 #define OCTAVE_MS_INT_CMP_OPS(PFX, TM, TS) \
514  DEFNDBINOP_FN (PFX ## _lt, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_lt) \
515  DEFNDBINOP_FN (PFX ## _le, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_le) \
516  DEFNDBINOP_FN (PFX ## _eq, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_eq) \
517  DEFNDBINOP_FN (PFX ## _ge, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_ge) \
518  DEFNDBINOP_FN (PFX ## _gt, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_gt) \
519  DEFNDBINOP_FN (PFX ## _ne, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_ne)
520 
521 #define OCTAVE_MS_INT_BOOL_OPS(PFX, TM, TS) \
522  DEFNDBINOP_FN (PFX ## _el_and, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_and) \
523  DEFNDBINOP_FN (PFX ## _el_or, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_or) \
524  DEFNDBINOP_FN (PFX ## _el_not_and, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_not_and) \
525  DEFNDBINOP_FN (PFX ## _el_not_or, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_not_or)
526 
527 #define OCTAVE_MS_INT_ASSIGN_OPS(PFX, TM, TS, TE) \
528  DEFNDASSIGNOP_FN (PFX ## _assign, TM ## matrix, TS ## scalar, TM ## scalar, assign)
529 
530 #define OCTAVE_MS_INT_ASSIGNEQ_OPS(PFX, TM) \
531  DEFNDASSIGNOP_OP (PFX ## _assign_add, TM ## matrix, TM ## scalar, TM ## scalar, +=) \
532  DEFNDASSIGNOP_OP (PFX ## _assign_sub, TM ## matrix, TM ## scalar, TM ## scalar, -=) \
533  DEFNDASSIGNOP_OP (PFX ## _assign_mul, TM ## matrix, TM ## scalar, TM ## scalar, *=) \
534  DEFNDASSIGNOP_OP (PFX ## _assign_div, TM ## matrix, TM ## scalar, TM ## scalar, /=)
535 
536 #define OCTAVE_MS_POW_OPS(T1, T2) \
537  static octave_value \
538  elem_xpow (T1 ## NDArray a, octave_ ## T2 b) \
539  { \
540  T1 ## NDArray result (a.dims ()); \
541  for (int i = 0; i < a.numel (); i++) \
542  { \
543  octave_quit (); \
544  result (i) = pow (a(i), b); \
545  } \
546  return octave_value (result); \
547  } \
548  \
549  static octave_value \
550  elem_xpow (T1 ## NDArray a, double b) \
551  { \
552  T1 ## NDArray result (a.dims ()); \
553  for (int i = 0; i < a.numel (); i++) \
554  { \
555  octave_quit (); \
556  result (i) = pow (a(i), b); \
557  } \
558  return octave_value (result); \
559  } \
560  \
561  static octave_value \
562  elem_xpow (NDArray a, octave_ ## T2 b) \
563  { \
564  T2 ## NDArray result (a.dims ()); \
565  for (int i = 0; i < a.numel (); i++) \
566  { \
567  octave_quit (); \
568  result (i) = pow (a(i), b); \
569  } \
570  return octave_value (result); \
571  } \
572  \
573  static octave_value \
574  elem_xpow (T1 ## NDArray a, float b) \
575  { \
576  T1 ## NDArray result (a.dims ()); \
577  for (int i = 0; i < a.numel (); i++) \
578  { \
579  octave_quit (); \
580  result (i) = powf (a(i), b); \
581  } \
582  return octave_value (result); \
583  } \
584  \
585  static octave_value \
586  elem_xpow (FloatNDArray a, octave_ ## T2 b) \
587  { \
588  T2 ## NDArray result (a.dims ()); \
589  for (int i = 0; i < a.numel (); i++) \
590  { \
591  octave_quit (); \
592  result (i) = powf (a(i), b); \
593  } \
594  return octave_value (result); \
595  }
596 
597 #define OCTAVE_MS_INT_OPS(TYPE) \
598  OCTAVE_MS_POW_OPS (TYPE, TYPE) \
599  OCTAVE_MS_INT_ARITH_OPS (ms, TYPE ## _, TYPE ## _, TYPE) \
600  OCTAVE_MS_INT_ARITH_OPS (msx, TYPE ## _, , TYPE) \
601  OCTAVE_MS_INT_ARITH_OPS (mxs, , TYPE ## _, TYPE) \
602  OCTAVE_MS_INT_ARITH_OPS (msfx, TYPE ## _, float_, TYPE) \
603  OCTAVE_MS_INT_ARITH_OPS (mfxs, float_, TYPE ## _, TYPE) \
604  OCTAVE_MS_INT_CMP_OPS (ms, TYPE ## _, TYPE ## _) \
605  OCTAVE_MS_INT_CMP_OPS (mx, TYPE ## _, ) \
606  OCTAVE_MS_INT_CMP_OPS (mxs, , TYPE ## _) \
607  OCTAVE_MS_INT_CMP_OPS (mfx, TYPE ## _, float_) \
608  OCTAVE_MS_INT_CMP_OPS (mfxs, float_, TYPE ## _) \
609  OCTAVE_MS_INT_BOOL_OPS (ms, TYPE ## _, TYPE ## _) \
610  OCTAVE_MS_INT_BOOL_OPS (mx, TYPE ## _, ) \
611  OCTAVE_MS_INT_BOOL_OPS (mxs, , TYPE ## _) \
612  OCTAVE_MS_INT_BOOL_OPS (mfx, TYPE ## _, float_) \
613  OCTAVE_MS_INT_BOOL_OPS (mfxs, float_, TYPE ## _) \
614  OCTAVE_MS_INT_ASSIGN_OPS (ms, TYPE ## _, TYPE ## _, TYPE ## _) \
615  OCTAVE_MS_INT_ASSIGNEQ_OPS (mse, TYPE ## _) \
616  OCTAVE_MS_INT_ASSIGN_OPS (mx, TYPE ## _, , ) \
617  OCTAVE_MS_INT_ASSIGN_OPS (mfx, TYPE ## _, float_, float_)
618 
619 // matrix unary ops.
620 #define OCTAVE_M_INT_UNOPS(TYPE) \
621  \
622  DEFNDUNOP_OP (m_not, TYPE ## _matrix, TYPE ## _array, !) \
623  DEFNDUNOP_OP (m_uplus, TYPE ## _matrix, TYPE ## _array, /* no-op */) \
624  DEFUNOP (m_uminus, TYPE ## _matrix) \
625  { \
626  OCTAVE_CAST_BASE_VALUE (const octave_ ## TYPE ## _matrix&, v, a); \
627  octave_value retval = octave_value (- v. TYPE ## _array_value ()); \
628  return retval; \
629  } \
630  \
631  DEFUNOP (m_transpose, TYPE ## _matrix) \
632  { \
633  OCTAVE_CAST_BASE_VALUE (const octave_ ## TYPE ## _matrix&, v, a); \
634  \
635  if (v.ndims () > 2) \
636  error ("transpose not defined for N-D objects"); \
637  \
638  return octave_value (v.TYPE ## _array_value ().transpose ()); \
639  } \
640  \
641  DEFNCUNOP_METHOD (m_incr, TYPE ## _matrix, increment) \
642  DEFNCUNOP_METHOD (m_decr, TYPE ## _matrix, decrement) \
643  DEFNCUNOP_METHOD (m_changesign, TYPE ## _matrix, changesign)
644 
645 // matrix by matrix ops.
646 #define OCTAVE_MM_INT_ARITH_OPS(PFX, T1, T2, T3) \
647  \
648  DEFINTNDBINOP_OP (PFX ## _add, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, +, T3) \
649  DEFINTNDBINOP_OP (PFX ## _sub, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, -, T3) \
650  \
651  /* DEFBINOP_OP (PFX ## _mul, T1 ## matrix, T2 ## matrix, *) */ \
652  /* DEFBINOP_FN (PFX ## _div, T1 ## matrix, T2 ## matrix, xdiv) */ \
653  \
654  DEFBINOPX (PFX ## _pow, T1 ## matrix, T2 ## matrix) \
655  { \
656  error ("can't do A ^ B for A and B both matrices"); \
657  } \
658  \
659  /* DEFBINOP_FN (PFX ## _ldiv, T1 ## matrix, T2 ## matrix, xleftdiv) */ \
660  \
661  DEFINTNDBINOP_FN (PFX ## _el_mul, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, product, T3, .*) \
662  \
663  DEFINTNDBINOP_FN (PFX ## _el_div, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, quotient, T3, ./) \
664  \
665  DEFINTNDBINOP_FN (PFX ## _el_pow, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, elem_xpow, T3, .^) \
666  \
667  DEFBINOP (PFX ## _el_ldiv, T1 ## matrix, T2 ## matrix) \
668  { \
669  OCTAVE_CAST_BASE_VALUE (const octave_ ## T1 ## matrix&, v1, a1); \
670  OCTAVE_CAST_BASE_VALUE (const octave_ ## T2 ## matrix&, v2, a2); \
671  \
672  octave_value retval = octave_value (quotient (v2.T2 ## array_value (), v1.T1 ## array_value ())); \
673  return retval; \
674  }
675 
676 #define OCTAVE_MM_INT_CMP_OPS(PFX, T1, T2) \
677  DEFNDBINOP_FN (PFX ## _lt, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_lt) \
678  DEFNDBINOP_FN (PFX ## _le, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_le) \
679  DEFNDBINOP_FN (PFX ## _eq, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_eq) \
680  DEFNDBINOP_FN (PFX ## _ge, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_ge) \
681  DEFNDBINOP_FN (PFX ## _gt, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_gt) \
682  DEFNDBINOP_FN (PFX ## _ne, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_ne)
683 
684 #define OCTAVE_MM_INT_BOOL_OPS(PFX, T1, T2) \
685  DEFNDBINOP_FN (PFX ## _el_and, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_and) \
686  DEFNDBINOP_FN (PFX ## _el_or, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_or) \
687  DEFNDBINOP_FN (PFX ## _el_not_and, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_not_and) \
688  DEFNDBINOP_FN (PFX ## _el_not_or, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_not_or) \
689  DEFNDBINOP_FN (PFX ## _el_and_not, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_and_not) \
690  DEFNDBINOP_FN (PFX ## _el_or_not, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_or_not)
691 
692 #define OCTAVE_MM_INT_ASSIGN_OPS(PFX, TLHS, TRHS, TE) \
693  DEFNDASSIGNOP_FN (PFX ## _assign, TLHS ## matrix, TRHS ## matrix, TLHS ## array, assign)
694 
695 #define OCTAVE_MM_INT_ASSIGNEQ_OPS(PFX, TM) \
696  DEFNDASSIGNOP_OP (PFX ## _assign_add, TM ## matrix, TM ## matrix, TM ## array, +=) \
697  DEFNDASSIGNOP_OP (PFX ## _assign_sub, TM ## matrix, TM ## matrix, TM ## array, -=) \
698  DEFNDASSIGNOP_FNOP (PFX ## _assign_el_mul, TM ## matrix, TM ## matrix, TM ## array, product_eq) \
699  DEFNDASSIGNOP_FNOP (PFX ## _assign_el_div, TM ## matrix, TM ## matrix, TM ## array, quotient_eq)
700 
701 #define OCTAVE_MM_POW_OPS(T1, T2) \
702  static octave_value \
703  elem_xpow (const T1 ## NDArray& a, const T2 ## NDArray& b) \
704  { \
705  dim_vector a_dims = a.dims (); \
706  dim_vector b_dims = b.dims (); \
707  if (a_dims != b_dims) \
708  { \
709  if (! is_valid_bsxfun ("operator .^", a_dims, b_dims)) \
710  octave::err_nonconformant ("operator .^", a_dims, b_dims); \
711  \
712  return bsxfun_pow (a, b); \
713  } \
714  T1 ## NDArray result (a_dims); \
715  for (int i = 0; i < a.numel (); i++) \
716  { \
717  octave_quit (); \
718  result (i) = pow (a(i), b(i)); \
719  } \
720  return octave_value (result); \
721  } \
722  \
723  static octave_value \
724  elem_xpow (const T1 ## NDArray& a, const NDArray& b) \
725  { \
726  dim_vector a_dims = a.dims (); \
727  dim_vector b_dims = b.dims (); \
728  if (a_dims != b_dims) \
729  { \
730  if (! is_valid_bsxfun ("operator .^", a_dims, b_dims)) \
731  octave::err_nonconformant ("operator .^", a_dims, b_dims); \
732  \
733  return bsxfun_pow (a, b); \
734  } \
735  T1 ## NDArray result (a_dims); \
736  for (int i = 0; i < a.numel (); i++) \
737  { \
738  octave_quit (); \
739  result (i) = pow (a(i), b(i)); \
740  } \
741  return octave_value (result); \
742  } \
743  \
744  static octave_value \
745  elem_xpow (const NDArray& a, const T2 ## NDArray& b) \
746  { \
747  dim_vector a_dims = a.dims (); \
748  dim_vector b_dims = b.dims (); \
749  if (a_dims != b_dims) \
750  { \
751  if (! is_valid_bsxfun ("operator .^", a_dims, b_dims)) \
752  octave::err_nonconformant ("operator .^", a_dims, b_dims); \
753  \
754  return bsxfun_pow (a, b); \
755  } \
756  T2 ## NDArray result (a_dims); \
757  for (int i = 0; i < a.numel (); i++) \
758  { \
759  octave_quit (); \
760  result (i) = pow (a(i), b(i)); \
761  } \
762  return octave_value (result); \
763  } \
764  \
765  static octave_value \
766  elem_xpow (const T1 ## NDArray& a, const FloatNDArray& b) \
767  { \
768  dim_vector a_dims = a.dims (); \
769  dim_vector b_dims = b.dims (); \
770  if (a_dims != b_dims) \
771  { \
772  if (! is_valid_bsxfun ("operator .^", a_dims, b_dims)) \
773  octave::err_nonconformant ("operator .^", a_dims, b_dims); \
774  \
775  return bsxfun_pow (a, b); \
776  } \
777  T1 ## NDArray result (a_dims); \
778  for (int i = 0; i < a.numel (); i++) \
779  { \
780  octave_quit (); \
781  result (i) = powf (a(i), b(i)); \
782  } \
783  return octave_value (result); \
784  } \
785  \
786  static octave_value \
787  elem_xpow (const FloatNDArray& a, const T2 ## NDArray& b) \
788  { \
789  dim_vector a_dims = a.dims (); \
790  dim_vector b_dims = b.dims (); \
791  if (a_dims != b_dims) \
792  { \
793  if (! is_valid_bsxfun ("operator .^", a_dims, b_dims)) \
794  octave::err_nonconformant ("operator .^", a_dims, b_dims); \
795  \
796  return bsxfun_pow (a, b); \
797  } \
798  T2 ## NDArray result (a_dims); \
799  for (int i = 0; i < a.numel (); i++) \
800  { \
801  octave_quit (); \
802  result (i) = powf (a(i), b(i)); \
803  } \
804  return octave_value (result); \
805  }
806 
807 #define OCTAVE_MM_CONV(T1, T2) \
808  DEFCONV (T1 ## m_ ## T2 ## m_conv, T1 ## matrix, T2 ## matrix) \
809  { \
810  OCTAVE_CAST_BASE_VALUE (const octave_ ## T1 ## matrix&, v, a); \
811  \
812  return new octave_ ## T2 ## matrix (v.T2 ## array_value ()); \
813  }
814 
815 #define OCTAVE_MM_INT_OPS(TYPE) \
816  OCTAVE_M_INT_UNOPS (TYPE) \
817  OCTAVE_MM_POW_OPS (TYPE, TYPE) \
818  OCTAVE_MM_INT_ARITH_OPS (mm, TYPE ## _, TYPE ## _, TYPE) \
819  OCTAVE_MM_INT_ARITH_OPS (mmx, TYPE ## _, , TYPE) \
820  OCTAVE_MM_INT_ARITH_OPS (mxm, , TYPE ## _, TYPE) \
821  OCTAVE_MM_INT_ARITH_OPS (mmfx, TYPE ## _, float_, TYPE) \
822  OCTAVE_MM_INT_ARITH_OPS (mfxm, float_, TYPE ## _, TYPE) \
823  OCTAVE_MM_INT_CMP_OPS (mm, TYPE ## _, TYPE ## _) \
824  OCTAVE_MM_INT_CMP_OPS (mmx, TYPE ## _, ) \
825  OCTAVE_MM_INT_CMP_OPS (mfxm, float_, TYPE ## _) \
826  OCTAVE_MM_INT_CMP_OPS (mmfx, TYPE ## _, float_) \
827  OCTAVE_MM_INT_CMP_OPS (mxm, , TYPE ## _) \
828  OCTAVE_MM_INT_BOOL_OPS (mm, TYPE ## _, TYPE ## _) \
829  OCTAVE_MM_INT_BOOL_OPS (mmx, TYPE ## _, ) \
830  OCTAVE_MM_INT_BOOL_OPS (mxm, , TYPE ## _) \
831  OCTAVE_MM_INT_BOOL_OPS (mmfx, TYPE ## _, float_) \
832  OCTAVE_MM_INT_BOOL_OPS (mfxm, float_, TYPE ## _) \
833  OCTAVE_MM_INT_ASSIGN_OPS (mm, TYPE ## _, TYPE ## _, TYPE ## _) \
834  OCTAVE_MM_INT_ASSIGNEQ_OPS (mme, TYPE ## _) \
835  OCTAVE_MM_INT_ASSIGN_OPS (mmx, TYPE ## _, , ) \
836  OCTAVE_MM_INT_ASSIGN_OPS (mmfx, TYPE ## _, float_, float_) \
837  OCTAVE_MM_CONV(TYPE ## _, complex_) \
838  OCTAVE_MM_CONV(TYPE ## _, float_complex_)
839 
840 #define OCTAVE_RE_INT_ASSIGN_OPS(TYPE) \
841  DEFNDASSIGNOP_FN (TYPE ## ms_assign, matrix, TYPE ## _scalar, array, assign) \
842  DEFNDASSIGNOP_FN (TYPE ## mm_assign, matrix, TYPE ## _matrix, array, assign)
843 
844 #define OCTAVE_FLT_RE_INT_ASSIGN_OPS(TYPE) \
845  DEFNDASSIGNOP_FN (TYPE ## fms_assign, float_matrix, TYPE ## _scalar, float_array, assign) \
846  DEFNDASSIGNOP_FN (TYPE ## fmm_assign, float_matrix, TYPE ## _matrix, float_array, assign)
847 
848 #define OCTAVE_CX_INT_ASSIGN_OPS(TYPE) \
849  DEFNDASSIGNOP_FN (TYPE ## cms_assign, complex_matrix, TYPE ## _scalar, complex_array, assign) \
850  DEFNDASSIGNOP_FN (TYPE ## cmm_assign, complex_matrix, TYPE ## _matrix, complex_array, assign)
851 
852 #define OCTAVE_FLT_CX_INT_ASSIGN_OPS(TYPE) \
853  DEFNDASSIGNOP_FN (TYPE ## fcms_assign, float_complex_matrix, TYPE ## _scalar, float_complex_array, assign) \
854  DEFNDASSIGNOP_FN (TYPE ## fcmm_assign, float_complex_matrix, TYPE ## _matrix, float_complex_array, assign)
855 
856 #define OCTAVE_INT_NULL_ASSIGN_OPS(TYPE) \
857  DEFNULLASSIGNOP_FN (TYPE ## null_assign, TYPE ## _matrix, delete_elements)
858 
859 #define OCTAVE_INT_OPS(TYPE) \
860  OCTAVE_SS_INT_OPS (TYPE) \
861  OCTAVE_SM_INT_OPS (TYPE) \
862  OCTAVE_MS_INT_OPS (TYPE) \
863  OCTAVE_MM_INT_OPS (TYPE) \
864  OCTAVE_CONCAT_FN (TYPE) \
865  OCTAVE_RE_INT_ASSIGN_OPS (TYPE) \
866  OCTAVE_FLT_RE_INT_ASSIGN_OPS (TYPE) \
867  OCTAVE_CX_INT_ASSIGN_OPS (TYPE) \
868  OCTAVE_FLT_CX_INT_ASSIGN_OPS (TYPE) \
869  OCTAVE_INT_NULL_ASSIGN_OPS(TYPE)
870 
871 #define OCTAVE_INSTALL_S_INT_UNOPS(TYPE) \
872  INSTALL_UNOP_TI (ti, op_not, octave_ ## TYPE ## _scalar, s_not); \
873  INSTALL_UNOP_TI (ti, op_uplus, octave_ ## TYPE ## _scalar, s_uplus); \
874  INSTALL_UNOP_TI (ti, op_uminus, octave_ ## TYPE ## _scalar, s_uminus); \
875  INSTALL_UNOP_TI (ti, op_transpose, octave_ ## TYPE ## _scalar, s_transpose); \
876  INSTALL_UNOP_TI (ti, op_hermitian, octave_ ## TYPE ## _scalar, s_hermitian); \
877  \
878  INSTALL_NCUNOP_TI (ti, op_incr, octave_ ## TYPE ## _scalar, s_incr); \
879  INSTALL_NCUNOP_TI (ti, op_decr, octave_ ## TYPE ## _scalar, s_decr);
880 
881 #define OCTAVE_INSTALL_SS_INT_ARITH_OPS(PFX, T1, T2) \
882  INSTALL_BINOP_TI (ti, op_add, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _add); \
883  INSTALL_BINOP_TI (ti, op_sub, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _sub); \
884  INSTALL_BINOP_TI (ti, op_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _mul); \
885  INSTALL_BINOP_TI (ti, op_div, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _div); \
886  INSTALL_BINOP_TI (ti, op_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _pow); \
887  INSTALL_BINOP_TI (ti, op_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ldiv); \
888  INSTALL_BINOP_TI (ti, op_el_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_mul); \
889  INSTALL_BINOP_TI (ti, op_el_div, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_div); \
890  INSTALL_BINOP_TI (ti, op_el_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_pow); \
891  INSTALL_BINOP_TI (ti, op_el_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_ldiv);
892 
893 #define OCTAVE_INSTALL_SS_INT_CMP_OPS(PFX, T1, T2) \
894  INSTALL_BINOP_TI (ti, op_lt, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _lt); \
895  INSTALL_BINOP_TI (ti, op_le, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _le); \
896  INSTALL_BINOP_TI (ti, op_eq, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _eq); \
897  INSTALL_BINOP_TI (ti, op_ge, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ge); \
898  INSTALL_BINOP_TI (ti, op_gt, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _gt); \
899  INSTALL_BINOP_TI (ti, op_ne, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ne);
900 
901 #define OCTAVE_INSTALL_SS_INT_BOOL_OPS(PFX, T1, T2) \
902  INSTALL_BINOP_TI (ti, op_el_and, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_and); \
903  INSTALL_BINOP_TI (ti, op_el_or, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_or);
904 
905 #define OCTAVE_INSTALL_SS_INT_OPS(TYPE) \
906  OCTAVE_INSTALL_S_INT_UNOPS (TYPE) \
907  OCTAVE_INSTALL_SS_INT_ARITH_OPS (ss, TYPE ## _, TYPE ## _) \
908  OCTAVE_INSTALL_SS_INT_ARITH_OPS (ssx, TYPE ## _, ) \
909  OCTAVE_INSTALL_SS_INT_ARITH_OPS (sxs, , TYPE ## _) \
910  OCTAVE_INSTALL_SS_INT_ARITH_OPS (ssfx, TYPE ## _, float_) \
911  OCTAVE_INSTALL_SS_INT_ARITH_OPS (sfxs, float_, TYPE ## _) \
912  OCTAVE_INSTALL_SS_INT_CMP_OPS (ss, TYPE ## _, TYPE ## _) \
913  OCTAVE_INSTALL_SS_INT_CMP_OPS (sx, TYPE ## _, ) \
914  OCTAVE_INSTALL_SS_INT_CMP_OPS (xs, , TYPE ## _) \
915  OCTAVE_INSTALL_SS_INT_CMP_OPS (sfx, TYPE ## _, float_) \
916  OCTAVE_INSTALL_SS_INT_CMP_OPS (fxs, float_, TYPE ## _) \
917  OCTAVE_INSTALL_SS_INT_BOOL_OPS (ss, TYPE ## _, TYPE ## _) \
918  OCTAVE_INSTALL_SS_INT_BOOL_OPS (sx, TYPE ## _, ) \
919  OCTAVE_INSTALL_SS_INT_BOOL_OPS (xs, , TYPE ## _) \
920  OCTAVE_INSTALL_SS_INT_BOOL_OPS (sfx, TYPE ## _, float_) \
921  OCTAVE_INSTALL_SS_INT_BOOL_OPS (fxs, float_, TYPE ## _) \
922  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix) \
923  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _scalar, octave_scalar, octave_ ## TYPE ## _matrix) \
924  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _scalar, octave_float_scalar, octave_ ## TYPE ## _matrix) \
925  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _scalar, octave_complex_scalar, octave_complex_matrix) \
926  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _scalar, octave_float_complex_scalar, octave_float_complex_matrix)
927 
928 #define OCTAVE_INSTALL_SM_INT_ARITH_OPS(PFX, T1, T2) \
929  INSTALL_BINOP_TI (ti, op_add, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _add); \
930  INSTALL_BINOP_TI (ti, op_sub, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _sub); \
931  INSTALL_BINOP_TI (ti, op_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _mul); \
932  /* INSTALL_BINOP_TI (ti, op_div, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _div); */ \
933  /* INSTALL_BINOP_TI (ti, op_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _pow); */ \
934  INSTALL_BINOP_TI (ti, op_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ldiv); \
935  INSTALL_BINOP_TI (ti, op_el_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_mul); \
936  INSTALL_BINOP_TI (ti, op_el_div, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_div); \
937  INSTALL_BINOP_TI (ti, op_el_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_pow); \
938  INSTALL_BINOP_TI (ti, op_el_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_ldiv);
939 
940 #define OCTAVE_INSTALL_SM_INT_CMP_OPS(PFX, T1, T2) \
941  INSTALL_BINOP_TI (ti, op_lt, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _lt); \
942  INSTALL_BINOP_TI (ti, op_le, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _le); \
943  INSTALL_BINOP_TI (ti, op_eq, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _eq); \
944  INSTALL_BINOP_TI (ti, op_ge, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ge); \
945  INSTALL_BINOP_TI (ti, op_gt, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _gt); \
946  INSTALL_BINOP_TI (ti, op_ne, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ne);
947 
948 #define OCTAVE_INSTALL_SM_INT_BOOL_OPS(PFX, T1, T2) \
949  INSTALL_BINOP_TI (ti, op_el_and, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_and); \
950  INSTALL_BINOP_TI (ti, op_el_or, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_or); \
951  INSTALL_BINOP_TI (ti, op_el_and_not, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_and_not); \
952  INSTALL_BINOP_TI (ti, op_el_or_not, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_or_not);
953 
954 #define OCTAVE_INSTALL_SM_INT_OPS(TYPE) \
955  OCTAVE_INSTALL_SM_INT_ARITH_OPS (sm, TYPE ## _, TYPE ## _) \
956  OCTAVE_INSTALL_SM_INT_ARITH_OPS (smx, TYPE ## _, ) \
957  OCTAVE_INSTALL_SM_INT_ARITH_OPS (sxm, , TYPE ## _) \
958  OCTAVE_INSTALL_SM_INT_ARITH_OPS (smfx, TYPE ## _, float_) \
959  OCTAVE_INSTALL_SM_INT_ARITH_OPS (sfxm, float_, TYPE ## _) \
960  OCTAVE_INSTALL_SM_INT_CMP_OPS (sm, TYPE ## _, TYPE ## _) \
961  OCTAVE_INSTALL_SM_INT_CMP_OPS (xm, , TYPE ## _) \
962  OCTAVE_INSTALL_SM_INT_CMP_OPS (smx, TYPE ## _, ) \
963  OCTAVE_INSTALL_SM_INT_CMP_OPS (fxm, float_, TYPE ## _) \
964  OCTAVE_INSTALL_SM_INT_CMP_OPS (smfx, TYPE ## _, float_) \
965  OCTAVE_INSTALL_SM_INT_BOOL_OPS (sm, TYPE ## _, TYPE ## _) \
966  OCTAVE_INSTALL_SM_INT_BOOL_OPS (xm, , TYPE ## _) \
967  OCTAVE_INSTALL_SM_INT_BOOL_OPS (smx, TYPE ## _, ) \
968  OCTAVE_INSTALL_SM_INT_BOOL_OPS (fxm, float_, TYPE ## _) \
969  OCTAVE_INSTALL_SM_INT_BOOL_OPS (smfx, TYPE ## _, float_) \
970  INSTALL_WIDENOP_TI (ti, octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, TYPE ## _s_ ## TYPE ## _m_conv) \
971  INSTALL_WIDENOP_TI (ti, octave_ ## TYPE ## _scalar, octave_complex_matrix, TYPE ## _s_complex_m_conv) \
972  INSTALL_WIDENOP_TI (ti, octave_ ## TYPE ## _scalar, octave_float_complex_matrix, TYPE ## _s_float_complex_m_conv) \
973  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _matrix) \
974  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _scalar, octave_matrix, octave_ ## TYPE ## _matrix) \
975  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _scalar, octave_float_matrix, octave_ ## TYPE ## _matrix) \
976  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _scalar, octave_complex_matrix, octave_complex_matrix) \
977  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _scalar, octave_float_complex_matrix, octave_float_complex_matrix)
978 
979 #define OCTAVE_INSTALL_MS_INT_ARITH_OPS(PFX, T1, T2) \
980  INSTALL_BINOP_TI (ti, op_add, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _add); \
981  INSTALL_BINOP_TI (ti, op_sub, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _sub); \
982  INSTALL_BINOP_TI (ti, op_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _mul); \
983  INSTALL_BINOP_TI (ti, op_div, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _div); \
984  /* INSTALL_BINOP_TI (ti, op_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _pow); */ \
985  /* INSTALL_BINOP_TI (ti, op_ldiv, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ldiv); */ \
986  \
987  INSTALL_BINOP_TI (ti, op_el_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_mul); \
988  INSTALL_BINOP_TI (ti, op_el_div, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_div); \
989  INSTALL_BINOP_TI (ti, op_el_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_pow); \
990  INSTALL_BINOP_TI (ti, op_el_ldiv, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_ldiv);
991 
992 #define OCTAVE_INSTALL_MS_INT_CMP_OPS(PFX, T1, T2) \
993  INSTALL_BINOP_TI (ti, op_lt, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _lt); \
994  INSTALL_BINOP_TI (ti, op_le, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _le); \
995  INSTALL_BINOP_TI (ti, op_eq, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _eq); \
996  INSTALL_BINOP_TI (ti, op_ge, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ge); \
997  INSTALL_BINOP_TI (ti, op_gt, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _gt); \
998  INSTALL_BINOP_TI (ti, op_ne, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ne);
999 
1000 #define OCTAVE_INSTALL_MS_INT_BOOL_OPS(PFX, T1, T2) \
1001  INSTALL_BINOP_TI (ti, op_el_and, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_and); \
1002  INSTALL_BINOP_TI (ti, op_el_or, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_or); \
1003  INSTALL_BINOP_TI (ti, op_el_not_and, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_not_and); \
1004  INSTALL_BINOP_TI (ti, op_el_not_or, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_not_or);
1005 
1006 #define OCTAVE_INSTALL_MS_INT_ASSIGN_OPS(PFX, TLHS, TRHS) \
1007  INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign)
1008 
1009 #define OCTAVE_INSTALL_MS_INT_ASSIGNEQ_OPS(PFX, TLHS, TRHS) \
1010  INSTALL_ASSIGNOP_TI (ti, op_add_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_add) \
1011  INSTALL_ASSIGNOP_TI (ti, op_sub_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_sub) \
1012  INSTALL_ASSIGNOP_TI (ti, op_mul_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_mul) \
1013  INSTALL_ASSIGNOP_TI (ti, op_div_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_div)
1014 
1015 #define OCTAVE_INSTALL_MS_INT_OPS(TYPE) \
1016  OCTAVE_INSTALL_MS_INT_ARITH_OPS (ms, TYPE ## _, TYPE ## _) \
1017  OCTAVE_INSTALL_MS_INT_ARITH_OPS (msx, TYPE ## _, ) \
1018  OCTAVE_INSTALL_MS_INT_ARITH_OPS (mxs, , TYPE ## _) \
1019  OCTAVE_INSTALL_MS_INT_ARITH_OPS (msfx, TYPE ## _, float_) \
1020  OCTAVE_INSTALL_MS_INT_ARITH_OPS (mfxs, float_, TYPE ## _) \
1021  OCTAVE_INSTALL_MS_INT_CMP_OPS (ms, TYPE ## _, TYPE ## _) \
1022  OCTAVE_INSTALL_MS_INT_CMP_OPS (mx, TYPE ## _, ) \
1023  OCTAVE_INSTALL_MS_INT_CMP_OPS (mxs, , TYPE ## _) \
1024  OCTAVE_INSTALL_MS_INT_CMP_OPS (mfx, TYPE ## _, float_) \
1025  OCTAVE_INSTALL_MS_INT_CMP_OPS (mfxs, float_, TYPE ## _) \
1026  OCTAVE_INSTALL_MS_INT_BOOL_OPS (ms, TYPE ## _, TYPE ## _) \
1027  OCTAVE_INSTALL_MS_INT_BOOL_OPS (mx, TYPE ## _, ) \
1028  OCTAVE_INSTALL_MS_INT_BOOL_OPS (mxs, , TYPE ## _) \
1029  OCTAVE_INSTALL_MS_INT_BOOL_OPS (mfx, TYPE ## _, float_) \
1030  OCTAVE_INSTALL_MS_INT_BOOL_OPS (mfxs, float_, TYPE ## _) \
1031  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (ms, TYPE ## _, TYPE ## _) \
1032  OCTAVE_INSTALL_MS_INT_ASSIGNEQ_OPS (mse, TYPE ## _, TYPE ## _) \
1033  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mx, TYPE ## _, ) \
1034  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mfx, TYPE ## _, float_) \
1035  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _matrix, octave_complex_scalar, octave_complex_matrix) \
1036  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _matrix, octave_float_complex_scalar, octave_float_complex_matrix)
1037 
1038 #define OCTAVE_INSTALL_M_INT_UNOPS(TYPE) \
1039  INSTALL_UNOP_TI (ti, op_not, octave_ ## TYPE ## _matrix, m_not); \
1040  INSTALL_UNOP_TI (ti, op_uplus, octave_ ## TYPE ## _matrix, m_uplus); \
1041  INSTALL_UNOP_TI (ti, op_uminus, octave_ ## TYPE ## _matrix, m_uminus); \
1042  INSTALL_UNOP_TI (ti, op_transpose, octave_ ## TYPE ## _matrix, m_transpose); \
1043  INSTALL_UNOP_TI (ti, op_hermitian, octave_ ## TYPE ## _matrix, m_transpose); \
1044  \
1045  INSTALL_NCUNOP_TI (ti, op_incr, octave_ ## TYPE ## _matrix, m_incr); \
1046  INSTALL_NCUNOP_TI (ti, op_decr, octave_ ## TYPE ## _matrix, m_decr); \
1047  INSTALL_NCUNOP_TI (ti, op_uminus, octave_ ## TYPE ## _matrix, m_changesign);
1048 
1049 #define OCTAVE_INSTALL_MM_INT_ARITH_OPS(PFX, T1, T2) \
1050  INSTALL_BINOP_TI (ti, op_add, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _add); \
1051  INSTALL_BINOP_TI (ti, op_sub, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _sub); \
1052  /* INSTALL_BINOP_TI (ti, op_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _mul); */ \
1053  /* INSTALL_BINOP_TI (ti, op_div, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _div); */ \
1054  INSTALL_BINOP_TI (ti, op_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _pow); \
1055  /* INSTALL_BINOP_TI (ti, op_ldiv, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_ldiv); */ \
1056  INSTALL_BINOP_TI (ti, op_el_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_mul); \
1057  INSTALL_BINOP_TI (ti, op_el_div, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_div); \
1058  INSTALL_BINOP_TI (ti, op_el_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_pow); \
1059  INSTALL_BINOP_TI (ti, op_el_ldiv, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_ldiv);
1060 
1061 #define OCTAVE_INSTALL_MM_INT_CMP_OPS(PFX, T1, T2) \
1062  INSTALL_BINOP_TI (ti, op_lt, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _lt); \
1063  INSTALL_BINOP_TI (ti, op_le, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _le); \
1064  INSTALL_BINOP_TI (ti, op_eq, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _eq); \
1065  INSTALL_BINOP_TI (ti, op_ge, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _ge); \
1066  INSTALL_BINOP_TI (ti, op_gt, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _gt); \
1067  INSTALL_BINOP_TI (ti, op_ne, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _ne);
1068 
1069 #define OCTAVE_INSTALL_MM_INT_BOOL_OPS(PFX, T1, T2) \
1070  INSTALL_BINOP_TI (ti, op_el_and, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_and); \
1071  INSTALL_BINOP_TI (ti, op_el_or, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_or); \
1072  INSTALL_BINOP_TI (ti, op_el_not_and, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_not_and); \
1073  INSTALL_BINOP_TI (ti, op_el_not_or, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_not_or); \
1074  INSTALL_BINOP_TI (ti, op_el_and_not, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_and_not); \
1075  INSTALL_BINOP_TI (ti, op_el_or_not, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_or_not);
1076 
1077 #define OCTAVE_INSTALL_MM_INT_ASSIGN_OPS(PFX, TLHS, TRHS) \
1078  INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign)
1079 
1080 #define OCTAVE_INSTALL_MM_INT_ASSIGNEQ_OPS(PFX, TLHS, TRHS) \
1081  INSTALL_ASSIGNOP_TI (ti, op_add_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_add) \
1082  INSTALL_ASSIGNOP_TI (ti, op_sub_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_sub) \
1083  INSTALL_ASSIGNOP_TI (ti, op_el_mul_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_el_mul) \
1084  INSTALL_ASSIGNOP_TI (ti, op_el_div_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_el_div)
1085 
1086 #define OCTAVE_INSTALL_MM_INT_OPS(TYPE) \
1087  OCTAVE_INSTALL_M_INT_UNOPS (TYPE) \
1088  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mm, TYPE ##_, TYPE ## _) \
1089  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mmx, TYPE ##_, ) \
1090  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mxm, , TYPE ##_) \
1091  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mmfx, TYPE ##_, float_) \
1092  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mfxm, float_, TYPE ##_) \
1093  OCTAVE_INSTALL_MM_INT_CMP_OPS (mm, TYPE ## _, TYPE ## _) \
1094  OCTAVE_INSTALL_MM_INT_CMP_OPS (mmx, TYPE ## _, ) \
1095  OCTAVE_INSTALL_MM_INT_CMP_OPS (mxm, , TYPE ## _) \
1096  OCTAVE_INSTALL_MM_INT_CMP_OPS (mmfx, TYPE ## _, float_) \
1097  OCTAVE_INSTALL_MM_INT_CMP_OPS (mfxm, float_, TYPE ## _) \
1098  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mm, TYPE ## _, TYPE ## _) \
1099  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mmx, TYPE ## _, ) \
1100  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mxm, , TYPE ## _) \
1101  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mmfx, TYPE ## _, float_) \
1102  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mfxm, float_, TYPE ## _) \
1103  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mm, TYPE ## _, TYPE ## _) \
1104  OCTAVE_INSTALL_MM_INT_ASSIGNEQ_OPS (mme, TYPE ## _, TYPE ## _) \
1105  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmx, TYPE ## _, ) \
1106  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmfx, TYPE ## _, float_) \
1107  INSTALL_WIDENOP_TI (ti, octave_ ## TYPE ## _matrix, octave_complex_matrix, TYPE ## _m_complex_m_conv) \
1108  INSTALL_WIDENOP_TI (ti, octave_ ## TYPE ## _matrix, octave_float_complex_matrix, TYPE ## _m_float_complex_m_conv) \
1109  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _matrix, octave_complex_matrix, octave_complex_matrix) \
1110  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _matrix, octave_float_complex_matrix, octave_float_complex_matrix)
1111 
1112 #define OCTAVE_INSTALL_RE_INT_ASSIGN_OPS(TYPE) \
1113  INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_matrix, octave_ ## TYPE ## _scalar, TYPE ## ms_assign) \
1114  INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_matrix, octave_ ## TYPE ## _matrix, TYPE ## mm_assign) \
1115  INSTALL_ASSIGNCONV_TI (ti, octave_scalar, octave_ ## TYPE ## _scalar, octave_matrix) \
1116  INSTALL_ASSIGNCONV_TI (ti, octave_matrix, octave_ ## TYPE ## _matrix, octave_matrix)
1117 
1118 #define OCTAVE_INSTALL_FLT_RE_INT_ASSIGN_OPS(TYPE) \
1119  INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_float_matrix, octave_ ## TYPE ## _scalar, TYPE ## fms_assign) \
1120  INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_float_matrix, octave_ ## TYPE ## _matrix, TYPE ## fmm_assign) \
1121  INSTALL_ASSIGNCONV_TI (ti, octave_float_scalar, octave_ ## TYPE ## _scalar, octave_float_matrix) \
1122  INSTALL_ASSIGNCONV_TI (ti, octave_float_matrix, octave_ ## TYPE ## _matrix, octave_float_matrix)
1123 
1124 #define OCTAVE_INSTALL_CX_INT_ASSIGN_OPS(TYPE) \
1125  INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_complex_matrix, octave_ ## TYPE ## _scalar, TYPE ## cms_assign) \
1126  INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_complex_matrix, octave_ ## TYPE ## _matrix, TYPE ## cmm_assign) \
1127  INSTALL_ASSIGNCONV_TI (ti, octave_complex_scalar, octave_ ## TYPE ## _scalar, octave_complex_matrix) \
1128  INSTALL_ASSIGNCONV_TI (ti, octave_complex_matrix, octave_ ## TYPE ## _matrix, octave_complex_matrix)
1129 
1130 #define OCTAVE_INSTALL_FLT_CX_INT_ASSIGN_OPS(TYPE) \
1131  INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_float_complex_matrix, octave_ ## TYPE ## _scalar, TYPE ## fcms_assign) \
1132  INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_float_complex_matrix, octave_ ## TYPE ## _matrix, TYPE ## fcmm_assign) \
1133  INSTALL_ASSIGNCONV_TI (ti, octave_float_complex_scalar, octave_ ## TYPE ## _scalar, octave_complex_matrix) \
1134  INSTALL_ASSIGNCONV_TI (ti, octave_float_complex_matrix, octave_ ## TYPE ## _matrix, octave_complex_matrix)
1135 
1136 #define OCTAVE_INSTALL_INT_NULL_ASSIGN_OPS(TYPE) \
1137  INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_ ## TYPE ## _matrix, octave_null_matrix, TYPE ## null_assign) \
1138  INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_ ## TYPE ## _matrix, octave_null_str, TYPE ## null_assign) \
1139  INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_ ## TYPE ## _matrix, octave_null_sq_str, TYPE ## null_assign) \
1140  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TYPE ## _scalar, octave_null_matrix, octave_ ## TYPE ## _matrix) \
1141  INSTALL_ASSIGNCONV_TI (ti, octave_## TYPE ## _scalar, octave_null_str, octave_ ## TYPE ## _matrix) \
1142  INSTALL_ASSIGNCONV_TI (ti, octave_## TYPE ## _scalar, octave_null_sq_str, octave_ ## TYPE ## _matrix)
1143 
1144 #define OCTAVE_INSTALL_INT_OPS(TYPE) \
1145  OCTAVE_INSTALL_SS_INT_OPS (TYPE) \
1146  OCTAVE_INSTALL_SM_INT_OPS (TYPE) \
1147  OCTAVE_INSTALL_MS_INT_OPS (TYPE) \
1148  OCTAVE_INSTALL_MM_INT_OPS (TYPE) \
1149  OCTAVE_INSTALL_CONCAT_FN (TYPE) \
1150  OCTAVE_INSTALL_RE_INT_ASSIGN_OPS (TYPE) \
1151  OCTAVE_INSTALL_FLT_RE_INT_ASSIGN_OPS (TYPE) \
1152  OCTAVE_INSTALL_CX_INT_ASSIGN_OPS (TYPE) \
1153  OCTAVE_INSTALL_FLT_CX_INT_ASSIGN_OPS (TYPE) \
1154  OCTAVE_INSTALL_INT_NULL_ASSIGN_OPS(TYPE)
1155 
1156 #define OCTAVE_INSTALL_SM_INT_ASSIGNCONV(TLHS, TRHS) \
1157  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TLHS ## _scalar, octave_ ## TRHS ## _scalar, octave_ ## TLHS ## _matrix) \
1158  INSTALL_ASSIGNCONV_TI (ti, octave_ ## TLHS ## _scalar, octave_ ## TRHS ## _matrix, octave_ ## TLHS ## _matrix)
1159 
1160 #define OCTAVE_MIXED_INT_CMP_OPS(T1, T2) \
1161  OCTAVE_SS_INT_CMP_OPS (T1 ## _ ## T2 ## _ss, T1 ## _, T2 ## _) \
1162  OCTAVE_SM_INT_CMP_OPS (T1 ## _ ## T2 ## _sm, T1 ## _, T2 ## _) \
1163  OCTAVE_MS_INT_CMP_OPS (T1 ## _ ## T2 ## _ms, T1 ## _, T2 ## _) \
1164  OCTAVE_MM_INT_CMP_OPS (T1 ## _ ## T2 ## _mm, T1 ## _, T2 ## _)
1165 
1166 #define OCTAVE_INSTALL_MIXED_INT_CMP_OPS(T1, T2) \
1167  OCTAVE_INSTALL_SS_INT_CMP_OPS (T1 ## _ ## T2 ## _ss, T1 ## _, T2 ## _) \
1168  OCTAVE_INSTALL_SM_INT_CMP_OPS (T1 ## _ ## T2 ## _sm, T1 ## _, T2 ## _) \
1169  OCTAVE_INSTALL_MS_INT_CMP_OPS (T1 ## _ ## T2 ## _ms, T1 ## _, T2 ## _) \
1170  OCTAVE_INSTALL_MM_INT_CMP_OPS (T1 ## _ ## T2 ## _mm, T1 ## _, T2 ## _)
1171 
1172 #endif