Skip to content

Commit 99291f8

Browse files
authored
Merge branch 'master' into feat/enable-free-threaded-python-clean
2 parents 7f9f882 + 15acfc6 commit 99291f8

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎mkl_fft/interfaces/_scipy_fft.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,10 @@ def hfft(
523523
_check_plan(plan)
524524
x = _validate_input(x)
525525
norm = _swap_direction(norm)
526-
x = np.array(x, copy=True)
527-
np.conjugate(x, out=x)
526+
# np.conjugate(x) already allocates a fresh array, so there is no need
527+
# to copy x first and then conjugate it in place (which would touch
528+
# every element twice instead of once).
529+
x = np.conjugate(x)
528530

529531
with _Workers(workers):
530532
# Note: overwrite_x is not utilized
@@ -626,8 +628,10 @@ def hfftn(
626628
_check_plan(plan)
627629
x = _validate_input(x)
628630
norm = _swap_direction(norm)
629-
x = np.array(x, copy=True)
630-
np.conjugate(x, out=x)
631+
# np.conjugate(x) already allocates a fresh array, so there is no need
632+
# to copy x first and then conjugate it in place (which would touch
633+
# every element twice instead of once).
634+
x = np.conjugate(x)
631635
s, axes = _init_nd_shape_and_axes(x, s, axes, invreal=True)
632636

633637
with _Workers(workers):

0 commit comments

Comments
 (0)