GNU Octave 10.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-2025 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// sparse matrix by scalar operations.
43
44#define SPARSE_SMS_BIN_OP_DECLS(R1, R2, M, S, API) \
45 SPARSE_BIN_OP_DECL (R1, operator +, M, S, API); \
46 SPARSE_BIN_OP_DECL (R1, operator -, M, S, API); \
47 SPARSE_BIN_OP_DECL (R2, operator *, M, S, API); \
48 SPARSE_BIN_OP_DECL (R2, operator /, M, S, API);
49
50#define SPARSE_SMS_CMP_OP_DECLS(M, S, API) \
51 SPARSE_CMP_OP_DECL (mx_el_lt, M, S, API); \
52 SPARSE_CMP_OP_DECL (mx_el_le, M, S, API); \
53 SPARSE_CMP_OP_DECL (mx_el_ge, M, S, API); \
54 SPARSE_CMP_OP_DECL (mx_el_gt, M, S, API); \
55 SPARSE_CMP_OP_DECL (mx_el_eq, M, S, API); \
56 SPARSE_CMP_OP_DECL (mx_el_ne, M, S, API);
57
58#define SPARSE_SMS_EQNE_OP_DECLS(M, S, API) \
59 SPARSE_CMP_OP_DECL (mx_el_eq, M, S, API); \
60 SPARSE_CMP_OP_DECL (mx_el_ne, M, S, API);
61
62#define SPARSE_SMS_BOOL_OP_DECLS(M, S, API) \
63 SPARSE_BOOL_OP_DECL (mx_el_and, M, S, API); \
64 SPARSE_BOOL_OP_DECL (mx_el_or, M, S, API);
65
66#define SPARSE_SMS_OP_DECLS(R1, R2, M, S, API) \
67 SPARSE_SMS_BIN_OP_DECLS (R1, R2, M, S, API) \
68 SPARSE_SMS_CMP_OP_DECLS (M, S, API) \
69 SPARSE_SMS_BOOL_OP_DECLS (M, S, API)
70
71// scalar by sparse matrix operations.
72
73#define SPARSE_SSM_BIN_OP_DECLS(R1, R2, S, M, API) \
74 SPARSE_BIN_OP_DECL (R1, operator +, S, M, API); \
75 SPARSE_BIN_OP_DECL (R1, operator -, S, M, API); \
76 SPARSE_BIN_OP_DECL (R2, operator *, S, M, API); \
77 SPARSE_BIN_OP_DECL (R2, operator /, S, M, API);
78
79#define SPARSE_SSM_CMP_OP_DECLS(S, M, API) \
80 SPARSE_CMP_OP_DECL (mx_el_lt, S, M, API); \
81 SPARSE_CMP_OP_DECL (mx_el_le, S, M, API); \
82 SPARSE_CMP_OP_DECL (mx_el_ge, S, M, API); \
83 SPARSE_CMP_OP_DECL (mx_el_gt, S, M, API); \
84 SPARSE_CMP_OP_DECL (mx_el_eq, S, M, API); \
85 SPARSE_CMP_OP_DECL (mx_el_ne, S, M, API);
86
87#define SPARSE_SSM_EQNE_OP_DECLS(S, M, API) \
88 SPARSE_CMP_OP_DECL (mx_el_eq, S, M, API); \
89 SPARSE_CMP_OP_DECL (mx_el_ne, S, M, API);
90
91#define SPARSE_SSM_BOOL_OP_DECLS(S, M, API) \
92 SPARSE_BOOL_OP_DECL (mx_el_and, S, M, API); \
93 SPARSE_BOOL_OP_DECL (mx_el_or, S, M, API); \
94
95#define SPARSE_SSM_OP_DECLS(R1, R2, S, M, API) \
96 SPARSE_SSM_BIN_OP_DECLS (R1, R2, S, M, API) \
97 SPARSE_SSM_CMP_OP_DECLS (S, M, API) \
98 SPARSE_SSM_BOOL_OP_DECLS (S, M, API) \
99
100// sparse matrix by sparse matrix operations.
101
102#define SPARSE_SMSM_BIN_OP_DECLS(R1, R2, M1, M2, API) \
103 SPARSE_BIN_OP_DECL (R1, operator +, M1, M2, API); \
104 SPARSE_BIN_OP_DECL (R1, operator -, M1, M2, API); \
105 SPARSE_BIN_OP_DECL (R2, product, M1, M2, API); \
106 SPARSE_BIN_OP_DECL (R2, quotient, M1, M2, API);
107
108#define SPARSE_SMSM_CMP_OP_DECLS(M1, M2, API) \
109 SPARSE_CMP_OP_DECL (mx_el_lt, M1, M2, API); \
110 SPARSE_CMP_OP_DECL (mx_el_le, M1, M2, API); \
111 SPARSE_CMP_OP_DECL (mx_el_ge, M1, M2, API); \
112 SPARSE_CMP_OP_DECL (mx_el_gt, M1, M2, API); \
113 SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
114 SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
115
116#define SPARSE_SMSM_EQNE_OP_DECLS(M1, M2, API) \
117 SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
118 SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
119
120#define SPARSE_SMSM_BOOL_OP_DECLS(M1, M2, API) \
121 SPARSE_BOOL_OP_DECL (mx_el_and, M1, M2, API); \
122 SPARSE_BOOL_OP_DECL (mx_el_or, M1, M2, API);
123
124#define SPARSE_SMSM_OP_DECLS(R1, R2, M1, M2, API) \
125 SPARSE_SMSM_BIN_OP_DECLS (R1, R2, M1, M2, API) \
126 SPARSE_SMSM_CMP_OP_DECLS (M1, M2, API) \
127 SPARSE_SMSM_BOOL_OP_DECLS (M1, M2, API)
128
129// matrix by sparse matrix operations.
130
131#define SPARSE_MSM_BIN_OP_DECLS(R1, R2, M1, M2, API) \
132 SPARSE_BIN_OP_DECL (R1, operator +, M1, M2, API); \
133 SPARSE_BIN_OP_DECL (R1, operator -, M1, M2, API); \
134 SPARSE_BIN_OP_DECL (R2, product, M1, M2, API); \
135 SPARSE_BIN_OP_DECL (R2, quotient, M1, M2, API);
136
137#define SPARSE_MSM_CMP_OP_DECLS(M1, M2, API) \
138 SPARSE_CMP_OP_DECL (mx_el_lt, M1, M2, API); \
139 SPARSE_CMP_OP_DECL (mx_el_le, M1, M2, API); \
140 SPARSE_CMP_OP_DECL (mx_el_ge, M1, M2, API); \
141 SPARSE_CMP_OP_DECL (mx_el_gt, M1, M2, API); \
142 SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
143 SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
144
145#define SPARSE_MSM_EQNE_OP_DECLS(M1, M2, API) \
146 SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
147 SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
148
149#define SPARSE_MSM_BOOL_OP_DECLS(M1, M2, API) \
150 SPARSE_BOOL_OP_DECL (mx_el_and, M1, M2, API); \
151 SPARSE_BOOL_OP_DECL (mx_el_or, M1, M2, API);
152
153#define SPARSE_MSM_OP_DECLS(R1, R2, M1, M2, API) \
154 SPARSE_MSM_BIN_OP_DECLS (R1, R2, M1, M2, API) \
155 SPARSE_MSM_CMP_OP_DECLS (M1, M2, API) \
156 SPARSE_MSM_BOOL_OP_DECLS (M1, M2, API)
157
158// sparse matrix by matrix operations.
159
160#define SPARSE_SMM_BIN_OP_DECLS(R1, R2, M1, M2, API) \
161 SPARSE_BIN_OP_DECL (R1, operator +, M1, M2, API); \
162 SPARSE_BIN_OP_DECL (R1, operator -, M1, M2, API); \
163 SPARSE_BIN_OP_DECL (R2, product, M1, M2, API); \
164 SPARSE_BIN_OP_DECL (R2, quotient, M1, M2, API);
165
166#define SPARSE_SMM_CMP_OP_DECLS(M1, M2, API) \
167 SPARSE_CMP_OP_DECL (mx_el_lt, M1, M2, API); \
168 SPARSE_CMP_OP_DECL (mx_el_le, M1, M2, API); \
169 SPARSE_CMP_OP_DECL (mx_el_ge, M1, M2, API); \
170 SPARSE_CMP_OP_DECL (mx_el_gt, M1, M2, API); \
171 SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
172 SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
173
174#define SPARSE_SMM_EQNE_OP_DECLS(M1, M2, API) \
175 SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \
176 SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API);
177
178#define SPARSE_SMM_BOOL_OP_DECLS(M1, M2, API) \
179 SPARSE_BOOL_OP_DECL (mx_el_and, M1, M2, API); \
180 SPARSE_BOOL_OP_DECL (mx_el_or, M1, M2, API);
181
182#define SPARSE_SMM_OP_DECLS(R1, R2, M1, M2, API) \
183 SPARSE_SMM_BIN_OP_DECLS (R1, R2, M1, M2, API) \
184 SPARSE_SMM_CMP_OP_DECLS (M1, M2, API) \
185 SPARSE_SMM_BOOL_OP_DECLS (M1, M2, API)
186
187#endif