Skip to content

Commit 29da2cd

Browse files
authored
fix s & axes requirement
1 parent c030c0c commit 29da2cd

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

spec/API_specification/array_api/fourier_transform_functions.py

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,17 @@ def fftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None, no
9494
- ``s[i]`` is greater than the size of the input array along a corresponding axis (dimension) ``i``, the corresponding axis of the input array must be zero-padded such that the axis has size ``s[i]``.
9595
- ``s[i]`` is less than the size of the input array along a corresponding axis (dimension) ``i``, the corresponding axis of the input array must be trimmed such that the axis has size ``s[i]``.
9696
97-
98-
If ``axes`` is not ``None``, size ``s[i]`` corresponds to the size of axis ``axes[j]`` where ``i == j``.
97+
If ``s`` is not ``None``, ``axes`` must not be ``None`` either, and ``s[i]`` corresponds to the size along the transformed axis specified by ``axes[i]``.
9998
10099
If not provided, the size of each transformed axis (dimension) in the output array must equal the size of the corresponding axis in the input array.
101100
102101
Default: ``None``.
103102
axes: Sequence[int]
104-
axes (dimension) over which to compute the Fourier transform. If ``None`` and ``s`` is not specified, all axes must be transformed. If ``s`` is specified, the corresponding ``axes`` to be transformed must be explicitly specified too. Default: ``None``.
103+
axes (dimensions) over which to compute the Fourier transform. If ``None``, all axes must be transformed.
104+
105+
If ``s`` is specified, the corresponding ``axes`` to be transformed must be explicitly specified too.
106+
107+
Default: ``None``.
105108
norm: Literal['backward', 'ortho', 'forward']
106109
normalization mode. Should be one of the following modes:
107110
@@ -137,9 +140,17 @@ def ifftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None, n
137140
- ``s[i]`` is greater than the size of the input array along a corresponding axis (dimension) ``j``, the corresponding axis of the input array must be zero-padded such that the axis has size ``s[i]``.
138141
- ``s[i]`` is less than the length of the input array, each axis ``i`` of the input array must be trimmed to the length ``s[i]``.
139142
140-
If not provided, the length of the transformed axes of the output must equal the length of the input along the axes specified by ``axes``. Default: ``None``.
143+
If ``s`` is not ``None``, ``axes`` must not be ``None`` either, and ``s[i]`` corresponds to the size along the transformed axis specified by ``axes[i]``.
144+
145+
If not provided, the size of each transformed axis (dimension) in the output array must equal the size of the corresponding axis in the input array.
146+
147+
Default: ``None``.
141148
axes: Sequence[int]
142-
axes over which to compute the inverse Fourier transform. If not specified, the last ``len(s)`` axes are used, or all axes if ``s`` is not specified either. Default: ``None``.
149+
axes (dimensions) over which to compute the Fourier transform. If ``None``, all axes must be transformed.
150+
151+
If ``s`` is specified, the corresponding ``axes`` to be transformed must be explicitly specified too.
152+
153+
Default: ``None``.
143154
norm: Literal['backward', 'ortho', 'forward']
144155
specify the normalization mode. Should be one of the following modes:
145156
@@ -251,9 +262,17 @@ def rfftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None, n
251262
- ``s[i]`` is greater than the size of the input array along a corresponding axis (dimension) ``j``, the corresponding axis of the input array must be zero-padded such that the axis has size ``s[i]``.
252263
- ``s[i]`` is less than the length of the input array, each axis ``i`` of the input array must be trimmed to the length ``s[i]``.
253264
254-
If not provided, the length of the transformed axes of the output must equal the length of the input along the axes specified by ``axes``. Default: ``None``.
265+
If ``s`` is not ``None``, ``axes`` must not be ``None`` either, and ``s[i]`` corresponds to the size along the transformed axis specified by ``axes[i]``.
266+
267+
If not provided, the size of each transformed axis (dimension) in the output array must equal the size of the corresponding axis in the input array.
268+
269+
Default: ``None``.
255270
axes: Sequence[int]
256-
axes over which to compute the Fourier transform. If not specified, the last ``len(s)`` axes are used, or all axes if ``s`` is not specified either. Default: ``None``.
271+
axes (dimensions) over which to compute the Fourier transform. If ``None``, all axes must be transformed.
272+
273+
If ``s`` is specified, the corresponding ``axes`` to be transformed must be explicitly specified too.
274+
275+
Default: ``None``.
257276
norm: Literal['backward', 'ortho', 'forward']
258277
normalization mode. Should be one of the following modes:
259278
@@ -289,9 +308,17 @@ def irfftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None,
289308
- ``s[i]`` is greater than the size of the input array along a corresponding axis (dimension) ``j``, the corresponding axis of the input array must be zero-padded such that the axis has size ``s[i]``.
290309
- ``s[i]`` is less than the length of the input array, each axis ``i`` of the input array must be trimmed to the length ``s[i]``. Except for the last axis is trimmed to ``2 * (m - 1)``, where `m` is the length of the input along the axis.
291310
292-
If not provided, the length of the transformed axes of the output must equal the length of the input along the axes specified by ``axes``. Default: ``None``.
311+
If ``s`` is not ``None``, ``axes`` must not be ``None`` either, and ``s[i]`` corresponds to the size along the transformed axis specified by ``axes[i]``.
312+
313+
If not provided, the size of each transformed axis (dimension) in the output array must equal the size of the corresponding axis in the input array.
314+
315+
Default: ``None``.
293316
axes: Sequence[int]
294-
axes over which to compute the inverse Fourier transform. If not specified, the last ``len(s)`` axes are used, or all axes if ``s`` is not specified either. Default: ``None``.
317+
axes (dimensions) over which to compute the Fourier transform. If ``None``, all axes must be transformed.
318+
319+
If ``s`` is specified, the corresponding ``axes`` to be transformed must be explicitly specified too.
320+
321+
Default: ``None``.
295322
norm: Literal['backward', 'ortho', 'forward']
296323
normalization mode. Should be one of the following modes:
297324

0 commit comments

Comments
 (0)