@@ -228,15 +228,16 @@ public:
228
228
This proposal also introduces the specialization of the `sycl::marray` class to
229
229
support SYCL `complex`. The `marray` class undergoes slight modification for
230
230
this specialization, primarily involving the removal of operators that are
231
- inapplicable. No new functions or operators are introduced to the `marray`
232
- class.
231
+ inapplicable and implementing the operators that are *only* supported by
232
+ `complex<T>`.
233
+ No new functions or operators are introduced to the `marray` class.
233
234
234
235
The `complex`'s `marray` specialization maintains the principles of trivial
235
236
copyability (as seen in the <<Complex Class, `complex` class description>>),
236
237
with the `is_device_copyable` type trait resolving to `std::true_type`.
237
238
238
239
The `marray` specialization for `complex<T>` deletes any operator that is not
239
- supported by `complex<T>`.
240
+ supported by `complex<T>` and implements the ones supported .
240
241
241
242
```C++
242
243
namespace sycl {
@@ -248,6 +249,75 @@ public:
248
249
249
250
/* ... */
250
251
252
+ /// Adds and assigns marray rhs to marray lhs.
253
+ friend marray &operator +=(marray &lhs, const marray &rhs);
254
+ /// Adds and assigns complex number rhs to marray lhs.
255
+ friend marray &operator +=(marray &lhs, const value_type &rhs);
256
+
257
+ /// Subtracts and assigns marray rhs to marray lhs.
258
+ friend marray &operator -=(marray &lhs, const marray &rhs);
259
+ /// Subtracts and assigns complex number rhs to marray lhs.
260
+ friend marray &operator -=(marray &lhs, const value_type &rhs);
261
+
262
+ /// Multiplies and assigns marray rhs to marray lhs.
263
+ friend marray &operator *=(marray &lhs, const marray &rhs);
264
+ /// Multiplies and assigns complex number rhs to marray lhs.
265
+ friend marray &operator *=(marray &lhs, const value_type &rhs);
266
+
267
+ /// Divides and assigns marray rhs to marray lhs.
268
+ friend marray &operator /=(marray &lhs, const marray &rhs);
269
+ /// Divides and assigns complex number rhs to marray lhs.
270
+ friend marray &operator /=(marray &lhs, const value_type &rhs);
271
+
272
+ /// Returns a copy of the input marray.
273
+ friend marray operator +(const marray &lhs);
274
+ /// Negates each element of the input marray.
275
+ friend marray operator -(const marray &lhs);
276
+
277
+ /// Adds marray rhs and marray lhs and returns the result.
278
+ friend marray operator +(const marray &lhs, const marray &rhs);
279
+ /// Adds complex number rhs and marray lhs and returns the result.
280
+ friend marray operator +(const marray &lhs, const value_type &rhs);
281
+ /// Adds marray rhs and complex number lhs and returns the result.
282
+ friend marray operator +(const value_type &lhs, const marray &rhs);
283
+
284
+ /// Subtracts marray rhs and marray lhs and returns the result.
285
+ friend marray operator -(const marray &lhs, const marray &rhs);
286
+ /// Subtracts complex number rhs and marray lhs and returns the result.
287
+ friend marray operator -(const marray &lhs, const value_type &rhs);
288
+ /// Subtracts marray rhs and complex number lhs and returns the result.
289
+ friend marray operator -(const value_type &lhs, const marray &rhs);
290
+
291
+ /// Mulitplies marray rhs and marray lhs and returns the result.
292
+ friend marray operator *(const marray &lhs, const marray &rhs);
293
+ /// Multiplies complex number rhs and marray lhs and returns the result.
294
+ friend marray operator *(const marray &lhs, const value_type &rhs);
295
+ /// Multiplies marray rhs and complex number lhs and returns the result.
296
+ friend marray operator *(const value_type &lhs, const marray &rhs);
297
+
298
+ /// Divides marray rhs and marray lhs and returns the result.
299
+ friend marray operator /(const marray &lhs, const marray &rhs);
300
+ /// Divides complex number rhs and marray lhs and returns the result.
301
+ friend marray operator /(const marray &lhs, const value_type &rhs);
302
+ /// Divides marray rhs and complex number lhs and returns the result.
303
+ friend marray operator /(const value_type &lhs, const marray &rhs);
304
+
305
+ /// Compares marray rhs and marray lhs, returning an marray of booleans where each element is true if the corresponding elements in lhs and rhs are the same, otherwise false.
306
+ friend marray<bool, NumElements> operator ==(const marray &lhs, const marray &rhs);
307
+ /// Compares complex number rhs and marray lhs, returning an marray of booleans where each element is true if the corresponding elements in lhs and rhs are the same, otherwise false.
308
+ friend marray<bool, NumElements> operator ==(const marray &lhs, const value_type &rhs);
309
+ /// Compares marray rhs and complex number lhs, returning an marray of booleans where each element is true if the corresponding elements in lhs and rhs are the same, otherwise false.
310
+ friend marray<bool, NumElements> operator ==(const value_type &lhs, const marray &rhs);
311
+
312
+ /// Compares marray rhs and marray lhs, returning an marray of booleans where each element is true if the corresponding elements in lhs and rhs differs, otherwise false.
313
+ friend marray<bool, NumElements> operator !=(const marray &lhs, const marray &rhs);
314
+ /// Compares complex number rhs and marray lhs, returning an marray of booleans where each element is true if the corresponding elements in lhs and rhs differs, otherwise false.
315
+ friend marray<bool, NumElements> operator !=(const marray &lhs, const value_type &rhs);
316
+ /// Compares marray rhs and complex number lhs, returning an marray of booleans where each element is true if the corresponding elements in lhs and rhs dffers, otherwise false.
317
+ friend marray<bool, NumElements> operator !=(const value_type &lhs, const marray &rhs);
318
+
319
+ /* ... */
320
+
251
321
friend marray operator %(const marray &lhs, const marray &rhs) = delete;
252
322
friend marray operator %(const marray &lhs, const value_type &rhs) = delete;
253
323
friend marray operator %(const value_type &lhs, const marray &rhs) = delete;
0 commit comments