|
76 | 76 | import numpy as np |
77 | 77 |
|
78 | 78 | from . import _pydfti as mkl_fft # pylint: disable=no-name-in-module |
79 | | -from ._fft_utils import _check_norm, _compute_fwd_scale |
| 79 | +from ._fft_utils import _compute_fwd_scale, _swap_direction |
80 | 80 | from ._float_utils import _downcast_float128_array |
81 | 81 |
|
82 | 82 |
|
@@ -124,18 +124,6 @@ def _cook_nd_args(a, s=None, axes=None, invreal=False): |
124 | 124 | return s, axes |
125 | 125 |
|
126 | 126 |
|
127 | | -def _swap_direction(norm): |
128 | | - _check_norm(norm) |
129 | | - _swap_direction_map = { |
130 | | - "backward": "forward", |
131 | | - None: "forward", |
132 | | - "ortho": "ortho", |
133 | | - "forward": "backward", |
134 | | - } |
135 | | - |
136 | | - return _swap_direction_map[norm] |
137 | | - |
138 | | - |
139 | 127 | def trycall(func, args, kwrds): |
140 | 128 | try: |
141 | 129 | res = func(*args, **kwrds) |
@@ -604,7 +592,7 @@ def hfft(a, n=None, axis=-1, norm=None): |
604 | 592 |
|
605 | 593 | norm = _swap_direction(norm) |
606 | 594 | x = _downcast_float128_array(a) |
607 | | - x = np.array(x, copy=True, dtype=complex) |
| 595 | + x = np.array(x, copy=True) |
608 | 596 | np.conjugate(x, out=x) |
609 | 597 | fsc = _compute_fwd_scale(norm, n, 2 * (x.shape[axis] - 1)) |
610 | 598 |
|
@@ -671,10 +659,8 @@ def ihfft(a, n=None, axis=-1, norm=None): |
671 | 659 |
|
672 | 660 | """ |
673 | 661 |
|
674 | | - # The copy may be required for multithreading. |
675 | 662 | norm = _swap_direction(norm) |
676 | 663 | x = _downcast_float128_array(a) |
677 | | - x = np.array(x, copy=True, dtype=float) |
678 | 664 | fsc = _compute_fwd_scale(norm, n, x.shape[axis]) |
679 | 665 |
|
680 | 666 | output = trycall( |
|
0 commit comments