Skip to content

Commit d85d551

Browse files
committed
note that passing axes with repeated entries is UB
1 parent 636e178 commit d85d551

File tree

1 file changed

+13
-1
lines changed
  • src/array_api_stubs/_draft

1 file changed

+13
-1
lines changed

src/array_api_stubs/_draft/fft.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ def fftn(
146146
axes (dimensions) over which to compute the transform. A valid axis in ``axes`` must be an integer on the interval ``[-N, N)``, where ``N`` is the rank (number of dimensions) of ``x`` along that axis. If an axis is specified as a negative integer, the function must determine the axis along which to compute the transform by counting backward from the last dimension (where ``-1`` refers to the last dimension).
147147
148148
If ``s`` is provided, the corresponding ``axes`` to be transformed must also be provided. If ``axes`` is ``None``, the function must compute the transform over all axes. Default: ``None``.
149+
150+
If ``axes`` contains any repeated entries, the behavior is unspecified and thus implementation-defined.
149151
norm: Literal['backward', 'ortho', 'forward']
150152
normalization mode. Should be one of the following modes:
151153
@@ -199,6 +201,8 @@ def ifftn(
199201
axes (dimensions) over which to compute the transform. A valid axis in ``axes`` must be an integer on the interval ``[-N, N)``, where ``N`` is the rank (number of dimensions) of ``x`` along that axis. If an axis is specified as a negative integer, the function must determine the axis along which to compute the transform by counting backward from the last dimension (where ``-1`` refers to the last dimension).
200202
201203
If ``s`` is provided, the corresponding ``axes`` to be transformed must also be provided. If ``axes`` is ``None``, the function must compute the transform over all axes. Default: ``None``.
204+
205+
If ``axes`` contains any repeated entries, the behavior is unspecified and thus implementation-defined.
202206
norm: Literal['backward', 'ortho', 'forward']
203207
specify the normalization mode. Should be one of the following modes:
204208
@@ -352,6 +356,8 @@ def rfftn(
352356
axes (dimensions) over which to compute the transform. A valid axis in ``axes`` must be an integer on the interval ``[-N, N)``, where ``N`` is the rank (number of dimensions) of ``x`` along that axis. If an axis is specified as a negative integer, the function must determine the axis along which to compute the transform by counting backward from the last dimension (where ``-1`` refers to the last dimension).
353357
354358
If ``s`` is provided, the corresponding ``axes`` to be transformed must also be provided. If ``axes`` is ``None``, the function must compute the transform over all axes. Default: ``None``.
359+
360+
If ``axes`` contains any repeated entries, the behavior is unspecified and thus implementation-defined.
355361
norm: Literal['backward', 'ortho', 'forward']
356362
normalization mode. Should be one of the following modes:
357363
@@ -404,7 +410,9 @@ def irfftn(
404410
axes: Optional[Sequence[int]]
405411
axes (dimensions) over which to compute the transform. A valid axis in ``axes`` must be an integer on the interval ``[-N, N)``, where ``N`` is the rank (number of dimensions) of ``x`` along that axis. If an axis is specified as a negative integer, the function must determine the axis along which to compute the transform by counting backward from the last dimension (where ``-1`` refers to the last dimension).
406412
407-
If ``s`` is provided, the corresponding ``axes`` to be transformed must also be provided. If ``axes`` is ``None``, the function must compute the transform over all axes. Default: ``None``.
413+
If ``s`` is provided, the corresponding ``axes`` to be transformed must also be provided. If ``axes`` is ``None``, the function must compute the transform over all axes. Default: ``None``.
414+
415+
If ``axes`` contains any repeated entries, the behavior is unspecified and thus implementation-defined.
408416
norm: Literal['backward', 'ortho', 'forward']
409417
normalization mode. Should be one of the following modes:
410418
@@ -604,6 +612,8 @@ def fftshift(x: array, /, *, axes: Optional[Union[int, Sequence[int]]] = None) -
604612
axes: Optional[Union[int, Sequence[int]]]
605613
axes over which to shift. If ``None``, the function must shift all axes. Default: ``None``.
606614
615+
If ``axes`` contains any repeated entries, the behavior is unspecified and thus implementation-defined.
616+
607617
Returns
608618
-------
609619
out: array
@@ -632,6 +642,8 @@ def ifftshift(
632642
axes: Optional[Union[int, Sequence[int]]]
633643
axes over which to perform the inverse shift. If ``None``, the function must shift all axes. Default: ``None``.
634644
645+
If ``axes`` contains any repeated entries, the behavior is unspecified and thus implementation-defined.
646+
635647
Returns
636648
-------
637649
out: array

0 commit comments

Comments
 (0)