@@ -146,15 +146,15 @@ def __abs__(self: array, /) -> array:
146
146
Added complex data type support.
147
147
"""
148
148
149
- def __add__ (self : array , other : Union [int , float , array ], / ) -> array :
149
+ def __add__ (self : array , other : Union [int , float , complex , array ], / ) -> array :
150
150
"""
151
151
Calculates the sum for each element of an array instance with the respective element of the array ``other``.
152
152
153
153
Parameters
154
154
----------
155
155
self: array
156
156
array instance (augend array). Should have a numeric data type.
157
- other: Union[int, float, array]
157
+ other: Union[int, float, complex, array]
158
158
addend array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
159
159
160
160
Returns
@@ -374,15 +374,15 @@ def __dlpack_device__(self: array, /) -> Tuple[Enum, int]:
374
374
ROCM = 10
375
375
"""
376
376
377
- def __eq__ (self : array , other : Union [int , float , bool , array ], / ) -> array :
377
+ def __eq__ (self : array , other : Union [int , float , complex , bool , array ], / ) -> array :
378
378
r"""
379
379
Computes the truth value of ``self_i == other_i`` for each element of an array instance with the respective element of the array ``other``.
380
380
381
381
Parameters
382
382
----------
383
383
self: array
384
384
array instance. May have any data type.
385
- other: Union[int, float, bool, array]
385
+ other: Union[int, float, complex, bool, array]
386
386
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). May have any data type.
387
387
388
388
Returns
@@ -393,6 +393,9 @@ def __eq__(self: array, other: Union[int, float, bool, array], /) -> array:
393
393
394
394
.. note::
395
395
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.equal`.
396
+
397
+ .. versionchanged:: 2022.12
398
+ Added complex data type support.
396
399
"""
397
400
398
401
def __float__ (self : array , / ) -> float :
@@ -746,7 +749,7 @@ def __mod__(self: array, other: Union[int, float, array], /) -> array:
746
749
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.remainder`.
747
750
"""
748
751
749
- def __mul__ (self : array , other : Union [int , float , array ], / ) -> array :
752
+ def __mul__ (self : array , other : Union [int , float , complex , array ], / ) -> array :
750
753
r"""
751
754
Calculates the product for each element of an array instance with the respective element of the array ``other``.
752
755
@@ -757,7 +760,7 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
757
760
----------
758
761
self: array
759
762
array instance. Should have a numeric data type.
760
- other: Union[int, float, array]
763
+ other: Union[int, float, complex, array]
761
764
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
762
765
763
766
Returns
@@ -775,15 +778,15 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
775
778
Added complex data type support.
776
779
"""
777
780
778
- def __ne__ (self : array , other : Union [int , float , bool , array ], / ) -> array :
781
+ def __ne__ (self : array , other : Union [int , float , complex , bool , array ], / ) -> array :
779
782
"""
780
783
Computes the truth value of ``self_i != other_i`` for each element of an array instance with the respective element of the array ``other``.
781
784
782
785
Parameters
783
786
----------
784
787
self: array
785
788
array instance. May have any data type.
786
- other: Union[int, float, bool, array]
789
+ other: Union[int, float, complex, bool, array]
787
790
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). May have any data type.
788
791
789
792
Returns
@@ -852,9 +855,6 @@ def __or__(self: array, other: Union[int, bool, array], /) -> array:
852
855
853
856
.. note::
854
857
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_or`.
855
-
856
- .. versionchanged:: 2022.12
857
- Added complex data type support.
858
858
"""
859
859
860
860
def __pos__ (self : array , / ) -> array :
@@ -876,7 +876,7 @@ def __pos__(self: array, /) -> array:
876
876
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.positive`.
877
877
"""
878
878
879
- def __pow__ (self : array , other : Union [int , float , array ], / ) -> array :
879
+ def __pow__ (self : array , other : Union [int , float , complex , array ], / ) -> array :
880
880
r"""
881
881
Calculates an implementation-dependent approximation of exponentiation by raising each element (the base) of an array instance to the power of ``other_i`` (the exponent), where ``other_i`` is the corresponding element of the array ``other``.
882
882
@@ -889,7 +889,7 @@ def __pow__(self: array, other: Union[int, float, array], /) -> array:
889
889
----------
890
890
self: array
891
891
array instance whose elements correspond to the exponentiation base. Should have a numeric data type.
892
- other: Union[int, float, array]
892
+ other: Union[int, float, complex, array]
893
893
other array whose elements correspond to the exponentiation exponent. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
894
894
895
895
Returns
@@ -933,7 +933,7 @@ def __setitem__(
933
933
key : Union [
934
934
int , slice , ellipsis , Tuple [Union [int , slice , ellipsis ], ...], array
935
935
],
936
- value : Union [int , float , bool , array ],
936
+ value : Union [int , float , complex , bool , array ],
937
937
/ ,
938
938
) -> None :
939
939
"""
@@ -947,7 +947,7 @@ def __setitem__(
947
947
array instance.
948
948
key: Union[int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array]
949
949
index key.
950
- value: Union[int, float, bool, array]
950
+ value: Union[int, float, complex, bool, array]
951
951
value(s) to set. Must be compatible with ``self[key]`` (see :ref:`broadcasting`).
952
952
953
953
@@ -960,7 +960,7 @@ def __setitem__(
960
960
When ``value`` is an ``array`` of a different data type than ``self``, how values are cast to the data type of ``self`` is implementation defined.
961
961
"""
962
962
963
- def __sub__ (self : array , other : Union [int , float , array ], / ) -> array :
963
+ def __sub__ (self : array , other : Union [int , float , complex , array ], / ) -> array :
964
964
"""
965
965
Calculates the difference for each element of an array instance with the respective element of the array ``other``.
966
966
@@ -970,7 +970,7 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
970
970
----------
971
971
self: array
972
972
array instance (minuend array). Should have a numeric data type.
973
- other: Union[int, float, array]
973
+ other: Union[int, float, complex, array]
974
974
subtrahend array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
975
975
976
976
Returns
@@ -988,7 +988,7 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
988
988
Added complex data type support.
989
989
"""
990
990
991
- def __truediv__ (self : array , other : Union [int , float , array ], / ) -> array :
991
+ def __truediv__ (self : array , other : Union [int , float , complex , array ], / ) -> array :
992
992
r"""
993
993
Evaluates ``self_i / other_i`` for each element of an array instance with the respective element of the array ``other``.
994
994
@@ -1001,7 +1001,7 @@ def __truediv__(self: array, other: Union[int, float, array], /) -> array:
1001
1001
----------
1002
1002
self: array
1003
1003
array instance. Should have a numeric data type.
1004
- other: Union[int, float, array]
1004
+ other: Union[int, float, complex, array]
1005
1005
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
1006
1006
1007
1007
Returns
0 commit comments