GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Sparse-op-decls.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2004-2015 David Bateman
4 Copyright (C) 1998-2004 Andy Adler
5 Copyright (C) 2008 Jaroslav Hajek
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_Sparse_op_decls_h)
26 #define octave_Sparse_op_decls_h 1
27 
28 class SparseBoolMatrix;
29 
30 #define SPARSE_BIN_OP_DECL(R, OP, X, Y, API) \
31  extern API R OP (const X&, const Y&)
32 
33 #define SPARSE_CMP_OP_DECL(OP, X, Y, API) \
34  extern API SparseBoolMatrix OP (const X&, const Y&)
35 
36 #define SPARSE_BOOL_OP_DECL(OP, X, Y, API) \
37  extern API SparseBoolMatrix OP (const X&, const Y&)
38 
39 // sparse matrix by scalar operations.
40 
41 #define SPARSE_SMS_BIN_OP_DECLS(R1, R2, M, S, API) \
42  SPARSE_BIN_OP_DECL (R1, operator +, M, S, API); \
43  SPARSE_BIN_OP_DECL (R1, operator -, M, S, API); \
44  SPARSE_BIN_OP_DECL (R2, operator *, M, S, API); \
45  SPARSE_BIN_OP_DECL (R2, operator /, M, S, API);
46 
47 #define SPARSE_SMS_CMP_OP_DECLS(M, S, API) \
48  SPARSE_CMP_OP_DECL (mx_el_lt, M, S, API); \
49  SPARSE_CMP_OP_DECL (mx_el_le, M, S, API); \
50  SPARSE_CMP_OP_DECL (mx_el_ge, M, S, API); \
51  SPARSE_CMP_OP_DECL (mx_el_gt, M, S, API); \
52  SPARSE_CMP_OP_DECL (mx_el_eq, M, S, API); \
53  SPARSE_CMP_OP_DECL (mx_el_ne, M, S, API);
54 
55 #define SPARSE_SMS_EQNE_OP_DECLS(M, S, API) \
56  SPARSE_CMP_OP_DECL (mx_el_eq, M, S, API); \
57  SPARSE_CMP_OP_DECL (mx_el_ne, M, S, API);
58 
59 #define SPARSE_SMS_BOOL_OP_DECLS(M, S, API) \
60  SPARSE_BOOL_OP_DECL (mx_el_and, M, S, API); \
61  SPARSE_BOOL_OP_DECL (mx_el_or, M, S, API);
62 
63 #define SPARSE_SMS_OP_DECLS(R1, R2, M, S, API) \
64  SPARSE_SMS_BIN_OP_DECLS (R1, R2, M, S, API) \
65  SPARSE_SMS_CMP_OP_DECLS (M, S, API) \
66  SPARSE_SMS_BOOL_OP_DECLS (M, S, API)
67 
68 // scalar by sparse matrix operations.
69 
70 #define SPARSE_SSM_BIN_OP_DECLS(R1, R2, S, M, API) \
71  SPARSE_BIN_OP_DECL (R1, operator +, S, M, API); \
72  SPARSE_BIN_OP_DECL (R1, operator -, S, M, API); \
73  SPARSE_BIN_OP_DECL (R2, operator *, S, M, API); \
74  SPARSE_BIN_OP_DECL (R2, operator /, S, M, API);
75 
76 #define SPARSE_SSM_CMP_OP_DECLS(S, M, API) \
77  SPARSE_CMP_OP_DECL (mx_el_lt, S, M, API); \
78  SPARSE_CMP_OP_DECL (mx_el_le, S, M, API); \
79  SPARSE_CMP_OP_DECL (mx_el_ge, S, M, API); \
80  SPARSE_CMP_OP_DECL (mx_el_gt, S, M, API); \
81  SPARSE_CMP_OP_DECL (mx_el_eq, S, M, API); \
82  SPARSE_CMP_OP_DECL (mx_el_ne, S, M, API);
83 
84 #define SPARSE_SSM_EQNE_OP_DECLS(S, M, API) \
85  SPARSE_CMP_OP_DECL (mx_el_eq, S, M, API); \
86  SPARSE_CMP_OP_DECL (mx_el_ne, S, M, API);
87 
88 #define SPARSE_SSM_BOOL_OP_DECLS(S, M, API) \
89  SPARSE_BOOL_OP_DECL (mx_el_and, S, M, API); \
90  SPARSE_BOOL_OP_DECL (mx_el_or, S, M, API); \
91 
92 #define SPARSE_SSM_OP_DECLS(R1, R2, S, M, API) \
93  SPARSE_SSM_BIN_OP_DECLS (R1, R2, S, M, API) \
94  SPARSE_SSM_CMP_OP_DECLS (S, M, API) \
95  SPARSE_SSM_BOOL_OP_DECLS (S, M, API) \
96 
97 // sparse matrix by sparse matrix operations.
98 
99 #define SPARSE_SMSM_BIN_OP_DECLS(R1, R2, M1, M2, API) \
100  SPARSE_BIN_OP_DECL (R1, operator +, M1, M2, API); \
101  SPARSE_BIN_OP_DECL (R1, operator -, M1, M2, API); \
102  SPARSE_BIN_OP_DECL (R2, product, M1, M2, API); \
103  SPARSE_BIN_OP_DECL (R2, quotient, M1, M2, API);
104 
105 #define SPARSE_SMSM_CMP_OP_DECLS(M1, M2, API) \
106  SPARSE_CMP_OP_DECL (mx_el_lt, M1, M2, API); \
107  SPARSE_CMP_OP_DECL (mx_el_le, M1, M2, API); \
108  SPARSE_CMP_OP_DECL (mx_el_ge, M1, M2, API); \
109  SPARSE_CMP_OP_DECL (mx_el_gt, M1, M2, API); \
110  SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
111  SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
112 
113 #define SPARSE_SMSM_EQNE_OP_DECLS(M1, M2, API) \
114  SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
115  SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
116 
117 #define SPARSE_SMSM_BOOL_OP_DECLS(M1, M2, API) \
118  SPARSE_BOOL_OP_DECL (mx_el_and, M1, M2, API); \
119  SPARSE_BOOL_OP_DECL (mx_el_or, M1, M2, API);
120 
121 #define SPARSE_SMSM_OP_DECLS(R1, R2, M1, M2, API) \
122  SPARSE_SMSM_BIN_OP_DECLS (R1, R2, M1, M2, API) \
123  SPARSE_SMSM_CMP_OP_DECLS (M1, M2, API) \
124  SPARSE_SMSM_BOOL_OP_DECLS (M1, M2, API)
125 
126 // matrix by sparse matrix operations.
127 
128 #define SPARSE_MSM_BIN_OP_DECLS(R1, R2, M1, M2, API) \
129  SPARSE_BIN_OP_DECL (R1, operator +, M1, M2, API); \
130  SPARSE_BIN_OP_DECL (R1, operator -, M1, M2, API); \
131  SPARSE_BIN_OP_DECL (R2, product, M1, M2, API); \
132  SPARSE_BIN_OP_DECL (R2, quotient, M1, M2, API);
133 
134 #define SPARSE_MSM_CMP_OP_DECLS(M1, M2, API) \
135  SPARSE_CMP_OP_DECL (mx_el_lt, M1, M2, API); \
136  SPARSE_CMP_OP_DECL (mx_el_le, M1, M2, API); \
137  SPARSE_CMP_OP_DECL (mx_el_ge, M1, M2, API); \
138  SPARSE_CMP_OP_DECL (mx_el_gt, M1, M2, API); \
139  SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
140  SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
141 
142 #define SPARSE_MSM_EQNE_OP_DECLS(M1, M2, API) \
143  SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
144  SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
145 
146 #define SPARSE_MSM_BOOL_OP_DECLS(M1, M2, API) \
147  SPARSE_BOOL_OP_DECL (mx_el_and, M1, M2, API); \
148  SPARSE_BOOL_OP_DECL (mx_el_or, M1, M2, API);
149 
150 #define SPARSE_MSM_OP_DECLS(R1, R2, M1, M2, API) \
151  SPARSE_MSM_BIN_OP_DECLS (R1, R2, M1, M2, API) \
152  SPARSE_MSM_CMP_OP_DECLS (M1, M2, API) \
153  SPARSE_MSM_BOOL_OP_DECLS (M1, M2, API)
154 
155 // sparse matrix by matrix operations.
156 
157 #define SPARSE_SMM_BIN_OP_DECLS(R1, R2, M1, M2, API) \
158  SPARSE_BIN_OP_DECL (R1, operator +, M1, M2, API); \
159  SPARSE_BIN_OP_DECL (R1, operator -, M1, M2, API); \
160  SPARSE_BIN_OP_DECL (R2, product, M1, M2, API); \
161  SPARSE_BIN_OP_DECL (R2, quotient, M1, M2, API);
162 
163 #define SPARSE_SMM_CMP_OP_DECLS(M1, M2, API) \
164  SPARSE_CMP_OP_DECL (mx_el_lt, M1, M2, API); \
165  SPARSE_CMP_OP_DECL (mx_el_le, M1, M2, API); \
166  SPARSE_CMP_OP_DECL (mx_el_ge, M1, M2, API); \
167  SPARSE_CMP_OP_DECL (mx_el_gt, M1, M2, API); \
168  SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
169  SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
170 
171 #define SPARSE_SMM_EQNE_OP_DECLS(M1, M2, API) \
172  SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
173  SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
174 
175 #define SPARSE_SMM_BOOL_OP_DECLS(M1, M2, API) \
176  SPARSE_BOOL_OP_DECL (mx_el_and, M1, M2, API); \
177  SPARSE_BOOL_OP_DECL (mx_el_or, M1, M2, API);
178 
179 #define SPARSE_SMM_OP_DECLS(R1, R2, M1, M2, API) \
180  SPARSE_SMM_BIN_OP_DECLS (R1, R2, M1, M2, API) \
181  SPARSE_SMM_CMP_OP_DECLS (M1, M2, API) \
182  SPARSE_SMM_BOOL_OP_DECLS (M1, M2, API)
183 
184 #endif