Skip to content

Commit 92bbafb

Browse files
committed
Indicate dtypes for inputs and expected outputs
1 parent 838b9b9 commit 92bbafb

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

spec/API_specification/array_api/fourier_transform_functions.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def fft(a: array, /, *, n: Optional[int] = None, axis: int = -1, norm: str = 'ba
88
Parameters
99
----------
1010
a: array
11-
input array
11+
input array. Should have a floating-point data type.
1212
n: int
1313
length of the transformed axis of the output. If given, the input will be either zero-padded or trimmed to the length ``n`` before computing the Fourier transform. Otherwise, the length of the input along the axis given by the ``axis`` keyword. Default: ``None``.
1414
axis: int
@@ -25,7 +25,7 @@ def fft(a: array, /, *, n: Optional[int] = None, axis: int = -1, norm: str = 'ba
2525
Returns
2626
-------
2727
out: array
28-
a complex-valued array transformed along the axis indicated by the ``axis`` keyword. The length along the transformed axis is ``n//2+1``.
28+
a complex-valued array transformed along the axis indicated by the ``axis`` keyword. The length along the transformed axis is ``n//2+1``. The returned array must have a complex dtype with the same precision as the input ``x``.
2929
3030
3131
**Raises**
@@ -41,7 +41,7 @@ def ifft(a: array, /, *, n: Optional[int] = None, axis: int = -1, norm: str = 'b
4141
Parameters
4242
----------
4343
a: array
44-
input array
44+
input array. Should have a floating-point data type.
4545
n: int
4646
length of the transformed axis of the output. If given, the input will be either zero-padded or trimmed to the length ``n`` before computing the inverse Fourier transform. Otherwise, the length of the input along the axis given by the ``axis`` keyword. Default: ``None``.
4747
axis: int
@@ -58,7 +58,7 @@ def ifft(a: array, /, *, n: Optional[int] = None, axis: int = -1, norm: str = 'b
5858
Returns
5959
-------
6060
out: array
61-
a complex-valued array transformed along the axis indicated by the ``axis`` keyword. The length along the transformed axis is ``n//2+1``.
61+
a complex-valued array transformed along the axis indicated by the ``axis`` keyword. The length along the transformed axis is ``n//2+1``. The returned array must have a complex dtype with the same precision as the input ``x``.
6262
6363
6464
**Raises**
@@ -74,7 +74,7 @@ def fftn(a: array, /, *, s: Union[Sequence[int], Tuple[int, ...]] = None, axes:
7474
Parameters
7575
----------
7676
a: array
77-
input array
77+
input array. Should have a floating-point data type.
7878
s: Union[Sequence[int], Tuple[int, ...]]
7979
size of each transformed axis of the output. If given, each axis ``i`` will be either zero-padded or trimmed to the length ``s[i]`` before computing the Fourier transform. Otherwise, the shape of the input along the axes given by the ``axes`` keyword. Default: ``None``.
8080
axes: Union[Sequence[int], Tuple[int, ...]]
@@ -91,7 +91,7 @@ def fftn(a: array, /, *, s: Union[Sequence[int], Tuple[int, ...]] = None, axes:
9191
Returns
9292
-------
9393
out: array
94-
an array transformed along the axes indicated by the ``axes`` keyword.
94+
an array transformed along the axes indicated by the ``axes`` keyword. The returned array must have a complex dtype with the same precision as the input ``x``.
9595
9696
9797
**Raises**
@@ -108,7 +108,7 @@ def ifftn(a: array, /, *, s: Union[Sequence[int], Tuple[int, ...]] = None, axes:
108108
Parameters
109109
----------
110110
a: array
111-
input array
111+
input array. Should have a floating-point data type.
112112
s: Union[Sequence[int], Tuple[int, ...]]
113113
size of each transformed axis of the output. If given, each axis will be either zero-padded or trimmed to the length ``s[i]`` before computing the inverse Fourier transform. Otherwise, the length of the input along the axis given by the ``axes`` keyword. Default: ``None``.
114114
axes: Union[Sequence[int], Tuple[int, ...]]
@@ -125,7 +125,7 @@ def ifftn(a: array, /, *, s: Union[Sequence[int], Tuple[int, ...]] = None, axes:
125125
Returns
126126
-------
127127
out: array
128-
an array transformed along the axes indicated by the `axes` keyword.
128+
an array transformed along the axes indicated by the `axes` keyword. The returned array must have a complex dtype with the same precision as the input ``x``.
129129
130130
131131
**Raises**
@@ -142,7 +142,7 @@ def rfft(a: array, /, *, n: Optional[int] = None, axis: int = -1, norm: str = 'b
142142
Parameters
143143
----------
144144
a: array
145-
input array
145+
input array. Should have a floating-point data type.
146146
n: int
147147
length of the transformed axis of the **input**. If given, the input will be either zero-padded or trimmed to this length before computing the real Fourier transform. Otherwise, the length of the input along the axis specified by the ``axis`` keyword is used. Default: ``None``.
148148
axis: int
@@ -159,7 +159,7 @@ def rfft(a: array, /, *, n: Optional[int] = None, axis: int = -1, norm: str = 'b
159159
Returns
160160
-------
161161
out: array
162-
a complex-valued array transformed along the axis indicated by the ``axis`` keyword. The length along the transformed axis is ``n//2+1``.
162+
a complex-valued array transformed along the axis indicated by the ``axis`` keyword. The length along the transformed axis is ``n//2+1``. The returned array must have a complex dtype with the same precision as the input ``x``.
163163
164164
165165
**Raises**
@@ -175,7 +175,7 @@ def irfft(a: array, /, *, n: Optional[int] = None, axis: int = -1, norm: str = '
175175
Parameters
176176
----------
177177
a: array
178-
input array
178+
input array. Should have a floating-point data type.
179179
n: int
180180
length of the transformed axis of the **output**. If given, the input will be either zero-padded or trimmed to ``n//2+1`` before computing the inverse of ``rfft``. Otherwise, it will default to ``2 * (m - 1)`` where ``m`` is the length of the input along the axis given by the ``axis`` keyword. Default: ``None``.
181181
axis: int
@@ -192,7 +192,7 @@ def irfft(a: array, /, *, n: Optional[int] = None, axis: int = -1, norm: str = '
192192
Returns
193193
-------
194194
out: array
195-
a real-valued array transformed along the axis indicated by the ``axis`` keyword. The length along the transformed axis is ``n`` (if given) or ``2 * (m - 1)``.
195+
a real-valued array transformed along the axis indicated by the ``axis`` keyword. The length along the transformed axis is ``n`` (if given) or ``2 * (m - 1)``. The returned array must have a complex dtype with the same precision as the input ``x``.
196196
197197
198198
**Raises**
@@ -208,7 +208,7 @@ def rfftn(a: array, /, *, s: Union[Sequence[int], Tuple[int, ...]] = None, axes:
208208
Parameters
209209
----------
210210
a: array
211-
input array
211+
input array. Should have a floating-point data type.
212212
s: Union[Sequence[int], Tuple[int, ...]]
213213
size of each transformed axis of the output. If given, each axis ``i`` will be either zero-padded or trimmed to the length ``s[i]`` before computing the real Fourier transform. Otherwise, the shape of the input along the axes given by the `axes` keyword. The last element ``s[-1]`` is for computing ``rfft(a[axes[-1]], n=s[-1])`` whereas other elements for ``fft(a[axes[i]], n=s[i])``. Default: ``None``.
214214
axes: Union[Sequence[int], Tuple[int, ...]]
@@ -225,7 +225,7 @@ def rfftn(a: array, /, *, s: Union[Sequence[int], Tuple[int, ...]] = None, axes:
225225
Returns
226226
-------
227227
out: array
228-
a complex-valued array transformed along the axes indicated by the ``axes`` keyword. The length along the last transformed axis is ``s[-1]//2+1`` and along other axes ``s[i]``.
228+
a complex-valued array transformed along the axes indicated by the ``axes`` keyword. The length along the last transformed axis is ``s[-1]//2+1`` and along other axes ``s[i]``. The returned array must have a complex dtype with the same precision as the input ``x``.
229229
230230
231231
**Raises**
@@ -242,7 +242,7 @@ def irfftn(a: array, /, *, s: Union[Sequence[int], Tuple[int, ...]] = None, axes
242242
Parameters
243243
----------
244244
a: array
245-
input array
245+
input array. Should have a floating-point data type.
246246
s: Union[Sequence[int], Tuple[int, ...]]
247247
size of each transformed axis of the **output**. If given, the last axis will be either zero-padded or trimmed to ``s[-1]//2+1``, whereas all other axes ``i`` are either zero-padded or trimmed to the length ``s[i]``, before computing the inverse of ``rfftn``. Otherwise, the last axis is either zero-padded or trimmed to ``2 * (m - 1)``, where `m` is the length of the input along the axis, and all other axes use the input shape. The last element ``s[-1]`` is for computing ``irfft(a[axes[-1]], n=s[-1])`` whereas other elements for ``ifft(a[axes[i]], n=s[i])``. Default: ``None``.
248248
axes: Union[Sequence[int], Tuple[int, ...]]
@@ -259,7 +259,7 @@ def irfftn(a: array, /, *, s: Union[Sequence[int], Tuple[int, ...]] = None, axes
259259
Returns
260260
-------
261261
out: array
262-
a real-valued array transformed along the axes indicated by the ``axes`` keyword. The length along the last transformed axis is ``s[-1]`` (if given) or ``2 * (m - 1)``, and all other axes ``s[i]``.
262+
a real-valued array transformed along the axes indicated by the ``axes`` keyword. The length along the last transformed axis is ``s[-1]`` (if given) or ``2 * (m - 1)``, and all other axes ``s[i]``. The returned array must have a complex dtype with the same precision as the input ``x``.
263263
264264
265265
**Raises**
@@ -276,7 +276,7 @@ def hfft(a: array, /, *, n: Optional[int] = None, axis: int = -1, norm: str = 'b
276276
Parameters
277277
----------
278278
a: array
279-
input array
279+
input array. Should have a floating-point data type.
280280
n: int
281281
length of the transformed axis of the output. If given, the input will be either zero-padded or trimmed to this length before computing the Hermitian Fourier transform. Otherwise, it will default to ``2 * (m - 1)`` where ``m`` is the length of the input along the axis given by the ``axis`` keyword. Default: ``None``.
282282
axis: int
@@ -293,7 +293,7 @@ def hfft(a: array, /, *, n: Optional[int] = None, axis: int = -1, norm: str = 'b
293293
Returns
294294
-------
295295
out: array
296-
a transformed array.
296+
a transformed array. The returned array must have a complex dtype with the same precision as the input ``x``.
297297
298298
299299
**Raises**
@@ -309,7 +309,7 @@ def ihfft(a: array, /, *, n: Optional[int] = None, axis: int = -1, norm: str = '
309309
Parameters
310310
----------
311311
a: array
312-
input array
312+
input array. Should have a floating-point data type.
313313
n: int
314314
length of the transformed axis of the output. If given, the input will be either zero-padded or trimmed to this length before computing the Hermitian Fourier transform. Otherwise, it will default to ``2 * (m - 1)`` where ``m`` is the length of the input along the axis given by the ``axis`` keyword. Default: ``None``.
315315
axis: int
@@ -326,7 +326,7 @@ def ihfft(a: array, /, *, n: Optional[int] = None, axis: int = -1, norm: str = '
326326
Returns
327327
-------
328328
out: array
329-
a transformed array.
329+
a transformed array. The returned array must have a complex dtype with the same precision as the input ``x``.
330330
331331
332332
**Raises**
@@ -392,7 +392,7 @@ def fftshift(x: array, /, *, axes: Union[int, Sequence[int], Tuple[int, ...]] =
392392
Parameters
393393
----------
394394
x: array
395-
input array.
395+
input array. Should have a floating-point data type.
396396
axes: Union[int, Sequence[int], Tuple[int, ...]]
397397
axes over which to shift. If not specified, it shifts all axes. Default: ``None``.
398398
@@ -410,7 +410,7 @@ def ifftshift(x: array, /, *, axes: Union[int, Sequence[int], Tuple[int, ...]] =
410410
Parameters
411411
----------
412412
x: array
413-
input array.
413+
input array. Should have a floating-point data type.
414414
axes: Union[int, Sequence[int], Tuple[int, ...]]
415415
axes over which to calculate. If not specified, it shifts all axes. Default: ``None``.
416416

0 commit comments

Comments
 (0)