GNU Octave 11.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
Sparse-op-decls.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1998-2026 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_Sparse_op_decls_h)
27#define octave_Sparse_op_decls_h 1
28
29#include "octave-config.h"
30
31#include "mx-fwd.h"
32
33#define SPARSE_BIN_OP_DECL(R, OP, X, Y, API) \
34 extern API R OP (const X&, const Y&)
35
36#define SPARSE_CMP_OP_DECL(OP, X, Y, API) \
37 extern API SparseBoolMatrix OP (const X&, const Y&)
38
39#define SPARSE_BOOL_OP_DECL(OP, X, Y, API) \
40 extern API SparseBoolMatrix OP (const X&, const Y&)
41
42#define SPARSE_BOOL_OP1_DECL(OP, X, Y, API) \
43 extern API boolMatrix OP (const X&, const Y&)
44
45// sparse matrix by scalar operations.
46
47#define SPARSE_SMS_BIN_OP_DECLS(R1, R2, M, S, API) \
48 SPARSE_BIN_OP_DECL (R1, operator +, M, S, API); \
49 SPARSE_BIN_OP_DECL (R1, operator -, M, S, API); \
50 SPARSE_BIN_OP_DECL (R2, operator *, M, S, API); \
51 SPARSE_BIN_OP_DECL (R2, operator /, M, S, API);
52
53#define SPARSE_SMS_CMP_OP_DECLS(M, S, API) \
54 SPARSE_CMP_OP_DECL (mx_el_lt, M, S, API); \
55 SPARSE_CMP_OP_DECL (mx_el_le, M, S, API); \
56 SPARSE_CMP_OP_DECL (mx_el_ge, M, S, API); \
57 SPARSE_CMP_OP_DECL (mx_el_gt, M, S, API); \
58 SPARSE_CMP_OP_DECL (mx_el_eq, M, S, API); \
59 SPARSE_CMP_OP_DECL (mx_el_ne, M, S, API);
60
61#define SPARSE_SMS_EQNE_OP_DECLS(M, S, API) \
62 SPARSE_CMP_OP_DECL (mx_el_eq, M, S, API); \
63 SPARSE_CMP_OP_DECL (mx_el_ne, M, S, API);
64
65#define SPARSE_SMS_BOOL_OP_DECLS(M, S, API) \
66 SPARSE_BOOL_OP_DECL (mx_el_and, M, S, API); \
67 SPARSE_BOOL_OP1_DECL (mx_el_or, M, S, API);
68
69#define SPARSE_SMS_OP_DECLS(R1, R2, M, S, API) \
70 SPARSE_SMS_BIN_OP_DECLS (R1, R2, M, S, API) \
71 SPARSE_SMS_CMP_OP_DECLS (M, S, API) \
72 SPARSE_SMS_BOOL_OP_DECLS (M, S, API)
73
74// scalar by sparse matrix operations.
75
76#define SPARSE_SSM_BIN_OP_DECLS(R1, R2, S, M, API) \
77 SPARSE_BIN_OP_DECL (R1, operator +, S, M, API); \
78 SPARSE_BIN_OP_DECL (R1, operator -, S, M, API); \
79 SPARSE_BIN_OP_DECL (R2, operator *, S, M, API); \
80 SPARSE_BIN_OP_DECL (R1, operator /, S, M, API);
81
82#define SPARSE_SSM_CMP_OP_DECLS(S, M, API) \
83 SPARSE_CMP_OP_DECL (mx_el_lt, S, M, API); \
84 SPARSE_CMP_OP_DECL (mx_el_le, S, M, API); \
85 SPARSE_CMP_OP_DECL (mx_el_ge, S, M, API); \
86 SPARSE_CMP_OP_DECL (mx_el_gt, S, M, API); \
87 SPARSE_CMP_OP_DECL (mx_el_eq, S, M, API); \
88 SPARSE_CMP_OP_DECL (mx_el_ne, S, M, API);
89
90#define SPARSE_SSM_EQNE_OP_DECLS(S, M, API) \
91 SPARSE_CMP_OP_DECL (mx_el_eq, S, M, API); \
92 SPARSE_CMP_OP_DECL (mx_el_ne, S, M, API);
93
94#define SPARSE_SSM_BOOL_OP_DECLS(S, M, API) \
95 SPARSE_BOOL_OP_DECL (mx_el_and, S, M, API); \
96 SPARSE_BOOL_OP1_DECL (mx_el_or, S, M, API);
97
98#define SPARSE_SSM_OP_DECLS(R1, R2, S, M, API) \
99 SPARSE_SSM_BIN_OP_DECLS (R1, R2, S, M, API) \
100 SPARSE_SSM_CMP_OP_DECLS (S, M, API) \
101 SPARSE_SSM_BOOL_OP_DECLS (S, M, API) \
102
103// sparse matrix by sparse matrix operations.
104
105#define SPARSE_SMSM_BIN_OP_DECLS(R1, R2, M1, M2, API) \
106 SPARSE_BIN_OP_DECL (R1, operator +, M1, M2, API); \
107 SPARSE_BIN_OP_DECL (R1, operator -, M1, M2, API); \
108 SPARSE_BIN_OP_DECL (R2, product, M1, M2, API); \
109 SPARSE_BIN_OP_DECL (R2, quotient, M1, M2, API);
110
111#define SPARSE_SMSM_CMP_OP_DECLS(M1, M2, API) \
112 SPARSE_CMP_OP_DECL (mx_el_lt, M1, M2, API); \
113 SPARSE_CMP_OP_DECL (mx_el_le, M1, M2, API); \
114 SPARSE_CMP_OP_DECL (mx_el_ge, M1, M2, API); \
115 SPARSE_CMP_OP_DECL (mx_el_gt, M1, M2, API); \
116 SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
117 SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
118
119#define SPARSE_SMSM_EQNE_OP_DECLS(M1, M2, API) \
120 SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
121 SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
122
123#define SPARSE_SMSM_BOOL_OP_DECLS(M1, M2, API) \
124 SPARSE_BOOL_OP_DECL (mx_el_and, M1, M2, API); \
125 SPARSE_BOOL_OP_DECL (mx_el_or, M1, M2, API);
126
127#define SPARSE_SMSM_OP_DECLS(R1, R2, M1, M2, API) \
128 SPARSE_SMSM_BIN_OP_DECLS (R1, R2, M1, M2, API) \
129 SPARSE_SMSM_CMP_OP_DECLS (M1, M2, API) \
130 SPARSE_SMSM_BOOL_OP_DECLS (M1, M2, API)
131
132// matrix by sparse matrix operations.
133
134#define SPARSE_MSM_BIN_OP_DECLS(R1, R2, M1, M2, API) \
135 SPARSE_BIN_OP_DECL (R1, operator +, M1, M2, API); \
136 SPARSE_BIN_OP_DECL (R1, operator -, M1, M2, API); \
137 SPARSE_BIN_OP_DECL (R2, product, M1, M2, API); \
138 SPARSE_BIN_OP_DECL (R1, quotient, M1, M2, API);
139
140#define SPARSE_MSM_CMP_OP_DECLS(M1, M2, API) \
141 SPARSE_CMP_OP_DECL (mx_el_lt, M1, M2, API); \
142 SPARSE_CMP_OP_DECL (mx_el_le, M1, M2, API); \
143 SPARSE_CMP_OP_DECL (mx_el_ge, M1, M2, API); \
144 SPARSE_CMP_OP_DECL (mx_el_gt, M1, M2, API); \
145 SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
146 SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
147
148#define SPARSE_MSM_EQNE_OP_DECLS(M1, M2, API) \
149 SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
150 SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
151
152#define SPARSE_MSM_BOOL_OP_DECLS(M1, M2, API) \
153 SPARSE_BOOL_OP_DECL (mx_el_and, M1, M2, API); \
154 SPARSE_BOOL_OP1_DECL (mx_el_or, M1, M2, API);
155
156#define SPARSE_MSM_OP_DECLS(R1, R2, M1, M2, API) \
157 SPARSE_MSM_BIN_OP_DECLS (R1, R2, M1, M2, API) \
158 SPARSE_MSM_CMP_OP_DECLS (M1, M2, API) \
159 SPARSE_MSM_BOOL_OP_DECLS (M1, M2, API)
160
161// sparse matrix by matrix operations.
162
163#define SPARSE_SMM_BIN_OP_DECLS(R1, R2, M1, M2, API) \
164 SPARSE_BIN_OP_DECL (R1, operator +, M1, M2, API); \
165 SPARSE_BIN_OP_DECL (R1, operator -, M1, M2, API); \
166 SPARSE_BIN_OP_DECL (R2, product, M1, M2, API); \
167 SPARSE_BIN_OP_DECL (R2, quotient, M1, M2, API);
168
169#define SPARSE_SMM_CMP_OP_DECLS(M1, M2, API) \
170 SPARSE_CMP_OP_DECL (mx_el_lt, M1, M2, API); \
171 SPARSE_CMP_OP_DECL (mx_el_le, M1, M2, API); \
172 SPARSE_CMP_OP_DECL (mx_el_ge, M1, M2, API); \
173 SPARSE_CMP_OP_DECL (mx_el_gt, M1, M2, API); \
174 SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
175 SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
176
177#define SPARSE_SMM_EQNE_OP_DECLS(M1, M2, API) \
178 SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
179 SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
180
181#define SPARSE_SMM_BOOL_OP_DECLS(M1, M2, API) \
182 SPARSE_BOOL_OP_DECL (mx_el_and, M1, M2, API); \
183 SPARSE_BOOL_OP1_DECL (mx_el_or, M1, M2, API);
184
185#define SPARSE_SMM_OP_DECLS(R1, R2, M1, M2, API) \
186 SPARSE_SMM_BIN_OP_DECLS (R1, R2, M1, M2, API) \
187 SPARSE_SMM_CMP_OP_DECLS (M1, M2, API) \
188 SPARSE_SMM_BOOL_OP_DECLS (M1, M2, API)
189
190#endif