GNU Octave
4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
liboctave
operators
mx-op-decl.h
Go to the documentation of this file.
1
/*
2
3
Copyright (C) 1996-2017 John W. Eaton
4
Copyright (C) 2008-2009 Jaroslav Hajek
5
Copyright (C) 2009 VZLU Prague, a.s.
6
7
This file is part of Octave.
8
9
Octave is free software; you can redistribute it and/or modify it
10
under the terms of the GNU General Public License as published by the
11
Free Software Foundation; either version 3 of the License, or (at your
12
option) any later version.
13
14
Octave is distributed in the hope that it will be useful, but WITHOUT
15
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17
for more details.
18
19
You should have received a copy of the GNU General Public License
20
along with Octave; see the file COPYING. If not, see
21
<http://www.gnu.org/licenses/>.
22
23
*/
24
25
#if ! defined (octave_mx_op_decl_h)
26
#define octave_mx_op_decl_h 1
27
28
#include "octave-config.h"
29
30
#define BIN_OP_DECL(R, OP, X, Y, API) \
31
extern API R OP (const X&, const Y&)
32
33
class
boolMatrix
;
34
class
boolNDArray
;
35
36
#define CMP_OP_DECL(OP, X, Y, API) \
37
extern API boolMatrix OP (const X&, const Y&)
38
39
#define NDCMP_OP_DECL(OP, X, Y, API) \
40
extern API boolNDArray OP (const X&, const Y&)
41
42
#define BOOL_OP_DECL(OP, X, Y, API) \
43
extern API boolMatrix OP (const X&, const Y&)
44
45
#define NDBOOL_OP_DECL(OP, X, Y, API) \
46
extern API boolNDArray OP (const X&, const Y&)
47
48
// vector by scalar operations.
49
50
#define VS_BIN_OP_DECLS(R, V, S, API) \
51
BIN_OP_DECL (R, operator +, V, S, API); \
52
BIN_OP_DECL (R, operator -, V, S, API); \
53
BIN_OP_DECL (R, operator *, V, S, API); \
54
BIN_OP_DECL (R, operator /, V, S, API);
55
56
#define VS_OP_DECLS(R, V, S, API) \
57
VS_BIN_OP_DECLS(R, V, S, API)
58
59
// scalar by vector by operations.
60
61
#define SV_BIN_OP_DECLS(R, S, V, API) \
62
BIN_OP_DECL (R, operator +, S, V, API); \
63
BIN_OP_DECL (R, operator -, S, V, API); \
64
BIN_OP_DECL (R, operator *, S, V, API); \
65
BIN_OP_DECL (R, operator /, S, V, API);
66
67
#define SV_OP_DECLS(R, S, V, API) \
68
SV_BIN_OP_DECLS(R, S, V, API)
69
70
// vector by vector operations.
71
72
#define VV_BIN_OP_DECLS(R, V1, V2, API) \
73
BIN_OP_DECL (R, operator +, V1, V2, API); \
74
BIN_OP_DECL (R, operator -, V1, V2, API); \
75
BIN_OP_DECL (R, product, V1, V2, API); \
76
BIN_OP_DECL (R, quotient, V1, V2, API);
77
78
#define VV_OP_DECLS(R, V1, V2, API) \
79
VV_BIN_OP_DECLS(R, V1, V2, API)
80
81
// matrix by scalar operations.
82
83
#define MS_BIN_OP_DECLS(R, M, S, API) \
84
BIN_OP_DECL (R, operator +, M, S, API); \
85
BIN_OP_DECL (R, operator -, M, S, API); \
86
BIN_OP_DECL (R, operator *, M, S, API); \
87
BIN_OP_DECL (R, operator /, M, S, API);
88
89
#define MS_CMP_OP_DECLS(M, S, API) \
90
CMP_OP_DECL (mx_el_lt, M, S, API); \
91
CMP_OP_DECL (mx_el_le, M, S, API); \
92
CMP_OP_DECL (mx_el_ge, M, S, API); \
93
CMP_OP_DECL (mx_el_gt, M, S, API); \
94
CMP_OP_DECL (mx_el_eq, M, S, API); \
95
CMP_OP_DECL (mx_el_ne, M, S, API);
96
97
#define MS_BOOL_OP_DECLS(M, S, API) \
98
BOOL_OP_DECL (mx_el_and, M, S, API); \
99
BOOL_OP_DECL (mx_el_or, M, S, API); \
100
101
#define MS_OP_DECLS(R, M, S, API) \
102
MS_BIN_OP_DECLS (R, M, S, API) \
103
MS_CMP_OP_DECLS (M, S, API) \
104
MS_BOOL_OP_DECLS (M, S, API) \
105
106
// scalar by matrix operations.
107
108
#define SM_BIN_OP_DECLS(R, S, M, API) \
109
BIN_OP_DECL (R, operator +, S, M, API); \
110
BIN_OP_DECL (R, operator -, S, M, API); \
111
BIN_OP_DECL (R, operator *, S, M, API); \
112
BIN_OP_DECL (R, operator /, S, M, API);
113
114
#define SM_CMP_OP_DECLS(S, M, API) \
115
CMP_OP_DECL (mx_el_lt, S, M, API); \
116
CMP_OP_DECL (mx_el_le, S, M, API); \
117
CMP_OP_DECL (mx_el_ge, S, M, API); \
118
CMP_OP_DECL (mx_el_gt, S, M, API); \
119
CMP_OP_DECL (mx_el_eq, S, M, API); \
120
CMP_OP_DECL (mx_el_ne, S, M, API);
121
122
#define SM_BOOL_OP_DECLS(S, M, API) \
123
BOOL_OP_DECL (mx_el_and, S, M, API); \
124
BOOL_OP_DECL (mx_el_or, S, M, API); \
125
126
#define SM_OP_DECLS(R, S, M, API) \
127
SM_BIN_OP_DECLS (R, S, M, API) \
128
SM_CMP_OP_DECLS (S, M, API) \
129
SM_BOOL_OP_DECLS (S, M, API) \
130
131
// matrix by matrix operations.
132
133
#define MM_BIN_OP_DECLS(R, M1, M2, API) \
134
BIN_OP_DECL (R, operator +, M1, M2, API); \
135
BIN_OP_DECL (R, operator -, M1, M2, API); \
136
BIN_OP_DECL (R, product, M1, M2, API); \
137
BIN_OP_DECL (R, quotient, M1, M2, API);
138
139
#define MM_CMP_OP_DECLS(M1, M2, API) \
140
CMP_OP_DECL (mx_el_lt, M1, M2, API); \
141
CMP_OP_DECL (mx_el_le, M1, M2, API); \
142
CMP_OP_DECL (mx_el_ge, M1, M2, API); \
143
CMP_OP_DECL (mx_el_gt, M1, M2, API); \
144
CMP_OP_DECL (mx_el_eq, M1, M2, API); \
145
CMP_OP_DECL (mx_el_ne, M1, M2, API);
146
147
#define MM_BOOL_OP_DECLS(M1, M2, API) \
148
BOOL_OP_DECL (mx_el_and, M1, M2, API); \
149
BOOL_OP_DECL (mx_el_or, M1, M2, API);
150
151
#define MM_OP_DECLS(R, M1, M2, API) \
152
MM_BIN_OP_DECLS (R, M1, M2, API) \
153
MM_CMP_OP_DECLS (M1, M2, API) \
154
MM_BOOL_OP_DECLS (M1, M2, API)
155
156
// N-D matrix by scalar operations.
157
158
#define NDS_BIN_OP_DECLS(R, ND, S, API) \
159
BIN_OP_DECL (R, operator +, ND, S, API); \
160
BIN_OP_DECL (R, operator -, ND, S, API); \
161
BIN_OP_DECL (R, operator *, ND, S, API); \
162
BIN_OP_DECL (R, operator /, ND, S, API);
163
164
#define NDS_CMP_OP_DECLS(ND, S, API) \
165
NDCMP_OP_DECL (mx_el_lt, ND, S, API); \
166
NDCMP_OP_DECL (mx_el_le, ND, S, API); \
167
NDCMP_OP_DECL (mx_el_ge, ND, S, API); \
168
NDCMP_OP_DECL (mx_el_gt, ND, S, API); \
169
NDCMP_OP_DECL (mx_el_eq, ND, S, API); \
170
NDCMP_OP_DECL (mx_el_ne, ND, S, API);
171
172
#define NDS_BOOL_OP_DECLS(ND, S, API) \
173
NDBOOL_OP_DECL (mx_el_and, ND, S, API); \
174
NDBOOL_OP_DECL (mx_el_or, ND, S, API); \
175
NDBOOL_OP_DECL (mx_el_not_and, ND, S, API); \
176
NDBOOL_OP_DECL (mx_el_not_or, ND, S, API);
177
178
#define NDS_OP_DECLS(R, ND, S, API) \
179
NDS_BIN_OP_DECLS (R, ND, S, API) \
180
NDS_CMP_OP_DECLS (ND, S, API) \
181
NDS_BOOL_OP_DECLS (ND, S, API)
182
183
// scalar by N-D matrix operations.
184
185
#define SND_BIN_OP_DECLS(R, S, ND, API) \
186
BIN_OP_DECL (R, operator +, S, ND, API); \
187
BIN_OP_DECL (R, operator -, S, ND, API); \
188
BIN_OP_DECL (R, operator *, S, ND, API); \
189
BIN_OP_DECL (R, operator /, S, ND, API);
190
191
#define SND_CMP_OP_DECLS(S, ND, API) \
192
NDCMP_OP_DECL (mx_el_lt, S, ND, API); \
193
NDCMP_OP_DECL (mx_el_le, S, ND, API); \
194
NDCMP_OP_DECL (mx_el_ge, S, ND, API); \
195
NDCMP_OP_DECL (mx_el_gt, S, ND, API); \
196
NDCMP_OP_DECL (mx_el_eq, S, ND, API); \
197
NDCMP_OP_DECL (mx_el_ne, S, ND, API);
198
199
#define SND_BOOL_OP_DECLS(S, ND, API) \
200
NDBOOL_OP_DECL (mx_el_and, S, ND, API); \
201
NDBOOL_OP_DECL (mx_el_or, S, ND, API); \
202
NDBOOL_OP_DECL (mx_el_and_not, S, ND, API); \
203
NDBOOL_OP_DECL (mx_el_or_not, S, ND, API);
204
205
#define SND_OP_DECLS(R, S, ND, API) \
206
SND_BIN_OP_DECLS (R, S, ND, API) \
207
SND_CMP_OP_DECLS (S, ND, API) \
208
SND_BOOL_OP_DECLS (S, ND, API)
209
210
// N-D matrix by N-D matrix operations.
211
212
#define NDND_BIN_OP_DECLS(R, ND1, ND2, API) \
213
BIN_OP_DECL (R, operator +, ND1, ND2, API); \
214
BIN_OP_DECL (R, operator -, ND1, ND2, API); \
215
BIN_OP_DECL (R, product, ND1, ND2, API); \
216
BIN_OP_DECL (R, quotient, ND1, ND2, API);
217
218
#define NDND_CMP_OP_DECLS(ND1, ND2, API) \
219
NDCMP_OP_DECL (mx_el_lt, ND1, ND2, API); \
220
NDCMP_OP_DECL (mx_el_le, ND1, ND2, API); \
221
NDCMP_OP_DECL (mx_el_ge, ND1, ND2, API); \
222
NDCMP_OP_DECL (mx_el_gt, ND1, ND2, API); \
223
NDCMP_OP_DECL (mx_el_eq, ND1, ND2, API); \
224
NDCMP_OP_DECL (mx_el_ne, ND1, ND2, API);
225
226
#define NDND_BOOL_OP_DECLS(ND1, ND2, API) \
227
NDBOOL_OP_DECL (mx_el_and, ND1, ND2, API); \
228
NDBOOL_OP_DECL (mx_el_or, ND1, ND2, API); \
229
NDBOOL_OP_DECL (mx_el_and_not, ND1, ND2, API); \
230
NDBOOL_OP_DECL (mx_el_or_not, ND1, ND2, API); \
231
NDBOOL_OP_DECL (mx_el_not_and, ND1, ND2, API); \
232
NDBOOL_OP_DECL (mx_el_not_or, ND1, ND2, API);
233
234
#define NDND_OP_DECLS(R, ND1, ND2, API) \
235
NDND_BIN_OP_DECLS (R, ND1, ND2, API) \
236
NDND_CMP_OP_DECLS (ND1, ND2, API) \
237
NDND_BOOL_OP_DECLS (ND1, ND2, API)
238
239
// scalar by diagonal matrix operations.
240
241
#define SDM_BIN_OP_DECLS(R, S, DM, API) \
242
BIN_OP_DECL (R, operator *, S, DM, API); \
243
244
#define SDM_OP_DECLS(R, S, DM, API) \
245
SDM_BIN_OP_DECLS(R, S, DM, API)
246
247
// diagonal matrix by scalar operations.
248
249
#define DMS_BIN_OP_DECLS(R, DM, S, API) \
250
BIN_OP_DECL (R, operator *, DM, S, API); \
251
BIN_OP_DECL (R, operator /, DM, S, API);
252
253
#define DMS_OP_DECLS(R, DM, S, API) \
254
DMS_BIN_OP_DECLS(R, DM, S, API)
255
256
// matrix by diagonal matrix operations.
257
258
#define MDM_BIN_OP_DECLS(R, M, DM, API) \
259
BIN_OP_DECL (R, operator +, M, DM, API); \
260
BIN_OP_DECL (R, operator -, M, DM, API); \
261
BIN_OP_DECL (R, operator *, M, DM, API);
262
263
#define MDM_OP_DECLS(R, M, DM, API) \
264
MDM_BIN_OP_DECLS(R, M, DM, API)
265
266
// diagonal matrix by matrix operations.
267
268
#define DMM_BIN_OP_DECLS(R, DM, M, API) \
269
BIN_OP_DECL (R, operator +, DM, M, API); \
270
BIN_OP_DECL (R, operator -, DM, M, API); \
271
BIN_OP_DECL (R, operator *, DM, M, API);
272
273
#define DMM_OP_DECLS(R, DM, M, API) \
274
DMM_BIN_OP_DECLS(R, DM, M, API)
275
276
// diagonal matrix by diagonal matrix operations.
277
278
#define DMDM_BIN_OP_DECLS(R, DM1, DM2, API) \
279
BIN_OP_DECL (R, operator +, DM1, DM2, API); \
280
BIN_OP_DECL (R, operator -, DM1, DM2, API); \
281
BIN_OP_DECL (R, product, DM1, DM2, API);
282
283
#define DMDM_OP_DECLS(R, DM1, DM2, API) \
284
DMDM_BIN_OP_DECLS (R, DM1, DM2, API)
285
286
// scalar by N-D array min/max ops
287
288
#define MINMAX_DECLS(T, S, API) \
289
extern API T min (S d, const T& m); \
290
extern API T min (const T& m, S d); \
291
extern API T min (const T& a, const T& b); \
292
extern API T max (S d, const T& m); \
293
extern API T max (const T& m, S d); \
294
extern API T max (const T& a, const T& b);
295
296
// permutation matrix by matrix ops and vice versa
297
298
#define PMM_BIN_OP_DECLS(R, PM, M, API) \
299
BIN_OP_DECL (R, operator *, PM, M, API);
300
301
#define MPM_BIN_OP_DECLS(R, M, PM, API) \
302
BIN_OP_DECL (R, operator *, M, PM, API);
303
304
#endif
boolMatrix
Definition:
boolMatrix.h:35
boolNDArray
Definition:
boolNDArray.h:34
Generated on Wed May 10 2017 15:42:59 for GNU Octave by
1.8.8