Skip to content

Commit d87fc0b

Browse files
committed
Add docstring to _iter_fftnd
1 parent 155cfc0 commit d87fc0b

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

mkl_fft/_fft_utils.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,49 @@ def _iter_fftnd(
262262
direction=+1,
263263
scale_function=lambda ind: 1.0,
264264
):
265+
"""
266+
Perform N-D FFT as a series of 1-D FFTs along specified axes.
267+
268+
This function implements N-D FFT by applying 1-D FFT iteratively along each
269+
axis. The axes are processed in reverse order to end with the first axis
270+
given.
271+
272+
Parameters
273+
----------
274+
a : ndarray
275+
Input array.
276+
s : sequence of ints, optional
277+
Shape of the FFT output along each axis in `axes`. If not provided, the
278+
shape is inferred from the input array.
279+
Default: ``None``
280+
axes : sequence of ints, optional
281+
Axes along which to compute the FFT. If not provided, all axes are used.
282+
Default: ``None``
283+
out : ndarray, optional
284+
Output array to store the result. Used for in-place operations when
285+
possible.
286+
Default: ``None``
287+
direction : int, optional
288+
FFT direction: ``+1`` for forward FFT, ``-1`` for inverse FFT.
289+
Default: ``+1``
290+
scale_function : callable, optional
291+
Function that takes iteration index and returns the scaling factor for
292+
that step. Used to apply normalization at specific iteration steps.
293+
Default: ``lambda ind: 1.0``
294+
295+
Returns
296+
-------
297+
ndarray
298+
The transformed array.
299+
300+
Notes
301+
-----
302+
The function optimizes memory usage by performing in-place calculations
303+
when possible. In-place operations are used everywhere except when the
304+
array size changes after the first FFT along an axis.
305+
306+
"""
307+
265308
s, axes = _init_nd_shape_and_axes(a, s, axes)
266309

267310
# Combine the two, but in reverse, to end with the first axis given.

0 commit comments

Comments
 (0)