diff --git a/sycl/doc/extensions/experimental/sycl_ext_oneapi_complex.asciidoc b/sycl/doc/extensions/experimental/sycl_ext_oneapi_complex.asciidoc index e4eb444f1ed60..f99898f7f5ad3 100644 --- a/sycl/doc/extensions/experimental/sycl_ext_oneapi_complex.asciidoc +++ b/sycl/doc/extensions/experimental/sycl_ext_oneapi_complex.asciidoc @@ -205,7 +205,7 @@ public: /// Compares complex numbers z and w and returns true if they are different, otherwise false. friend constexpr bool operator!=(const complex &z, const complex &w); - ///Compares complex number z and real y and returns true if they are different, otherwise false. + /// Compares complex number z and real y and returns true if they are different, otherwise false. friend constexpr bool operator!=(const complex &z, value_type y); /// Compares real x and complex number w and returns true if they are different, otherwise false. friend constexpr bool operator!=(value_type x, const complex &w); @@ -228,15 +228,16 @@ public: This proposal also introduces the specialization of the `sycl::marray` class to support SYCL `complex`. The `marray` class undergoes slight modification for this specialization, primarily involving the removal of operators that are -inapplicable. No new functions or operators are introduced to the `marray` -class. +inapplicable and implementing the operators that are *only* supported by +`complex`. +No new functions or operators are introduced to the `marray` class. The `complex`'s `marray` specialization maintains the principles of trivial copyability (as seen in the <>), with the `is_device_copyable` type trait resolving to `std::true_type`. The `marray` specialization for `complex` deletes any operator that is not -supported by `complex`. +supported by `complex` and implements the ones supported. ```C++ namespace sycl { @@ -248,74 +249,155 @@ public: /* ... */ - friend marray operator %(const marray &lhs, const marray &rhs) = delete; - friend marray operator %(const marray &lhs, const value_type &rhs) = delete; - friend marray operator %(const value_type &lhs, const marray &rhs) = delete; + /// Adds marray rhs to marray lhs and assigns the result to lhs. + friend marray &operator +=(marray &lhs, const marray &rhs); + /// Adds complex number rhs to marray lhs and assigns the result to lhs. + friend marray &operator +=(marray &lhs, const value_type &rhs); + + /// Subtracts marray rhs from marray lhs and assigns the result to lhs. + friend marray &operator -=(marray &lhs, const marray &rhs); + /// Subtracts complex number rhs from marray lhs and assigns the result to lhs. + friend marray &operator -=(marray &lhs, const value_type &rhs); + + /// Multiplies marray rhs to marray lhs and assigns the result to lhs. + friend marray &operator *=(marray &lhs, const marray &rhs); + /// Multiplies complex number rhs to marray lhs and assigns the result to lhs. + friend marray &operator *=(marray &lhs, const value_type &rhs); + + /// Divides marray lhs by marray rhs and assigns the result to lhs. + friend marray &operator /=(marray &lhs, const marray &rhs); + /// Divides marray lhs by complex number rhs and assigns the result to lhs. + friend marray &operator /=(marray &lhs, const value_type &rhs); + + /// Adds marray rhs to marray lhs and returns the result. + friend marray operator +(const marray &lhs, const marray &rhs); + /// Adds complex number rhs to marray lhs and returns the result. + friend marray operator +(const marray &lhs, const value_type &rhs); + /// Adds marray rhs to complex number lhs and returns the result. + friend marray operator +(const value_type &lhs, const marray &rhs); + /// Returns a copy of marray lhs. + friend marray operator +(const marray &lhs); + + /// Subtracts marray rhs from marray lhs and returns the result. + friend marray operator -(const marray &lhs, const marray &rhs); + /// Subtracts complex number rhs from marray lhs and returns the result. + friend marray operator -(const marray &lhs, const value_type &rhs); + /// Subtracts marray rhs from complex number lhs and returns the result. + friend marray operator -(const value_type &lhs, const marray &rhs); + /// Negates each element of marray lhs. + friend marray operator -(const marray &lhs); + + /// Multiplies marray rhs to marray lhs and returns the result. + friend marray operator *(const marray &lhs, const marray &rhs); + /// Multiplies complex number rhs to marray lhs and returns the result. + friend marray operator *(const marray &lhs, const value_type &rhs); + /// Multiplies marray rhs to complex number lhs and returns the result. + friend marray operator *(const value_type &lhs, const marray &rhs); + + /// Divides marray lhs by marray rhs and returns the result. + friend marray operator /(const marray &lhs, const marray &rhs); + /// Divides marray lhs by complex number rhs and returns the result. + friend marray operator /(const marray &lhs, const value_type &rhs); + /// Divides complex number lhs by marray rhs and returns the result. + friend marray operator /(const value_type &lhs, const marray &rhs); + + /// Compares marray rhs to marray lhs and returns an marray of booleans where each element is true if the corresponding elements in lhs and rhs are the same, otherwise false. + friend marray operator ==(const marray &lhs, const marray &rhs); + /// Compares complex number rhs to marray lhs and returns an marray of booleans where each element is true if the corresponding elements in lhs and rhs are the same, otherwise false. + friend marray operator ==(const marray &lhs, const value_type &rhs); + /// Compares marray rhs to complex number lhs and returns an marray of booleans where each element is true if the corresponding elements in lhs and rhs are the same, otherwise false. + friend marray operator ==(const value_type &lhs, const marray &rhs); + + /// Compares marray rhs to marray lhs and returns an marray of booleans where each element is true if the corresponding elements in lhs and rhs differs, otherwise false. + friend marray operator !=(const marray &lhs, const marray &rhs); + /// Compares complex number rhs to marray lhs and returns an marray of booleans where each element is true if the corresponding elements in lhs and rhs differs, otherwise false. + friend marray operator !=(const marray &lhs, const value_type &rhs); + /// Compares marray rhs to complex number lhs and returns an marray of booleans where each element is true if the corresponding elements in lhs and rhs differs, otherwise false. + friend marray operator !=(const value_type &lhs, const marray &rhs); + + /* ... */ friend marray &operator %=(marray &lhs, const marray &rhs) = delete; friend marray &operator %=(marray &lhs, const value_type &rhs) = delete; - friend marray &operator %=(value_type &lhs, const marray &rhs) = delete; + friend marray &operator &=(marray &lhs, const marray &rhs) = delete; + friend marray &operator &=(marray &lhs, const value_type &rhs) = delete; + + friend marray &operator |=(marray &lhs, const marray &rhs) = delete; + friend marray &operator |=(marray &lhs, const value_type &rhs) = delete; + + friend marray &operator ^=(marray &lhs, const marray &rhs) = delete; + friend marray &operator ^=(marray &lhs, const value_type &rhs) = delete; + + friend marray &operator <<=(marray &lhs, const marray &rhs) = delete; + friend marray &operator <<=(marray &lhs, const value_type &rhs) = delete; + + friend marray &operator >>=(marray &lhs, const marray &rhs) = delete; + friend marray &operator >>=(marray &lhs, const value_type &rhs) = delete; + + friend marray &operator ++(marray &lhs) = delete; friend marray operator ++(marray &lhs, int) = delete; - friend marray &operator ++(marray & rhs) = delete; + friend marray &operator --(marray &lhs) = delete; friend marray operator --(marray &lhs, int) = delete; - friend marray &operator --(marray & rhs) = delete; + + friend marray &operator +=(marray &lhs) = delete; + friend marray operator +=(marray &lhs, int) = delete; + + friend marray &operator -=(marray &lhs) = delete; + friend marray operator -=(marray &lhs, int) = delete; + + friend marray operator %(const marray &lhs, const marray &rhs) = delete; + friend marray operator %(const marray &lhs, const value_type &rhs) = delete; + friend marray operator %(const value_type &lhs, const marray &rhs) = delete; + + friend marray operator ~(const marray &lhs) = delete; friend marray operator &(const marray &lhs, const marray &rhs) = delete; friend marray operator &(const marray &lhs, const value_type &rhs) = delete; + friend marray operator &(const value_type &lhs, const marray &rhs) = delete; friend marray operator |(const marray &lhs, const marray &rhs) = delete; friend marray operator |(const marray &lhs, const value_type &rhs) = delete; + friend marray operator |(const value_type &lhs, const marray &rhs) = delete; friend marray operator ^(const marray &lhs, const marray &rhs) = delete; friend marray operator ^(const marray &lhs, const value_type &rhs) = delete; + friend marray operator ^(const value_type &lhs, const marray &rhs) = delete; - friend marray &operator &=(marray & lhs, const marray & rhs) = delete; - friend marray &operator &=(marray & lhs, const value_type & rhs) = delete; - friend marray &operator &=(value_type & lhs, const marray & rhs) = delete; - - friend marray &operator |=(marray & lhs, const marray & rhs) = delete; - friend marray &operator |=(marray & lhs, const value_type & rhs) = delete; - friend marray &operator |=(value_type & lhs, const marray & rhs) = delete; - - friend marray &operator ^=(marray & lhs, const marray & rhs) = delete; - friend marray &operator ^=(marray & lhs, const value_type & rhs) = delete; - friend marray &operator ^=(value_type & lhs, const marray & rhs) = delete; - - friend marray operator <<(const marray & lhs, const marray & rhs) = delete; - friend marray operator <<(const marray & lhs, const value_type & rhs) = delete; - friend marray operator <<(const value_type & lhs, const marray & rhs) = delete; - - friend marray operator >>(const marray & lhs, const marray & rhs) = delete; - friend marray operator >>(const marray & lhs, const value_type & rhs) = delete; - friend marray operator >>(const value_type & lhs, const marray & rhs) = delete; + friend marray operator <<(const marray &lhs, const marray &rhs) = delete; + friend marray operator <<(const marray &lhs, const value_type &rhs) = delete; + friend marray operator <<(const value_type &lhs, const marray &rhs) = delete; - friend marray &operator <<=(marray & lhs, const marray & rhs) = delete; - friend marray &operator <<=(marray & lhs, const value_type & rhs) = delete; + friend marray operator >>(const marray &lhs, const marray &rhs) = delete; + friend marray operator >>(const marray &lhs, const value_type &rhs) = delete; + friend marray operator >>(const value_type &lhs, const marray &rhs) = delete; - friend marray &operator >>=(marray & lhs, const marray & rhs) = delete; - friend marray &operator >>=(marray & lhs, const value_type & rhs) = delete; + friend marray operator !(const marray &lhs) = delete; - friend marray operator <(const marray & lhs, const marray & rhs) = delete; - friend marray operator <(const marray & lhs, const value_type & rhs) = delete; - friend marray operator <(const value_type & lhs, const marray & rhs) = delete; + friend marray operator &&(const marray &lhs, const marray &hhs) = delete; + friend marray operator &&(const marray &lhs, const value_type &rhs) = delete; + friend marray operator &&(const value_type &lhs, const marray &rhs) = delete; - friend marray operator >(const marray & lhs, const marray & rhs) = delete; - friend marray operator >(const marray & lhs, const value_type & rhs) = delete; - friend marray operator >(const value_type & lhs, const marray & rhs) = delete; + friend marray operator ||(const marray &lhs, const marray &rhs) = delete; + friend marray operator ||(const marray &lhs, const value_type &rhs) = delete; + friend marray operator ||(const value_type &lhs, const marray &rhs) = delete; - friend marray operator <=(const marray & lhs, const marray & rhs) = delete; - friend marray operator <=(const marray & lhs, const value_type & rhs) = delete; - friend marray operator <=(const value_type & lhs, const marray & rhs) = delete; + friend marray operator <(const marray &lhs, const marray &rhs) = delete; + friend marray operator <(const marray &lhs, const value_type &rhs) = delete; + friend marray operator <(const value_type &lhs, const marray &rhs) = delete; - friend marray operator >=(const marray & lhs, const marray & rhs) = delete; - friend marray operator >=(const marray & lhs, const value_type & rhs) = delete; - friend marray operator >=(const value_type & lhs, const marray & rhs) = delete; + friend marray operator >(const marray &lhs, const marray &rhs) = delete; + friend marray operator >(const marray &lhs, const value_type &rhs) = delete; + friend marray operator >(const value_type &lhs, const marray &rhs) = delete; - friend marray operator ~(const marray &v) = delete; + friend marray operator <=(const marray &lhs, const marray &rhs) = delete; + friend marray operator <=(const marray &lhs, const value_type &rhs) = delete; + friend marray operator <=(const value_type &lhs, const marray &rhs) = delete; - friend marray operator !(const marray &v) = delete; + friend marray operator >=(const marray &lhs, const marray &rhs) = delete; + friend marray operator >=(const marray &lhs, const value_type &rhs) = delete; + friend marray operator >=(const value_type &lhs, const marray &rhs) = delete; }; } // namespace sycl