Skip to content

Commit a7e5a39

Browse files
committed
Add version changed to functions that were modified for complex support in 2022
1 parent ae82acd commit a7e5a39

10 files changed

+270
-1
lines changed

src/array_api_stubs/_draft/array_object.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,12 @@ def __abs__(self: array, /) -> array:
136136
out: array
137137
an array containing the element-wise absolute value. If ``self`` has a real-valued data type, the returned array must have the same data type as ``self``. If ``self`` has a complex floating-point data type, the returned arrayed must have a real-valued floating-point data type whose precision matches the precision of ``self`` (e.g., if ``self`` is ``complex128``, then the returned array must have a ``float64`` data type).
138138
139-
140139
.. note::
141140
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.abs`.
141+
142+
143+
.. versionchanged:: 2022.12
144+
Added complex data type support.
142145
"""
143146

144147
def __add__(self: array, other: Union[int, float, array], /) -> array:
@@ -160,6 +163,9 @@ def __add__(self: array, other: Union[int, float, array], /) -> array:
160163
161164
.. note::
162165
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.add`.
166+
167+
.. versionchanged:: 2022.12
168+
Added complex data type support.
163169
"""
164170

165171
def __and__(self: array, other: Union[int, bool, array], /) -> array:
@@ -228,6 +234,9 @@ def __bool__(self: array, /) -> bool:
228234
- If ``self`` is either ``+0`` or ``-0``, the result is ``False``.
229235
230236
For complex floating-point operands, special cases must be handled as if the operation is implemented as the logical AND of ``bool(real(self))`` and ``bool(imag(self))``.
237+
238+
.. versionchanged:: 2022.12
239+
Added boolean and complex data type support.
231240
"""
232241

233242
def __complex__(self: array, /) -> complex:
@@ -326,6 +335,8 @@ def __dlpack__(
326335
errors are raised when export fails for other reasons (e.g., incorrect
327336
arguments passed or out of memory).
328337
338+
.. versionchanged:: 2022.12
339+
Added BufferError.
329340
"""
330341

331342
def __dlpack_device__(self: array, /) -> Tuple[Enum, int]:
@@ -401,6 +412,9 @@ def __float__(self: array, /) -> float:
401412
402413
- If ``self`` is ``True``, the result is ``1``.
403414
- If ``self`` is ``False``, the result is ``0``.
415+
416+
.. versionchanged:: 2022.12
417+
Added boolean and complex data type support.
404418
"""
405419

406420
def __floordiv__(self: array, other: Union[int, float, array], /) -> array:
@@ -551,6 +565,9 @@ def __int__(self: array, /) -> int:
551565
552566
- If ``self`` is either ``+infinity`` or ``-infinity``, raise ``OverflowError``.
553567
- If ``self`` is ``NaN``, raise ``ValueError``.
568+
569+
.. versionchanged:: 2022.12
570+
Added boolean and complex data type support.
554571
"""
555572

556573
def __invert__(self: array, /) -> array:
@@ -682,6 +699,9 @@ def __matmul__(self: array, other: array, /) -> array:
682699
- if ``self`` is a one-dimensional array having shape ``(K,)``, ``other`` is an array having shape ``(..., L, N)``, and ``K != L``.
683700
- if ``self`` is an array having shape ``(..., M, K)``, ``other`` is a one-dimensional array having shape ``(L,)``, and ``K != L``.
684701
- if ``self`` is an array having shape ``(..., M, K)``, ``other`` is an array having shape ``(..., L, N)``, and ``K != L``.
702+
703+
.. versionchanged:: 2022.12
704+
Added complex data type support.
685705
"""
686706

687707
def __mod__(self: array, other: Union[int, float, array], /) -> array:
@@ -730,6 +750,9 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
730750
731751
.. note::
732752
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.multiply`.
753+
754+
.. versionchanged:: 2022.12
755+
Added complex data type support.
733756
"""
734757

735758
def __ne__(self: array, other: Union[int, float, bool, array], /) -> array:
@@ -751,6 +774,9 @@ def __ne__(self: array, other: Union[int, float, bool, array], /) -> array:
751774
752775
.. note::
753776
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.not_equal`.
777+
778+
.. versionchanged:: 2022.12
779+
Added complex data type support.
754780
"""
755781

756782
def __neg__(self: array, /) -> array:
@@ -776,6 +802,9 @@ def __neg__(self: array, /) -> array:
776802
777803
.. note::
778804
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.negative`.
805+
806+
.. versionchanged:: 2022.12
807+
Added complex data type support.
779808
"""
780809

781810
def __or__(self: array, other: Union[int, bool, array], /) -> array:
@@ -816,6 +845,9 @@ def __pos__(self: array, /) -> array:
816845
817846
.. note::
818847
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.positive`.
848+
849+
.. versionchanged:: 2022.12
850+
Added complex data type support.
819851
"""
820852

821853
def __pow__(self: array, other: Union[int, float, array], /) -> array:
@@ -842,6 +874,9 @@ def __pow__(self: array, other: Union[int, float, array], /) -> array:
842874
843875
.. note::
844876
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.pow`.
877+
878+
.. versionchanged:: 2022.12
879+
Added complex data type support.
845880
"""
846881

847882
def __rshift__(self: array, other: Union[int, array], /) -> array:
@@ -916,6 +951,9 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
916951
917952
.. note::
918953
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.subtract`.
954+
955+
.. versionchanged:: 2022.12
956+
Added complex data type support.
919957
"""
920958

921959
def __truediv__(self: array, other: Union[int, float, array], /) -> array:
@@ -942,6 +980,9 @@ def __truediv__(self: array, other: Union[int, float, array], /) -> array:
942980
943981
.. note::
944982
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.divide`.
983+
984+
.. versionchanged:: 2022.12
985+
Added complex data type support.
945986
"""
946987

947988
def __xor__(self: array, other: Union[int, bool, array], /) -> array:

src/array_api_stubs/_draft/creation_functions.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ def asarray(
9797
-------
9898
out: array
9999
an array containing the data from ``obj``.
100+
101+
.. versionchanged:: 2022.12
102+
Added complex data type support.
100103
"""
101104

102105

@@ -179,6 +182,9 @@ def eye(
179182
-------
180183
out: array
181184
an array where all elements are equal to zero, except for the ``k``\th diagonal, whose values are equal to one.
185+
186+
.. versionchanged:: 2022.12
187+
Added complex data type support.
182188
"""
183189

184190

@@ -237,6 +243,9 @@ def full(
237243
-------
238244
out: array
239245
an array where every element is equal to ``fill_value``.
246+
247+
.. versionchanged:: 2022.12
248+
Added complex data type support.
240249
"""
241250

242251

@@ -273,6 +282,9 @@ def full_like(
273282
-------
274283
out: array
275284
an array having the same shape as ``x`` and where every element is equal to ``fill_value``.
285+
286+
.. versionchanged:: 2022.12
287+
Added complex data type support.
276288
"""
277289

278290

@@ -340,6 +352,9 @@ def linspace(
340352
341353
.. note::
342354
As mixed data type promotion is implementation-defined, behavior when ``start`` or ``stop`` exceeds the maximum safe integer of an output floating-point data type is implementation-defined. An implementation may choose to overflow or raise an exception.
355+
356+
.. versionchanged:: 2022.12
357+
Added complex data type support.
343358
"""
344359

345360

@@ -367,6 +382,9 @@ def meshgrid(*arrays: array, indexing: str = "xy") -> List[array]:
367382
Similarly, for the three-dimensional case with input one-dimensional arrays of length ``M``, ``N``, and ``P``, if matrix indexing ``ij``, then each returned array must have shape ``(M, N, P)``, and, if Cartesian indexing ``xy``, then each returned array must have shape ``(N, M, P)``.
368383
369384
Each returned array should have the same data type as the input arrays.
385+
386+
.. versionchanged:: 2022.12
387+
Added complex data type support.
370388
"""
371389

372390

@@ -395,6 +413,9 @@ def ones(
395413
-------
396414
out: array
397415
an array containing ones.
416+
417+
.. versionchanged:: 2022.12
418+
Added complex data type support.
398419
"""
399420

400421

@@ -420,6 +441,9 @@ def ones_like(
420441
-------
421442
out: array
422443
an array having the same shape as ``x`` and filled with ones.
444+
445+
.. versionchanged:: 2022.12
446+
Added complex data type support.
423447
"""
424448

425449

src/array_api_stubs/_draft/data_type_functions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ def astype(x: array, dtype: dtype, /, *, copy: bool = True) -> array:
3636
-------
3737
out: array
3838
an array having the specified data type. The returned array must have the same shape as ``x``.
39+
40+
.. versionchanged:: 2022.12
41+
Added complex data type support.
3942
"""
4043

4144

@@ -97,6 +100,9 @@ def finfo(type: Union[dtype, array], /) -> finfo_object:
97100
- **dtype**: dtype
98101
99102
real-valued floating-point data type.
103+
104+
.. versionchanged:: 2022.12
105+
Added complex data type support.
100106
"""
101107

102108

0 commit comments

Comments
 (0)