annotate liboctave/operators/mx-op-defs.h @ 26376:00f796120a6d stable

maint: Update copyright dates in all source files.
author John W. Eaton <jwe@octave.org>
date Wed, 02 Jan 2019 16:32:43 -0500
parents 2de707ae8de4
children b442ec6dda5c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
1 /*
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
2
26376
00f796120a6d maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 25663
diff changeset
3 Copyright (C) 1996-2019 John W. Eaton
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10682
diff changeset
4 Copyright (C) 2008-2009 Jaroslav Hajek
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10682
diff changeset
5 Copyright (C) 2009-2010 VZLU Prague, a.s.
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
6
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
7 This file is part of Octave.
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
8
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
9 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
10 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
11 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
12 (at your option) any later version.
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
13
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
14 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
15 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
17 GNU General Public License for more details.
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
18
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6708
diff changeset
20 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
21 <https://www.gnu.org/licenses/>.
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
22
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
23 */
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
24
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
25 #if ! defined (octave_mx_op_defs_h)
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
26 #define octave_mx_op_defs_h 1
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
27
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21129
diff changeset
28 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21129
diff changeset
29
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21014
diff changeset
30 #include "lo-array-errwarn.h"
8774
b756ce0002db split implementation and interface in mx-op-defs and MArray-defs
Jaroslav Hajek <highegg@gmail.com>
parents: 8397
diff changeset
31 #include "mx-op-decl.h"
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
32 #include "mx-inlines.cc"
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
33
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
34 #define SNANCHK(s) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
35 if (octave::math::isnan (s)) \
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
36 octave::err_nan_to_logical_conversion ()
10481
e8811e5dd699 avoid exception throwing in mx-inline loops
Jaroslav Hajek <highegg@gmail.com>
parents: 10362
diff changeset
37
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
38 #define MNANCHK(m, MT) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
39 if (do_mx_check (m, mx_inline_any_nan<MT>)) \
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
40 octave::err_nan_to_logical_conversion ()
10481
e8811e5dd699 avoid exception throwing in mx-inline loops
Jaroslav Hajek <highegg@gmail.com>
parents: 10362
diff changeset
41
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
42 // vector by scalar operations.
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
43
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
44 #define VS_BIN_OP(R, F, OP, V, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
45 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
46 F (const V& v, const S& s) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
47 { \
10362
b47ab50a6aa8 simplify appliers in mx-inlines.cc
Jaroslav Hajek <highegg@gmail.com>
parents: 10329
diff changeset
48 return do_ms_binary_op<R::element_type, V::element_type, S> (v, s, OP); \
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
49 }
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
50
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
51 #define VS_BIN_OPS(R, V, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
52 VS_BIN_OP (R, operator +, mx_inline_add, V, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
53 VS_BIN_OP (R, operator -, mx_inline_sub, V, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
54 VS_BIN_OP (R, operator *, mx_inline_mul, V, S) \
9660
0256e187d13b get rid of VS|SV|VV_BIN_OP macros in mx-op-defs
Jaroslav Hajek <highegg@gmail.com>
parents: 9601
diff changeset
55 VS_BIN_OP (R, operator /, mx_inline_div, V, S)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
56
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
57 // scalar by vector by operations.
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
58
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
59 #define SV_BIN_OP(R, F, OP, S, V) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
60 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
61 F (const S& s, const V& v) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
62 { \
10362
b47ab50a6aa8 simplify appliers in mx-inlines.cc
Jaroslav Hajek <highegg@gmail.com>
parents: 10329
diff changeset
63 return do_sm_binary_op<R::element_type, S, V::element_type> (s, v, OP); \
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
64 }
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
65
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
66 #define SV_BIN_OPS(R, S, V) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
67 SV_BIN_OP (R, operator +, mx_inline_add, S, V) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
68 SV_BIN_OP (R, operator -, mx_inline_sub, S, V) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
69 SV_BIN_OP (R, operator *, mx_inline_mul, S, V) \
9660
0256e187d13b get rid of VS|SV|VV_BIN_OP macros in mx-op-defs
Jaroslav Hajek <highegg@gmail.com>
parents: 9601
diff changeset
70 SV_BIN_OP (R, operator /, mx_inline_div, S, V)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
71
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
72 // vector by vector operations.
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
73
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
74 #define VV_BIN_OP(R, F, OP, V1, V2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
75 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
76 F (const V1& v1, const V2& v2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
77 { \
13004
d9d65c3017c3 Make bsxfun automatic for most binary operators.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 11523
diff changeset
78 return do_mm_binary_op<R::element_type, V1::element_type, V2::element_type> (v1, v2, OP, OP, OP, #F); \
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
79 }
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
80
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
81 #define VV_BIN_OPS(R, V1, V2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
82 VV_BIN_OP (R, operator +, mx_inline_add, V1, V2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
83 VV_BIN_OP (R, operator -, mx_inline_sub, V1, V2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
84 VV_BIN_OP (R, product, mx_inline_mul, V1, V2) \
9660
0256e187d13b get rid of VS|SV|VV_BIN_OP macros in mx-op-defs
Jaroslav Hajek <highegg@gmail.com>
parents: 9601
diff changeset
85 VV_BIN_OP (R, quotient, mx_inline_div, V1, V2)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
86
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
87 // matrix by scalar operations.
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
88
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
89 #define MS_BIN_OP(R, OP, M, S, F) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
90 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
91 OP (const M& m, const S& s) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
92 { \
10362
b47ab50a6aa8 simplify appliers in mx-inlines.cc
Jaroslav Hajek <highegg@gmail.com>
parents: 10329
diff changeset
93 return do_ms_binary_op<R::element_type, M::element_type, S> (m, s, F); \
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
94 }
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
95
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
96 #define MS_BIN_OPS(R, M, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
97 MS_BIN_OP (R, operator +, M, S, mx_inline_add) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
98 MS_BIN_OP (R, operator -, M, S, mx_inline_sub) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
99 MS_BIN_OP (R, operator *, M, S, mx_inline_mul) \
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
100 MS_BIN_OP (R, operator /, M, S, mx_inline_div)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
101
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
102 #define MS_CMP_OP(F, OP, M, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
103 boolMatrix \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
104 F (const M& m, const S& s) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
105 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
106 return do_ms_binary_op<bool, M::element_type, S> (m, s, OP); \
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
107 }
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
108
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
109 #define MS_CMP_OPS(M, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
110 MS_CMP_OP (mx_el_lt, mx_inline_lt, M, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
111 MS_CMP_OP (mx_el_le, mx_inline_le, M, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
112 MS_CMP_OP (mx_el_ge, mx_inline_ge, M, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
113 MS_CMP_OP (mx_el_gt, mx_inline_gt, M, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
114 MS_CMP_OP (mx_el_eq, mx_inline_eq, M, S) \
9578
7dafdb8b062f refactor comparison ops implementations
Jaroslav Hajek <highegg@gmail.com>
parents: 9553
diff changeset
115 MS_CMP_OP (mx_el_ne, mx_inline_ne, M, S)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
116
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
117 #define MS_BOOL_OP(F, OP, M, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
118 boolMatrix \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
119 F (const M& m, const S& s) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
120 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
121 MNANCHK (m, M::element_type); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
122 SNANCHK (s); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
123 return do_ms_binary_op<bool, M::element_type, S> (m, s, OP); \
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
124 }
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
125
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
126 #define MS_BOOL_OPS(M, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
127 MS_BOOL_OP (mx_el_and, mx_inline_and, M, S) \
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
128 MS_BOOL_OP (mx_el_or, mx_inline_or, M, S)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
129
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
130 // scalar by matrix operations.
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
131
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
132 #define SM_BIN_OP(R, OP, S, M, F) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
133 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
134 OP (const S& s, const M& m) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
135 { \
10362
b47ab50a6aa8 simplify appliers in mx-inlines.cc
Jaroslav Hajek <highegg@gmail.com>
parents: 10329
diff changeset
136 return do_sm_binary_op<R::element_type, S, M::element_type> (s, m, F); \
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
137 }
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
138
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
139 #define SM_BIN_OPS(R, S, M) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
140 SM_BIN_OP (R, operator +, S, M, mx_inline_add) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
141 SM_BIN_OP (R, operator -, S, M, mx_inline_sub) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
142 SM_BIN_OP (R, operator *, S, M, mx_inline_mul) \
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
143 SM_BIN_OP (R, operator /, S, M, mx_inline_div)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
144
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
145 #define SM_CMP_OP(F, OP, S, M) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
146 boolMatrix \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
147 F (const S& s, const M& m) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
148 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
149 return do_sm_binary_op<bool, S, M::element_type> (s, m, OP); \
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
150 }
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
151
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
152 #define SM_CMP_OPS(S, M) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
153 SM_CMP_OP (mx_el_lt, mx_inline_lt, S, M) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
154 SM_CMP_OP (mx_el_le, mx_inline_le, S, M) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
155 SM_CMP_OP (mx_el_ge, mx_inline_ge, S, M) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
156 SM_CMP_OP (mx_el_gt, mx_inline_gt, S, M) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
157 SM_CMP_OP (mx_el_eq, mx_inline_eq, S, M) \
9578
7dafdb8b062f refactor comparison ops implementations
Jaroslav Hajek <highegg@gmail.com>
parents: 9553
diff changeset
158 SM_CMP_OP (mx_el_ne, mx_inline_ne, S, M)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
159
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
160 #define SM_BOOL_OP(F, OP, S, M) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
161 boolMatrix \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
162 F (const S& s, const M& m) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
163 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
164 SNANCHK (s); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
165 MNANCHK (m, M::element_type); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
166 return do_sm_binary_op<bool, S, M::element_type> (s, m, OP); \
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
167 }
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
168
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
169 #define SM_BOOL_OPS(S, M) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
170 SM_BOOL_OP (mx_el_and, mx_inline_and, S, M) \
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
171 SM_BOOL_OP (mx_el_or, mx_inline_or, S, M)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
172
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
173 // matrix by matrix operations.
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
174
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
175 #define MM_BIN_OP(R, OP, M1, M2, F) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
176 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
177 OP (const M1& m1, const M2& m2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
178 { \
13004
d9d65c3017c3 Make bsxfun automatic for most binary operators.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 11523
diff changeset
179 return do_mm_binary_op<R::element_type, M1::element_type, M2::element_type> (m1, m2, F, F, F, #OP); \
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
180 }
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
181
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
182 #define MM_BIN_OPS(R, M1, M2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
183 MM_BIN_OP (R, operator +, M1, M2, mx_inline_add) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
184 MM_BIN_OP (R, operator -, M1, M2, mx_inline_sub) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
185 MM_BIN_OP (R, product, M1, M2, mx_inline_mul) \
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
186 MM_BIN_OP (R, quotient, M1, M2, mx_inline_div)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
187
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
188 #define MM_CMP_OP(F, OP, M1, M2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
189 boolMatrix \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
190 F (const M1& m1, const M2& m2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
191 { \
13004
d9d65c3017c3 Make bsxfun automatic for most binary operators.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 11523
diff changeset
192 return do_mm_binary_op<bool, M1::element_type, M2::element_type> (m1, m2, OP, OP, OP, #F); \
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
193 }
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
194
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
195 #define MM_CMP_OPS(M1, M2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
196 MM_CMP_OP (mx_el_lt, mx_inline_lt, M1, M2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
197 MM_CMP_OP (mx_el_le, mx_inline_le, M1, M2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
198 MM_CMP_OP (mx_el_ge, mx_inline_ge, M1, M2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
199 MM_CMP_OP (mx_el_gt, mx_inline_gt, M1, M2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
200 MM_CMP_OP (mx_el_eq, mx_inline_eq, M1, M2) \
9578
7dafdb8b062f refactor comparison ops implementations
Jaroslav Hajek <highegg@gmail.com>
parents: 9553
diff changeset
201 MM_CMP_OP (mx_el_ne, mx_inline_ne, M1, M2)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
202
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
203 #define MM_BOOL_OP(F, OP, M1, M2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
204 boolMatrix \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
205 F (const M1& m1, const M2& m2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
206 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
207 MNANCHK (m1, M1::element_type); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
208 MNANCHK (m2, M2::element_type); \
13004
d9d65c3017c3 Make bsxfun automatic for most binary operators.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 11523
diff changeset
209 return do_mm_binary_op<bool, M1::element_type, M2::element_type> (m1, m2, OP, OP, OP, #F); \
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
210 }
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
211
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
212 #define MM_BOOL_OPS(M1, M2) \
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
213 MM_BOOL_OP (mx_el_and, mx_inline_and, M1, M2) \
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
214 MM_BOOL_OP (mx_el_or, mx_inline_or, M1, M2)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
215
21014
b9d4c3615e89 maint: Capitalize D for dimension in messages and comments.
Rik <rik@octave.org>
parents: 20791
diff changeset
216 // N-D matrix by scalar operations.
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
217
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
218 #define NDS_BIN_OP(R, OP, ND, S, F) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
219 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
220 OP (const ND& m, const S& s) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
221 { \
10362
b47ab50a6aa8 simplify appliers in mx-inlines.cc
Jaroslav Hajek <highegg@gmail.com>
parents: 10329
diff changeset
222 return do_ms_binary_op<R::element_type, ND::element_type, S> (m, s, F); \
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
223 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
224
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
225 #define NDS_BIN_OPS(R, ND, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
226 NDS_BIN_OP (R, operator +, ND, S, mx_inline_add) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
227 NDS_BIN_OP (R, operator -, ND, S, mx_inline_sub) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
228 NDS_BIN_OP (R, operator *, ND, S, mx_inline_mul) \
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
229 NDS_BIN_OP (R, operator /, ND, S, mx_inline_div)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
230
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
231 #define NDS_CMP_OP(F, OP, ND, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
232 boolNDArray \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
233 F (const ND& m, const S& s) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
234 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
235 return do_ms_binary_op<bool, ND::element_type, S> (m, s, OP); \
6119
fabb1be5fd84 [project @ 2006-10-28 00:13:58 by jwe]
jwe
parents: 6108
diff changeset
236 }
fabb1be5fd84 [project @ 2006-10-28 00:13:58 by jwe]
jwe
parents: 6108
diff changeset
237
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
238 #define NDS_CMP_OPS(ND, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
239 NDS_CMP_OP (mx_el_lt, mx_inline_lt, ND, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
240 NDS_CMP_OP (mx_el_le, mx_inline_le, ND, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
241 NDS_CMP_OP (mx_el_ge, mx_inline_ge, ND, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
242 NDS_CMP_OP (mx_el_gt, mx_inline_gt, ND, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
243 NDS_CMP_OP (mx_el_eq, mx_inline_eq, ND, S) \
9578
7dafdb8b062f refactor comparison ops implementations
Jaroslav Hajek <highegg@gmail.com>
parents: 9553
diff changeset
244 NDS_CMP_OP (mx_el_ne, mx_inline_ne, ND, S)
6119
fabb1be5fd84 [project @ 2006-10-28 00:13:58 by jwe]
jwe
parents: 6108
diff changeset
245
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
246 #define NDS_BOOL_OP(F, OP, ND, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
247 boolNDArray \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
248 F (const ND& m, const S& s) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
249 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
250 MNANCHK (m, ND::element_type); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
251 SNANCHK (s); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
252 return do_ms_binary_op<bool, ND::element_type, S> (m, s, OP); \
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
253 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
254
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
255 #define NDS_BOOL_OPS(ND, S) \
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
256 NDS_BOOL_OP (mx_el_and, mx_inline_and, ND, S) \
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
257 NDS_BOOL_OP (mx_el_or, mx_inline_or, ND, S) \
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
258 NDS_BOOL_OP (mx_el_not_and, mx_inline_not_and, ND, S) \
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
259 NDS_BOOL_OP (mx_el_not_or, mx_inline_not_or, ND, S) \
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
260 NDS_BOOL_OP (mx_el_and_not, mx_inline_and_not, ND, S) \
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
261 NDS_BOOL_OP (mx_el_or_not, mx_inline_or_not, ND, S)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
262
21014
b9d4c3615e89 maint: Capitalize D for dimension in messages and comments.
Rik <rik@octave.org>
parents: 20791
diff changeset
263 // scalar by N-D matrix operations.
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
264
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
265 #define SND_BIN_OP(R, OP, S, ND, F) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
266 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
267 OP (const S& s, const ND& m) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
268 { \
10362
b47ab50a6aa8 simplify appliers in mx-inlines.cc
Jaroslav Hajek <highegg@gmail.com>
parents: 10329
diff changeset
269 return do_sm_binary_op<R::element_type, S, ND::element_type> (s, m, F); \
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
270 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
271
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
272 #define SND_BIN_OPS(R, S, ND) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
273 SND_BIN_OP (R, operator +, S, ND, mx_inline_add) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
274 SND_BIN_OP (R, operator -, S, ND, mx_inline_sub) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
275 SND_BIN_OP (R, operator *, S, ND, mx_inline_mul) \
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
276 SND_BIN_OP (R, operator /, S, ND, mx_inline_div)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
277
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
278 #define SND_CMP_OP(F, OP, S, ND) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
279 boolNDArray \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
280 F (const S& s, const ND& m) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
281 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
282 return do_sm_binary_op<bool, S, ND::element_type> (s, m, OP); \
6119
fabb1be5fd84 [project @ 2006-10-28 00:13:58 by jwe]
jwe
parents: 6108
diff changeset
283 }
fabb1be5fd84 [project @ 2006-10-28 00:13:58 by jwe]
jwe
parents: 6108
diff changeset
284
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
285 #define SND_CMP_OPS(S, ND) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
286 SND_CMP_OP (mx_el_lt, mx_inline_lt, S, ND) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
287 SND_CMP_OP (mx_el_le, mx_inline_le, S, ND) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
288 SND_CMP_OP (mx_el_ge, mx_inline_ge, S, ND) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
289 SND_CMP_OP (mx_el_gt, mx_inline_gt, S, ND) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
290 SND_CMP_OP (mx_el_eq, mx_inline_eq, S, ND) \
9578
7dafdb8b062f refactor comparison ops implementations
Jaroslav Hajek <highegg@gmail.com>
parents: 9553
diff changeset
291 SND_CMP_OP (mx_el_ne, mx_inline_ne, S, ND)
6119
fabb1be5fd84 [project @ 2006-10-28 00:13:58 by jwe]
jwe
parents: 6108
diff changeset
292
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
293 #define SND_BOOL_OP(F, OP, S, ND) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
294 boolNDArray \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
295 F (const S& s, const ND& m) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
296 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
297 SNANCHK (s); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
298 MNANCHK (m, ND::element_type); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
299 return do_sm_binary_op<bool, S, ND::element_type> (s, m, OP); \
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
300 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
301
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
302 #define SND_BOOL_OPS(S, ND) \
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
303 SND_BOOL_OP (mx_el_and, mx_inline_and, S, ND) \
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
304 SND_BOOL_OP (mx_el_or, mx_inline_or, S, ND) \
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
305 SND_BOOL_OP (mx_el_not_and, mx_inline_not_and, S, ND) \
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
306 SND_BOOL_OP (mx_el_not_or, mx_inline_not_or, S, ND) \
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
307 SND_BOOL_OP (mx_el_and_not, mx_inline_and_not, S, ND) \
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
308 SND_BOOL_OP (mx_el_or_not, mx_inline_or_not, S, ND)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
309
21014
b9d4c3615e89 maint: Capitalize D for dimension in messages and comments.
Rik <rik@octave.org>
parents: 20791
diff changeset
310 // N-D matrix by N-D matrix operations.
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
311
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
312 #define NDND_BIN_OP(R, OP, ND1, ND2, F) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
313 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
314 OP (const ND1& m1, const ND2& m2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
315 { \
13004
d9d65c3017c3 Make bsxfun automatic for most binary operators.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 11523
diff changeset
316 return do_mm_binary_op<R::element_type, ND1::element_type, ND2::element_type> (m1, m2, F, F, F, #OP); \
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
317 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
318
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
319 #define NDND_BIN_OPS(R, ND1, ND2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
320 NDND_BIN_OP (R, operator +, ND1, ND2, mx_inline_add) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
321 NDND_BIN_OP (R, operator -, ND1, ND2, mx_inline_sub) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
322 NDND_BIN_OP (R, product, ND1, ND2, mx_inline_mul) \
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
323 NDND_BIN_OP (R, quotient, ND1, ND2, mx_inline_div)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
324
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
325 #define NDND_CMP_OP(F, OP, ND1, ND2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
326 boolNDArray \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
327 F (const ND1& m1, const ND2& m2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
328 { \
13004
d9d65c3017c3 Make bsxfun automatic for most binary operators.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 11523
diff changeset
329 return do_mm_binary_op<bool, ND1::element_type, ND2::element_type> (m1, m2, OP, OP, OP, #F); \
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
330 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
331
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
332 #define NDND_CMP_OPS(ND1, ND2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
333 NDND_CMP_OP (mx_el_lt, mx_inline_lt, ND1, ND2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
334 NDND_CMP_OP (mx_el_le, mx_inline_le, ND1, ND2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
335 NDND_CMP_OP (mx_el_ge, mx_inline_ge, ND1, ND2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
336 NDND_CMP_OP (mx_el_gt, mx_inline_gt, ND1, ND2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
337 NDND_CMP_OP (mx_el_eq, mx_inline_eq, ND1, ND2) \
9578
7dafdb8b062f refactor comparison ops implementations
Jaroslav Hajek <highegg@gmail.com>
parents: 9553
diff changeset
338 NDND_CMP_OP (mx_el_ne, mx_inline_ne, ND1, ND2)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
339
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
340 #define NDND_BOOL_OP(F, OP, ND1, ND2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
341 boolNDArray \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
342 F (const ND1& m1, const ND2& m2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
343 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
344 MNANCHK (m1, ND1::element_type); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
345 MNANCHK (m2, ND2::element_type); \
13004
d9d65c3017c3 Make bsxfun automatic for most binary operators.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 11523
diff changeset
346 return do_mm_binary_op<bool, ND1::element_type, ND2::element_type> (m1, m2, OP, OP, OP, #F); \
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
347 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
348
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
349 #define NDND_BOOL_OPS(ND1, ND2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
350 NDND_BOOL_OP (mx_el_and, mx_inline_and, ND1, ND2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
351 NDND_BOOL_OP (mx_el_or, mx_inline_or, ND1, ND2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
352 NDND_BOOL_OP (mx_el_not_and, mx_inline_not_and, ND1, ND2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
353 NDND_BOOL_OP (mx_el_not_or, mx_inline_not_or, ND1, ND2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
354 NDND_BOOL_OP (mx_el_and_not, mx_inline_and_not, ND1, ND2) \
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
355 NDND_BOOL_OP (mx_el_or_not, mx_inline_or_not, ND1, ND2)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 3769
diff changeset
356
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
357 // scalar by diagonal matrix operations.
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
358
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
359 #define SDM_BIN_OP(R, OP, S, DM) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
360 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
361 operator OP (const S& s, const DM& dm) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
362 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
363 R r (dm.rows (), dm.cols ()); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
364 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
365 for (octave_idx_type i = 0; i < dm.length (); i++) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
366 r.dgxelem (i) = s OP dm.dgelem (i); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
367 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
368 return r; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
369 }
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
370
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
371 #define SDM_BIN_OPS(R, S, DM) \
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9660
diff changeset
372 SDM_BIN_OP (R, *, S, DM)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
373
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
374 // diagonal matrix by scalar operations.
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
375
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
376 #define DMS_BIN_OP(R, OP, DM, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
377 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
378 operator OP (const DM& dm, const S& s) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
379 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
380 R r (dm.rows (), dm.cols ()); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
381 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
382 for (octave_idx_type i = 0; i < dm.length (); i++) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
383 r.dgxelem (i) = dm.dgelem (i) OP s; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
384 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
385 return r; \
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
386 }
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
387
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
388 #define DMS_BIN_OPS(R, DM, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
389 DMS_BIN_OP (R, *, DM, S) \
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9660
diff changeset
390 DMS_BIN_OP (R, /, DM, S)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
391
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
392 // matrix by diagonal matrix operations.
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
393
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
394 #define MDM_BIN_OP(R, OP, M, DM, OPEQ) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
395 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
396 OP (const M& m, const DM& dm) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
397 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
398 R r; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
399 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
400 octave_idx_type m_nr = m.rows (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
401 octave_idx_type m_nc = m.cols (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
402 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
403 octave_idx_type dm_nr = dm.rows (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
404 octave_idx_type dm_nc = dm.cols (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
405 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
406 if (m_nr != dm_nr || m_nc != dm_nc) \
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
407 octave::err_nonconformant (#OP, m_nr, m_nc, dm_nr, dm_nc); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
408 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
409 r.resize (m_nr, m_nc); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
410 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
411 if (m_nr > 0 && m_nc > 0) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
412 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
413 r = R (m); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
414 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
415 octave_idx_type len = dm.length (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
416 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
417 for (octave_idx_type i = 0; i < len; i++) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
418 r.elem (i, i) OPEQ dm.elem (i, i); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
419 } \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
420 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
421 return r; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
422 }
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
423
25663
2de707ae8de4 eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
424 #define MDM_MULTIPLY_OP(R, M, DM) \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
425 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
426 operator * (const M& m, const DM& dm) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
427 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
428 R r; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
429 \
25663
2de707ae8de4 eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
430 R::element_type r_zero = R::element_type (); \
2de707ae8de4 eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
431 \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
432 octave_idx_type m_nr = m.rows (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
433 octave_idx_type m_nc = m.cols (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
434 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
435 octave_idx_type dm_nr = dm.rows (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
436 octave_idx_type dm_nc = dm.cols (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
437 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
438 if (m_nc != dm_nr) \
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
439 octave::err_nonconformant ("operator *", m_nr, m_nc, dm_nr, dm_nc); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
440 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
441 r = R (m_nr, dm_nc); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
442 R::element_type *rd = r.fortran_vec (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
443 const M::element_type *md = m.data (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
444 const DM::element_type *dd = dm.data (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
445 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
446 octave_idx_type len = dm.length (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
447 for (octave_idx_type i = 0; i < len; i++) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
448 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
449 mx_inline_mul (m_nr, rd, md, dd[i]); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
450 rd += m_nr; md += m_nr; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
451 } \
25663
2de707ae8de4 eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
452 mx_inline_fill (m_nr * (dm_nc - len), rd, r_zero); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
453 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
454 return r; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
455 }
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
456
25663
2de707ae8de4 eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
457 #define MDM_BIN_OPS(R, M, DM) \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
458 MDM_BIN_OP (R, operator +, M, DM, +=) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
459 MDM_BIN_OP (R, operator -, M, DM, -=) \
25663
2de707ae8de4 eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
460 MDM_MULTIPLY_OP (R, M, DM)
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
461
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
462 // diagonal matrix by matrix operations.
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
463
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
464 #define DMM_BIN_OP(R, OP, DM, M, OPEQ, PREOP) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
465 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
466 OP (const DM& dm, const M& m) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
467 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
468 R r; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
469 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
470 octave_idx_type dm_nr = dm.rows (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
471 octave_idx_type dm_nc = dm.cols (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
472 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
473 octave_idx_type m_nr = m.rows (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
474 octave_idx_type m_nc = m.cols (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
475 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
476 if (dm_nr != m_nr || dm_nc != m_nc) \
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
477 octave::err_nonconformant (#OP, dm_nr, dm_nc, m_nr, m_nc); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
478 else \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
479 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
480 if (m_nr > 0 && m_nc > 0) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
481 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
482 r = R (PREOP m); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
483 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
484 octave_idx_type len = dm.length (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
485 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
486 for (octave_idx_type i = 0; i < len; i++) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
487 r.elem (i, i) OPEQ dm.elem (i, i); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
488 } \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
489 else \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
490 r.resize (m_nr, m_nc); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
491 } \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
492 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
493 return r; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
494 }
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
495
25663
2de707ae8de4 eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
496 #define DMM_MULTIPLY_OP(R, DM, M) \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
497 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
498 operator * (const DM& dm, const M& m) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
499 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
500 R r; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
501 \
25663
2de707ae8de4 eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
502 R::element_type r_zero = R::element_type (); \
2de707ae8de4 eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
503 \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
504 octave_idx_type dm_nr = dm.rows (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
505 octave_idx_type dm_nc = dm.cols (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
506 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
507 octave_idx_type m_nr = m.rows (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
508 octave_idx_type m_nc = m.cols (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
509 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
510 if (dm_nc != m_nr) \
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
511 octave::err_nonconformant ("operator *", dm_nr, dm_nc, m_nr, m_nc); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
512 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
513 r = R (dm_nr, m_nc); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
514 R::element_type *rd = r.fortran_vec (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
515 const M::element_type *md = m.data (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
516 const DM::element_type *dd = dm.data (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
517 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
518 octave_idx_type len = dm.length (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
519 for (octave_idx_type i = 0; i < m_nc; i++) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
520 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
521 mx_inline_mul (len, rd, md, dd); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
522 rd += len; md += m_nr; \
25663
2de707ae8de4 eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
523 mx_inline_fill (dm_nr - len, rd, r_zero); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
524 rd += dm_nr - len; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
525 } \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
526 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
527 return r; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
528 }
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
529
25663
2de707ae8de4 eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
530 #define DMM_BIN_OPS(R, DM, M) \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
531 DMM_BIN_OP (R, operator +, DM, M, +=, ) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
532 DMM_BIN_OP (R, operator -, DM, M, +=, -) \
25663
2de707ae8de4 eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
533 DMM_MULTIPLY_OP (R, DM, M)
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
534
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
535 // diagonal matrix by diagonal matrix operations.
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
536
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
537 #define DMDM_BIN_OP(R, OP, DM1, DM2, F) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
538 R \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
539 OP (const DM1& dm1, const DM2& dm2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
540 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
541 R r; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
542 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
543 octave_idx_type dm1_nr = dm1.rows (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
544 octave_idx_type dm1_nc = dm1.cols (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
545 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
546 octave_idx_type dm2_nr = dm2.rows (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
547 octave_idx_type dm2_nc = dm2.cols (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
548 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
549 if (dm1_nr != dm2_nr || dm1_nc != dm2_nc) \
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
550 octave::err_nonconformant (#OP, dm1_nr, dm1_nc, dm2_nr, dm2_nc); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
551 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
552 r.resize (dm1_nr, dm1_nc); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
553 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
554 if (dm1_nr > 0 && dm1_nc > 0) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
555 F (dm1.length (), r.fortran_vec (), dm1.data (), dm2.data ()); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
556 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
557 return r; \
2829
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
558 }
6655bdca97fb [project @ 1997-03-25 23:58:24 by jwe]
jwe
parents:
diff changeset
559
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
560 #define DMDM_BIN_OPS(R, DM1, DM2) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
561 DMDM_BIN_OP (R, operator +, DM1, DM2, mx_inline_add) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
562 DMDM_BIN_OP (R, operator -, DM1, DM2, mx_inline_sub) \
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
563 DMDM_BIN_OP (R, product, DM1, DM2, mx_inline_mul)
2870
3241d0057e78 [project @ 1997-04-19 01:21:29 by jwe]
jwe
parents: 2847
diff changeset
564
21014
b9d4c3615e89 maint: Capitalize D for dimension in messages and comments.
Rik <rik@octave.org>
parents: 20791
diff changeset
565 // scalar by N-D array min/max ops
3582
a93683ccc9ba [project @ 2000-02-05 10:00:49 by jwe]
jwe
parents: 3504
diff changeset
566
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
567 #define SND_MINMAX_FCN(FCN, OP, T, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
568 T \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
569 FCN (S d, const T& m) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
570 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
571 return do_sm_binary_op<T::element_type, S, T::element_type> (d, m, mx_inline_x##FCN); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
572 }
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
573
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
574 #define NDS_MINMAX_FCN(FCN, OP, T, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
575 T \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
576 FCN (const T& m, S d) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
577 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
578 return do_ms_binary_op<T::element_type, T::element_type, S> (m, d, mx_inline_x##FCN); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
579 }
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
580
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
581 #define NDND_MINMAX_FCN(FCN, OP, T, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
582 T \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
583 FCN (const T& a, const T& b) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
584 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
585 return do_mm_binary_op<T::element_type, T::element_type, T::element_type> (a, b, mx_inline_x##FCN, mx_inline_x##FCN, mx_inline_x##FCN, #FCN); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
586 }
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
587
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
588 #define MINMAX_FCNS(T, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
589 SND_MINMAX_FCN (min, <, T, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
590 NDS_MINMAX_FCN (min, <, T, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
591 NDND_MINMAX_FCN (min, <, T, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
592 SND_MINMAX_FCN (max, >, T, S) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
593 NDS_MINMAX_FCN (max, >, T, S) \
10329
83fa590b8a09 simplify min/max definitions in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
594 NDND_MINMAX_FCN (max, >, T, S)
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
595
8774
b756ce0002db split implementation and interface in mx-op-defs and MArray-defs
Jaroslav Hajek <highegg@gmail.com>
parents: 8397
diff changeset
596 // permutation matrix by matrix ops and vice versa
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
597
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
598 #define PMM_MULTIPLY_OP(PM, M) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
599 M operator * (const PM& p, const M& x) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
600 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
601 octave_idx_type nr = x.rows (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
602 octave_idx_type nc = x.columns (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
603 M result; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
604 if (p.columns () != nr) \
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
605 octave::err_nonconformant ("operator *", p.rows (), p.columns (), nr, nc); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
606 else \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
607 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
608 result = M (nr, nc); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
609 result.assign (p.col_perm_vec (), idx_vector::colon, x); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
610 } \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
611 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
612 return result; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
613 }
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
614
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
615 #define MPM_MULTIPLY_OP(M, PM) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
616 M operator * (const M& x, const PM& p) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
617 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
618 octave_idx_type nr = x.rows (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
619 octave_idx_type nc = x.columns (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
620 M result; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
621 if (p.rows () != nc) \
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
622 octave::err_nonconformant ("operator *", nr, nc, p.rows (), p.columns ()); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
623 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
624 result = x.index (idx_vector::colon, p.col_perm_vec ()); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
625 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
626 return result; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
627 }
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
628
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
629 #define PMM_BIN_OPS(R, PM, M) \
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
630 PMM_MULTIPLY_OP(PM, M);
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
631
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
632 #define MPM_BIN_OPS(R, M, PM) \
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
633 MPM_MULTIPLY_OP(M, PM);
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
634
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
635 #define NDND_MAPPER_BODY(R, NAME) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
636 R retval (dims ()); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
637 octave_idx_type n = numel (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
638 for (octave_idx_type i = 0; i < n; i++) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
639 retval.xelem (i) = NAME (elem (i)); \
8998
a48fba01e4ac optimize isnan/isinf/isfinite mappers
Jaroslav Hajek <highegg@gmail.com>
parents: 8983
diff changeset
640 return retval;
a48fba01e4ac optimize isnan/isinf/isfinite mappers
Jaroslav Hajek <highegg@gmail.com>
parents: 8983
diff changeset
641
8774
b756ce0002db split implementation and interface in mx-op-defs and MArray-defs
Jaroslav Hajek <highegg@gmail.com>
parents: 8397
diff changeset
642 #endif