Skip to content

Commit 211fa3a

Browse files
committed
add placeholder & address nits
1 parent 812f6ac commit 211fa3a

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

spec/API_specification/array_api/fourier_transform_functions.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def fft(x: array, /, *, n: Optional[int] = None, axis: int = -1, norm: Literal['
66
Computes the one-dimensional discrete Fourier transform.
77
88
.. note::
9-
Applying the one-dimensional inverse discrete Fourier transform to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``ifft(fft(x)) == x``), provided that the transform and inverse transform are performed with the same normalization mode.
9+
Applying the one-dimensional inverse discrete Fourier transform to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``ifft(fft(x)) == x``), provided that the transform and inverse transform are performed with the same arguments (length, axis, and normalization mode).
1010
1111
Parameters
1212
----------
@@ -31,8 +31,6 @@ def fft(x: array, /, *, n: Optional[int] = None, axis: int = -1, norm: Literal['
3131
- ``'ortho'``: normalize by ``1/sqrt(n)`` (i.e., make the FFT orthonormal).
3232
- ``'forward'``: normalize by ``1/n``.
3333
34-
where ``n`` equals ``prod(s)``, the logical FFT size.
35-
3634
Default: ``'backward'``.
3735
3836
Returns
@@ -47,7 +45,7 @@ def ifft(x: array, /, *, n: Optional[int] = None, axis: int = -1, norm: Literal[
4745
Computes the one-dimensional inverse discrete Fourier transform.
4846
4947
.. note::
50-
Applying the one-dimensional inverse discrete Fourier transform to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``ifft(fft(x)) == x``), provided that the transform and inverse transform are performed with the same normalization mode.
48+
Applying the one-dimensional inverse discrete Fourier transform to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``ifft(fft(x)) == x``), provided that the transform and inverse transform are performed with the same (length, axis, and normalization mode).
5149
5250
Parameters
5351
----------
@@ -72,8 +70,6 @@ def ifft(x: array, /, *, n: Optional[int] = None, axis: int = -1, norm: Literal[
7270
- ``'ortho'``: normalize by ``1/sqrt(n)`` (i.e., make the FFT orthonormal).
7371
- ``'forward'``: no normalization.
7472
75-
where ``n`` equals ``prod(s)``, the logical FFT size.
76-
7773
Default: ``'backward'``.
7874
7975
Returns
@@ -88,7 +84,7 @@ def fftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None, no
8884
Computes the n-dimensional discrete Fourier transform.
8985
9086
.. note::
91-
Applying the n-dimensional inverse discrete Fourier transform to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``ifftn(fftn(x)) == x``), provided that the transform and inverse transform are performed with the same normalization mode.
87+
Applying the n-dimensional inverse discrete Fourier transform to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``ifftn(fftn(x)) == x``), provided that the transform and inverse transform are performed with the same arguments (sizes, axes, and normalization mode).
9288
9389
Parameters
9490
----------
@@ -99,6 +95,7 @@ def fftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None, no
9995
10096
- ``s[i]`` is greater than the size of the input array along the corresponding axis (dimension) ``i``, the input array along the axis ``i`` is zero-padded to size ``s[i]``.
10197
- ``s[i]`` is less than the size of the input array along a corresponding axis (dimension) ``i``, the input array along the axis ``i`` is trimmed to size ``s[i]``.
98+
- ``s[i]`` is ``-1``, the whole input array along the axis ``i`` is used (no padding/trimming).
10299
- ``s`` is 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.
103100
104101
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]``.
@@ -117,7 +114,7 @@ def fftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None, no
117114
- ``'ortho'``: normalize by ``1/sqrt(n)`` (i.e., make the FFT orthonormal).
118115
- ``'forward'``: normalize by ``1/n``.
119116
120-
where ``n`` equals ``prod(s)``, the logical FFT size.
117+
where ``n = prod(s)`` is the logical FFT size.
121118
122119
Default: ``'backward'``.
123120
@@ -133,7 +130,7 @@ def ifftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None, n
133130
Computes the n-dimensional inverse discrete Fourier transform.
134131
135132
.. note::
136-
Applying the n-dimensional inverse discrete Fourier transform to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``ifftn(fftn(x)) == x``), provided that the transform and inverse transform are performed with the same normalization mode.
133+
Applying the n-dimensional inverse discrete Fourier transform to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``ifftn(fftn(x)) == x``), provided that the transform and inverse transform are performed with the same arguments (sizes, axes, and normalization mode).
137134
138135
Parameters
139136
----------
@@ -144,6 +141,7 @@ def ifftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None, n
144141
145142
- ``s[i]`` is greater than the size of the input array along the corresponding axis (dimension) ``i``, the input array along the axis ``i`` is zero-padded to size ``s[i]``.
146143
- ``s[i]`` is less than the size of the input array along a corresponding axis (dimension) ``i``, the input array along the axis ``i`` is trimmed to size ``s[i]``.
144+
- ``s[i]`` is ``-1``, the whole input array along the axis ``i`` is used (no padding/trimming).
147145
- ``s`` is 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.
148146
149147
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]``.
@@ -162,7 +160,7 @@ def ifftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None, n
162160
- ``'ortho'``: normalize by ``1/sqrt(n)`` (i.e., make the FFT orthonormal).
163161
- ``'forward'``: no normalization.
164162
165-
where ``n`` equals ``prod(s)``, the logical FFT size.
163+
where ``n = prod(s)`` is the logical FFT size.
166164
167165
Default: ``'backward'``.
168166
@@ -178,7 +176,7 @@ def rfft(x: array, /, *, n: Optional[int] = None, axis: int = -1, norm: Literal[
178176
Computes the one-dimensional discrete Fourier transform for real-valued input.
179177
180178
.. note::
181-
Applying the one-dimensional inverse discrete Fourier transform for real-valued input to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``irfft(rfft(x), n=x.shape[axis]) == x``), provided that the transform and inverse transform are performed with the same normalization mode.
179+
Applying the one-dimensional inverse discrete Fourier transform for real-valued input to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``irfft(rfft(x)) == x``), provided that the transform and inverse transform are performed with the same arguments (axis and normalization mode) and consistent length.
182180
183181
Parameters
184182
----------
@@ -203,8 +201,6 @@ def rfft(x: array, /, *, n: Optional[int] = None, axis: int = -1, norm: Literal[
203201
- ``'ortho'``: normalize by ``1/sqrt(n)`` (i.e., make the FFT orthonormal).
204202
- ``'forward'``: normalize by ``1/n``.
205203
206-
where ``n`` equals ``prod(s)``, the logical FFT size.
207-
208204
Default: ``'backward'``.
209205
210206
Returns
@@ -219,7 +215,7 @@ def irfft(x: array, /, *, n: Optional[int] = None, axis: int = -1, norm: Literal
219215
Computes the one-dimensional inverse of ``rfft`` for complex-valued input.
220216
221217
.. note::
222-
Applying the one-dimensional inverse discrete Fourier transform for real-valued input to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``irfft(rfft(x), n=x.shape[axis]) == x``), provided that the transform and inverse transform are performed with the same normalization mode.
218+
Applying the one-dimensional inverse discrete Fourier transform for real-valued input to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``irfft(rfft(x)) == x``), provided that the transform and inverse transform are performed with the same arguments (axis and normalization mode) and consistent length.
223219
224220
Parameters
225221
----------
@@ -244,14 +240,12 @@ def irfft(x: array, /, *, n: Optional[int] = None, axis: int = -1, norm: Literal
244240
- ``'ortho'``: normalize by ``1/sqrt(n)`` (i.e., make the FFT orthonormal).
245241
- ``'forward'``: no normalization.
246242
247-
where ``n`` equals ``prod(s)``, the logical FFT size.
248-
249243
Default: ``'backward'``.
250244
251245
Returns
252246
-------
253247
out: array
254-
an array transformed along the axis (dimension) indicated by ``axis``. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion`. The length along the transformed axis is ``n`` (if given) or ``2*(m-1)`` otherwise.
248+
an array transformed along the axis (dimension) indicated by ``axis``. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion`. The length along the transformed axis is ``n`` (if given) or ``2*(m-1)`` (otherwise).
255249
"""
256250

257251

@@ -260,7 +254,7 @@ def rfftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None, n
260254
Computes the n-dimensional discrete Fourier transform for real-valued input.
261255
262256
.. note::
263-
Applying the n-dimensional inverse discrete Fourier transform for real-valued input to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``irfftn(rfftn(x), n=x.shape[axis]) == x``), provided that the transform and inverse transform are performed with the same normalization mode.
257+
Applying the n-dimensional inverse discrete Fourier transform for real-valued input to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``irfftn(rfftn(x)) == x``), provided that the transform and inverse transform are performed with the same arguments (axes and normalization mode) and consistent sizes.
264258
265259
Parameters
266260
----------
@@ -271,6 +265,7 @@ def rfftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None, n
271265
272266
- ``s[i]`` is greater than the size of the input array along the corresponding axis (dimension) ``i``, the input array along the axis ``i`` is zero-padded to size ``s[i]``.
273267
- ``s[i]`` is less than the size of the input array along a corresponding axis (dimension) ``i``, the input array along the axis ``i`` is trimmed to size ``s[i]``.
268+
- ``s[i]`` is ``-1``, the whole input array along the axis ``i`` is used (no padding/trimming).
274269
- ``s`` is 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.
275270
276271
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]``.
@@ -289,7 +284,7 @@ def rfftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None, n
289284
- ``'ortho'``: normalize by ``1/sqrt(n)`` (i.e., make the FFT orthonormal).
290285
- ``'forward'``: normalize by ``1/n``.
291286
292-
where ``n`` equals ``prod(s)``, the logical FFT size.
287+
where ``n = prod(s)``, the logical FFT size.
293288
294289
Default: ``'backward'``.
295290
@@ -305,7 +300,7 @@ def irfftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None,
305300
Computes the n-dimensional inverse of ``rfftn`` for complex-valued input.
306301
307302
.. note::
308-
Applying the n-dimensional inverse discrete Fourier transform for real-valued input to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``irfftn(rfftn(x), n=x.shape[axis]) == x``), provided that the transform and inverse transform are performed with the same normalization mode.
303+
Applying the n-dimensional inverse discrete Fourier transform for real-valued input to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., ``irfftn(rfftn(x)) == x``), provided that the transform and inverse transform are performed with the same arguments (axes and normalization mode) and consistent sizes.
309304
310305
Parameters
311306
----------
@@ -316,7 +311,8 @@ def irfftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None,
316311
317312
- ``n`` is greater than the size of the input array along the corresponding axis (dimension) ``i``, the input array along the axis ``i`` is zero-padded to size ``n``.
318313
- ``n`` is less than the size of the input array along the corresponding axis (dimension) ``i``, the input array along the axis ``i`` is trimmed to size ``n``.
319-
- ``s`` is 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, except for the last axis which is trimmed to ``2*(m-1)``, where `m` is the length of the input along the axis.
314+
- ``s[i]`` is ``-1``, the whole input array along the axis ``i`` is used (no padding/trimming).
315+
- ``s`` is 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, except for the last axis which is trimmed to ``2*(m-1)``, where ``m`` is the length of the input along the axis.
320316
321317
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]``.
322318
@@ -334,14 +330,14 @@ def irfftn(x: array, /, *, s: Sequence[int] = None, axes: Sequence[int] = None,
334330
- ``'ortho'``: normalize by ``1/sqrt(n)`` (i.e., make the FFT orthonormal).
335331
- ``'forward'``: no normalization.
336332
337-
where ``n`` equals ``prod(s)``, the logical FFT size.
333+
where ``n = prod(s)`` is the logical FFT size.
338334
339335
Default: ``'backward'``.
340336
341337
Returns
342338
-------
343339
out: array
344-
an array transformed along the axes (dimension) indicated by ``axes``. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion`. The length along the last transformed axis is ``s[-1]`` (if given) or ``2*(m - 1)`` otherwise, and all other axes ``s[i]``.
340+
an array transformed along the axes (dimension) indicated by ``axes``. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion`. The length along the last transformed axis is ``s[-1]`` (if given) or ``2*(m - 1)`` (otherwise), and all other axes ``s[i]``.
345341
"""
346342

347343

@@ -408,8 +404,6 @@ def ihfft(x: array, /, *, n: Optional[int] = None, axis: int = -1, norm: Literal
408404
- ``'ortho'``: normalize by ``1/sqrt(n)`` (i.e., make the FFT orthonormal).
409405
- ``'forward'``: no normalization.
410406
411-
where ``n`` equals ``prod(s)``, the logical FFT size.
412-
413407
Default: ``'backward'``.
414408
415409
Returns
@@ -440,7 +434,7 @@ def fftfreq(n: int, /, *, d: float = 1.0):
440434
Returns
441435
-------
442436
out: array
443-
an array of length ``n`` containing the sample frequencies. The returned array must have a floating-point data type determined by :ref:`type-promotion`.
437+
an array of length ``n`` containing the sample frequencies. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion`.
444438
"""
445439

446440

@@ -467,7 +461,7 @@ def rfftfreq(n: int, /, *, d: float = 1.0):
467461
Returns
468462
-------
469463
out: array
470-
an array of length ``n//2+1`` containing the sample frequencies. The returned array must have a floating-point data type determined by :ref:`type-promotion`.
464+
an array of length ``n//2+1`` containing the sample frequencies. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion`.
471465
"""
472466

473467

@@ -506,7 +500,7 @@ def ifftshift(x: array, /, *, axes: Union[int, Sequence[int]] = None):
506500
x: array
507501
input array. Should have a floating-point data type.
508502
axes: Union[int, Sequence[int]]
509-
axes over which to perform the inverse. If ``None``, the function must shift all axes. Default: ``None``.
503+
axes over which to perform the inverse shift. If ``None``, the function must shift all axes. Default: ``None``.
510504
511505
Returns
512506
-------

0 commit comments

Comments
 (0)