Mercurial > octave
comparison liboctave/array/MSparse.h @ 22197:e43d83253e28
refill multi-line macro definitions
Use the Emacs C++ mode style for line continuation markers in
multi-line macro definitions.
* make_int.cc, __dsearchn__.cc, __magick_read__.cc, besselj.cc,
bitfcns.cc, bsxfun.cc, cellfun.cc, data.cc, defun-dld.h, defun-int.h,
defun.h, det.cc, error.h, find.cc, gcd.cc, graphics.cc, interpreter.h,
jit-ir.h, jit-typeinfo.h, lookup.cc, ls-mat5.cc, max.cc, mexproto.h,
mxarray.in.h, oct-stream.cc, ordschur.cc, pr-output.cc, profiler.h,
psi.cc, regexp.cc, sparse-xdiv.cc, sparse-xpow.cc, tril.cc, txt-eng.h,
utils.cc, variables.cc, variables.h, xdiv.cc, xpow.cc, __glpk__.cc,
ov-base.cc, ov-base.h, ov-cell.cc, ov-ch-mat.cc, ov-classdef.cc,
ov-complex.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-float.cc, ov-float.h,
ov-flt-complex.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc,
ov-int-traits.h, ov-lazy-idx.h, ov-perm.cc, ov-re-mat.cc,
ov-re-sparse.cc, ov-scalar.cc, ov-scalar.h, ov-str-mat.cc,
ov-type-conv.h, ov.cc, ov.h, op-class.cc, op-int-conv.cc, op-int.h,
op-str-str.cc, ops.h, lex.ll, Array.cc, CMatrix.cc, CSparse.cc,
MArray.cc, MArray.h, MDiagArray2.cc, MDiagArray2.h, MSparse.h,
Sparse.cc, dMatrix.cc, dSparse.cc, fCMatrix.cc, fMatrix.cc,
idx-vector.cc, f77-fcn.h, quit.h, bsxfun-decl.h, bsxfun-defs.cc,
lo-specfun.cc, oct-convn.cc, oct-convn.h, oct-norm.cc, oct-norm.h,
oct-rand.cc, Sparse-op-decls.h, Sparse-op-defs.h, mx-inlines.cc,
mx-op-decl.h, mx-op-defs.h, mach-info.cc, oct-group.cc, oct-passwd.cc,
oct-syscalls.cc, oct-time.cc, data-conv.cc, kpse.cc, lo-ieee.h,
lo-macros.h, oct-cmplx.h, oct-glob.cc, oct-inttypes.cc,
oct-inttypes.h, oct-locbuf.h, oct-sparse.h, url-transfer.cc,
oct-conf-post.in.h, shared-fcns.h: Refill macro definitions.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 01 Aug 2016 12:40:18 -0400 |
parents | 952854b61ac9 |
children | bac0d6f07a3e |
comparison
equal
deleted
inserted
replaced
22196:dd992fd74fce | 22197:e43d83253e28 |
---|---|
121 | 121 |
122 // Include operator templates for MSparse | 122 // Include operator templates for MSparse |
123 #include "MSparse.cc" | 123 #include "MSparse.cc" |
124 | 124 |
125 // A macro that can be used to declare and instantiate OP= operators. | 125 // A macro that can be used to declare and instantiate OP= operators. |
126 #define SPARSE_OP_ASSIGN_DECL(T, OP, API) \ | 126 #define SPARSE_OP_ASSIGN_DECL(T, OP, API) \ |
127 template API MSparse<T>& \ | 127 template API MSparse<T>& \ |
128 operator OP (MSparse<T>&, const MSparse<T>&) | 128 operator OP (MSparse<T>&, const MSparse<T>&) |
129 | 129 |
130 // A macro that can be used to declare and instantiate unary operators. | 130 // A macro that can be used to declare and instantiate unary operators. |
131 #define SPARSE_UNOP_DECL(T, OP, API) \ | 131 #define SPARSE_UNOP_DECL(T, OP, API) \ |
132 template API MSparse<T> \ | 132 template API MSparse<T> \ |
133 operator OP (const MSparse<T>&) | 133 operator OP (const MSparse<T>&) |
134 | 134 |
135 // A macro that can be used to declare and instantiate binary operators. | 135 // A macro that can be used to declare and instantiate binary operators. |
136 #define SPARSE_BINOP_DECL(A_T, T, F, API, X_T, Y_T) \ | 136 #define SPARSE_BINOP_DECL(A_T, T, F, API, X_T, Y_T) \ |
137 template API A_T<T> \ | 137 template API A_T<T> \ |
138 F (const X_T&, const Y_T&) | 138 F (const X_T&, const Y_T&) |
139 | 139 |
140 // A function that can be used to forward OP= operations from derived | 140 // A function that can be used to forward OP= operations from derived |
141 // classes back to us. | 141 // classes back to us. |
142 #define SPARSE_OP_ASSIGN_FWD_FCN(R, F, T, C_X, X_T, C_Y, Y_T) \ | 142 #define SPARSE_OP_ASSIGN_FWD_FCN(R, F, T, C_X, X_T, C_Y, Y_T) \ |
143 inline R \ | 143 inline R \ |
144 F (X_T& x, const Y_T& y) \ | 144 F (X_T& x, const Y_T& y) \ |
145 { \ | 145 { \ |
146 return R (F (C_X (x), C_Y (y))); \ | 146 return R (F (C_X (x), C_Y (y))); \ |
147 } | 147 } |
148 | 148 |
149 // A function that can be used to forward unary operations from derived | 149 // A function that can be used to forward unary operations from derived |
150 // classes back to us. | 150 // classes back to us. |
151 #define SPARSE_UNOP_FWD_FCN(R, F, T, C_X, X_T) \ | 151 #define SPARSE_UNOP_FWD_FCN(R, F, T, C_X, X_T) \ |
152 inline R \ | 152 inline R \ |
153 F (const X_T& x) \ | 153 F (const X_T& x) \ |
154 { \ | 154 { \ |
155 return R (F (C_X (x))); \ | 155 return R (F (C_X (x))); \ |
156 } | 156 } |
157 | 157 |
158 // A function that can be used to forward binary operations from derived | 158 // A function that can be used to forward binary operations from derived |
159 // classes back to us. | 159 // classes back to us. |
160 #define SPARSE_BINOP_FWD_FCN(R, F, T, C_X, X_T, C_Y, Y_T) \ | 160 #define SPARSE_BINOP_FWD_FCN(R, F, T, C_X, X_T, C_Y, Y_T) \ |
161 inline R \ | 161 inline R \ |
162 F (const X_T& x, const Y_T& y) \ | 162 F (const X_T& x, const Y_T& y) \ |
163 { \ | 163 { \ |
164 return R (F (C_X (x), C_Y (y))); \ | 164 return R (F (C_X (x), C_Y (y))); \ |
165 } | 165 } |
166 | 166 |
167 // Instantiate all the MSparse friends for MSparse element type T. | 167 // Instantiate all the MSparse friends for MSparse element type T. |
168 #define INSTANTIATE_SPARSE_FRIENDS(T, API) \ | 168 #define INSTANTIATE_SPARSE_FRIENDS(T, API) \ |
169 SPARSE_OP_ASSIGN_DECL (T, +=, API); \ | 169 SPARSE_OP_ASSIGN_DECL (T, +=, API); \ |
170 SPARSE_OP_ASSIGN_DECL (T, -=, API); \ | 170 SPARSE_OP_ASSIGN_DECL (T, -=, API); \ |
171 SPARSE_UNOP_DECL (T, +, API); \ | 171 SPARSE_UNOP_DECL (T, +, API); \ |
172 SPARSE_UNOP_DECL (T, -, API); \ | 172 SPARSE_UNOP_DECL (T, -, API); \ |
173 SPARSE_BINOP_DECL (MArray, T, operator +, API, MSparse<T>, T); \ | 173 SPARSE_BINOP_DECL (MArray, T, operator +, API, MSparse<T>, T); \ |
174 SPARSE_BINOP_DECL (MArray, T, operator -, API, MSparse<T>, T); \ | 174 SPARSE_BINOP_DECL (MArray, T, operator -, API, MSparse<T>, T); \ |
175 SPARSE_BINOP_DECL (MSparse, T, operator *, API, MSparse<T>, T); \ | 175 SPARSE_BINOP_DECL (MSparse, T, operator *, API, MSparse<T>, T); \ |
176 SPARSE_BINOP_DECL (MSparse, T, operator /, API, MSparse<T>, T); \ | 176 SPARSE_BINOP_DECL (MSparse, T, operator /, API, MSparse<T>, T); \ |
177 SPARSE_BINOP_DECL (MArray, T, operator +, API, T, MSparse<T>); \ | 177 SPARSE_BINOP_DECL (MArray, T, operator +, API, T, MSparse<T>); \ |
178 SPARSE_BINOP_DECL (MArray, T, operator -, API, T, MSparse<T>); \ | 178 SPARSE_BINOP_DECL (MArray, T, operator -, API, T, MSparse<T>); \ |
179 SPARSE_BINOP_DECL (MSparse, T, operator *, API, T, MSparse<T>); \ | 179 SPARSE_BINOP_DECL (MSparse, T, operator *, API, T, MSparse<T>); \ |
180 SPARSE_BINOP_DECL (MSparse, T, operator /, API, T, MSparse<T>); \ | 180 SPARSE_BINOP_DECL (MSparse, T, operator /, API, T, MSparse<T>); \ |
181 SPARSE_BINOP_DECL (MSparse, T, operator +, API, MSparse<T>, MSparse<T>); \ | 181 SPARSE_BINOP_DECL (MSparse, T, operator +, API, MSparse<T>, MSparse<T>); \ |
182 SPARSE_BINOP_DECL (MSparse, T, operator -, API, MSparse<T>, MSparse<T>); \ | 182 SPARSE_BINOP_DECL (MSparse, T, operator -, API, MSparse<T>, MSparse<T>); \ |
183 SPARSE_BINOP_DECL (MSparse, T, quotient, API, MSparse<T>, MSparse<T>); \ | 183 SPARSE_BINOP_DECL (MSparse, T, quotient, API, MSparse<T>, MSparse<T>); \ |
184 SPARSE_BINOP_DECL (MSparse, T, product, API, MSparse<T>, MSparse<T>); | 184 SPARSE_BINOP_DECL (MSparse, T, product, API, MSparse<T>, MSparse<T>); |
185 | 185 |
186 // Define all the MSparse forwarding functions for return type R and | 186 // Define all the MSparse forwarding functions for return type R and |
187 // MSparse element type T | 187 // MSparse element type T |
188 #define SPARSE_FORWARD_DEFS(B, R, F, T) \ | 188 #define SPARSE_FORWARD_DEFS(B, R, F, T) \ |
189 SPARSE_OP_ASSIGN_FWD_FCN \ | 189 SPARSE_OP_ASSIGN_FWD_FCN (R, operator +=, T, dynamic_cast<B<T>&>, \ |
190 (R, operator +=, T, dynamic_cast<B<T>&>, R, dynamic_cast<const B<T>&>, R) \ | 190 R, dynamic_cast<const B<T>&>, R) \ |
191 SPARSE_OP_ASSIGN_FWD_FCN \ | 191 SPARSE_OP_ASSIGN_FWD_FCN (R, operator -=, T, dynamic_cast<B<T>&>, \ |
192 (R, operator -=, T, dynamic_cast<B<T>&>, R, dynamic_cast<const B<T>&>, R) \ | 192 R, dynamic_cast<const B<T>&>, R) \ |
193 SPARSE_UNOP_FWD_FCN (R, operator +, T, dynamic_cast<const B<T>&>, R) \ | 193 SPARSE_UNOP_FWD_FCN (R, operator +, T, dynamic_cast<const B<T>&>, R) \ |
194 SPARSE_UNOP_FWD_FCN (R, operator -, T, dynamic_cast<const B<T>&>, R) \ | 194 SPARSE_UNOP_FWD_FCN (R, operator -, T, dynamic_cast<const B<T>&>, R) \ |
195 SPARSE_BINOP_FWD_FCN (F, operator +, T, dynamic_cast<const B<T>&>, R, , T) \ | 195 SPARSE_BINOP_FWD_FCN (F, operator +, T, dynamic_cast<const B<T>&>, R, , T) \ |
196 SPARSE_BINOP_FWD_FCN (F, operator -, T, dynamic_cast<const B<T>&>, R, , T) \ | 196 SPARSE_BINOP_FWD_FCN (F, operator -, T, dynamic_cast<const B<T>&>, R, , T) \ |
197 SPARSE_BINOP_FWD_FCN (R, operator *, T, dynamic_cast<const B<T>&>, R, , T) \ | 197 SPARSE_BINOP_FWD_FCN (R, operator *, T, dynamic_cast<const B<T>&>, R, , T) \ |
198 SPARSE_BINOP_FWD_FCN (R, operator /, T, dynamic_cast<const B<T>&>, R, , T) \ | 198 SPARSE_BINOP_FWD_FCN (R, operator /, T, dynamic_cast<const B<T>&>, R, , T) \ |
199 SPARSE_BINOP_FWD_FCN (F, operator +, T, , T, dynamic_cast<const B<T>&>, R) \ | 199 SPARSE_BINOP_FWD_FCN (F, operator +, T, , T, dynamic_cast<const B<T>&>, R) \ |
200 SPARSE_BINOP_FWD_FCN (F, operator -, T, , T, dynamic_cast<const B<T>&>, R) \ | 200 SPARSE_BINOP_FWD_FCN (F, operator -, T, , T, dynamic_cast<const B<T>&>, R) \ |
201 SPARSE_BINOP_FWD_FCN (R, operator *, T, , T, dynamic_cast<const B<T>&>, R) \ | 201 SPARSE_BINOP_FWD_FCN (R, operator *, T, , T, dynamic_cast<const B<T>&>, R) \ |
202 SPARSE_BINOP_FWD_FCN (R, operator /, T, , T, dynamic_cast<const B<T>&>, R) \ | 202 SPARSE_BINOP_FWD_FCN (R, operator /, T, , T, dynamic_cast<const B<T>&>, R) \ |
203 SPARSE_BINOP_FWD_FCN \ | 203 SPARSE_BINOP_FWD_FCN (R, operator +, T, dynamic_cast<const B<T>&>, \ |
204 (R, operator +, T, dynamic_cast<const B<T>&>, R, \ | 204 R, dynamic_cast<const B<T>&>, R) \ |
205 dynamic_cast<const B<T>&>, R) \ | 205 SPARSE_BINOP_FWD_FCN (R, operator -, T, dynamic_cast<const B<T>&>, \ |
206 SPARSE_BINOP_FWD_FCN \ | 206 R, dynamic_cast<const B<T>&>, R) \ |
207 (R, operator -, T, dynamic_cast<const B<T>&>, R, \ | 207 SPARSE_BINOP_FWD_FCN (R, product, T, dynamic_cast<const B<T>&>, \ |
208 dynamic_cast<const B<T>&>, R) \ | 208 R, dynamic_cast<const B<T>&>, R) \ |
209 SPARSE_BINOP_FWD_FCN \ | 209 SPARSE_BINOP_FWD_FCN (R, quotient, T, dynamic_cast<const B<T>&>, \ |
210 (R, product, T, dynamic_cast<const B<T>&>, R, \ | 210 R, dynamic_cast<const B<T>&>, R) |
211 dynamic_cast<const B<T>&>, R) \ | |
212 SPARSE_BINOP_FWD_FCN \ | |
213 (R, quotient, T, dynamic_cast<const B<T>&>, R, \ | |
214 dynamic_cast<const B<T>&>, R) | |
215 | 211 |
216 #endif | 212 #endif |