Skip to content

Commit c9e945b

Browse files
committed
Update to be a complete identity operation - preserving the original dtype, not converting real to complex
1 parent f1e8754 commit c9e945b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

mkl_fft/_fft_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,13 @@ def _c2c_fftnd_impl(
415415
else:
416416
x = np.asarray(x)
417417

418-
# Fast path: FFT over no axes is identity (just type conversion, no scaling)
418+
# Fast path: FFT over no axes is complete identity (preserve dtype)
419419
_, xa = _cook_nd_args(x, s, axes)
420420
if len(xa) == 0:
421421
if out is None:
422-
out = x.astype(dtype=_output_dtype(x.dtype), copy=True)
422+
out = x.copy()
423423
else:
424-
_validate_out_array(out, x, _output_dtype(x.dtype))
424+
_validate_out_array(out, x, x.dtype)
425425
np.copyto(out, x)
426426
# No scaling applied - identity transform has no normalization
427427
return out

mkl_fft/tests/test_fftnd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ def test_empty_axes_with_out(dtype, func):
353353
else:
354354
x = rnd.random((3, 4)).astype(dtype)
355355

356-
out_dtype = np.dtype(dtype).char.upper()
357-
out = np.empty_like(x, dtype=out_dtype)
356+
# For axes=(), output dtype should match input dtype (identity transform)
357+
out = np.empty_like(x, dtype=dtype)
358358
result = getattr(mkl_fft, func)(x, axes=(), out=out)
359359
expected = getattr(np.fft, func)(x, axes=())
360360

0 commit comments

Comments
 (0)