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