Skip to content

Commit ac7ce5d

Browse files
authored
Add complex number support to negative (#448)
1 parent 9a0960a commit ac7ce5d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

spec/API_specification/array_api/array_object.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,13 @@ def __neg__(self: array, /) -> array:
746746
.. note::
747747
For signed integer data types, the numerical negative of the minimum representable integer is implementation-dependent.
748748
749+
.. note::
750+
If ``self`` has a complex floating-point data type, both the real and imaginary components for each ``self_i`` must be negated (a result which follows from the rules of complex number multiplication).
751+
749752
Parameters
750753
----------
751754
self: array
752-
array instance. Should have a real-valued data type.
755+
array instance. Should have a numeric data type.
753756
754757
Returns
755758
-------

spec/API_specification/array_api/elementwise_functions.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1014,10 +1014,13 @@ def negative(x: array, /) -> array:
10141014
.. note::
10151015
For signed integer data types, the numerical negative of the minimum representable integer is implementation-dependent.
10161016
1017+
.. note::
1018+
If ``x`` has a complex floating-point data type, both the real and imaginary components for each ``x_i`` must be negated (a result which follows from the rules of complex number multiplication).
1019+
10171020
Parameters
10181021
----------
10191022
x: array
1020-
input array. Should have a real-valued data type.
1023+
input array. Should have a numeric data type.
10211024
10221025
Returns
10231026
-------

0 commit comments

Comments
 (0)