Skip to content

update functions name #137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions mkl_fft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from ._pydfti import (fft, ifft, fft2, ifft2, fftn, ifftn, rfft, irfft,
rfft_numpy, irfft_numpy, rfftn_numpy, irfftn_numpy)
from ._pydfti import (fft, ifft, fft2, ifft2, fftn, ifftn, rfftpack, irfftpack,
rfft, irfft, rfft2, irfft2, rfftn, irfftn)

from ._version import __version__
import mkl_fft.interfaces

__all__ = ['fft', 'ifft', 'fft2', 'ifft2', 'fftn', 'ifftn', 'rfft', 'irfft',
'rfft_numpy', 'irfft_numpy', 'rfftn_numpy', 'irfftn_numpy', 'interfaces']
__all__ = ['fft', 'ifft', 'fft2', 'ifft2', 'fftn', 'ifftn', 'rfftpack', 'irfftpack'
'rfft', 'irfft', 'rfft2', 'irfft2', 'rfftn', 'irfftn','interfaces']
12 changes: 6 additions & 6 deletions mkl_fft/_numpy_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def rfft(a, n=None, axis=-1, norm=None):
fsc = ortho_sc_1d(n, x.shape[axis])

return trycall(
mkl_fft.rfft_numpy,
mkl_fft.rfft,
(x,),
{'n': n, 'axis': axis,
'fwd_scale': fsc})
Expand Down Expand Up @@ -510,7 +510,7 @@ def irfft(a, n=None, axis=-1, norm=None):
fsc = ortho_sc_1d(nn, nn)

return trycall(
mkl_fft.irfft_numpy,
mkl_fft.irfft,
(x,),
{'n': n, 'axis': axis,
'fwd_scale': fsc})
Expand Down Expand Up @@ -606,7 +606,7 @@ def hfft(a, n=None, axis=-1, norm=None):
fsc = ortho_sc_1d(nn, nn)

return trycall(
mkl_fft.irfft_numpy,
mkl_fft.irfft,
(x,),
{'n': n, 'axis': axis,
'fwd_scale': fsc})
Expand Down Expand Up @@ -682,7 +682,7 @@ def ihfft(a, n=None, axis=-1, norm=None):
fsc = ortho_sc_1d(n, x.shape[axis])

output = trycall(
mkl_fft.rfft_numpy,
mkl_fft.rfft,
(x,),
{'n': n, 'axis': axis,
'fwd_scale': fsc})
Expand Down Expand Up @@ -1237,7 +1237,7 @@ def rfftn(a, s=None, axes=None, norm=None):
fsc = sqrt(frwd_sc_nd(s, axes, x.shape))

return trycall(
mkl_fft.rfftn_numpy,
mkl_fft.rfftn,
(x,),
{'s': s, 'axes': axes,
'fwd_scale': fsc})
Expand Down Expand Up @@ -1394,7 +1394,7 @@ def irfftn(a, s=None, axes=None, norm=None):
fsc = sqrt(frwd_sc_nd(s, axes, x.shape))

return trycall(
mkl_fft.irfftn_numpy,
mkl_fft.irfftn,
(x,),
{'s': s, 'axes': axes,
'fwd_scale': fsc})
Expand Down
31 changes: 15 additions & 16 deletions mkl_fft/_pydfti.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,12 @@ def _fft1d_impl(x, n=None, axis=-1, overwrite_arg=False, direction=+1, double fs
return f_arr


def rfft(x, n=None, axis=-1, overwrite_x=False, fwd_scale=1.0):
def rfftpack(x, n=None, axis=-1, overwrite_x=False, fwd_scale=1.0):
"""Packed real-valued harmonics of FFT of a real sequence x"""
return _rr_fft1d_impl2(x, n=n, axis=axis, overwrite_arg=overwrite_x, fsc=fwd_scale)


def irfft(x, n=None, axis=-1, overwrite_x=False, fwd_scale=1.0):
def irfftpack(x, n=None, axis=-1, overwrite_x=False, fwd_scale=1.0):
"""Inverse FFT of a real sequence, takes packed real-valued harmonics of FFT"""
return _rr_ifft1d_impl2(x, n=n, axis=axis, overwrite_arg=overwrite_x, fsc=fwd_scale)

Expand Down Expand Up @@ -524,7 +524,7 @@ def _rr_fft1d_impl2(x, n=None, axis=-1, overwrite_arg=False, double fsc=1.0):
"""
Uses MKL to perform real packed 1D FFT on the input array x along the given axis.

This done by using rfft_numpy and post-processing the result.
This done by using rfft and post-processing the result.
Thus overwrite_arg is effectively discarded.

Functionally equivalent to scipy.fftpack.rfft
Expand Down Expand Up @@ -580,7 +580,7 @@ def _rr_ifft1d_impl2(x, n=None, axis=-1, overwrite_arg=False, double fsc=1.0):
"""
Uses MKL to perform real packed 1D FFT on the input array x along the given axis.

This done by using rfft_numpy and post-processing the result.
This done by using rfft and post-processing the result.
Thus overwrite_arg is effectively discarded.

Functionally equivalent to scipy.fftpack.irfft
Expand Down Expand Up @@ -793,11 +793,11 @@ def _rc_ifft1d_impl(x, n=None, axis=-1, overwrite_arg=False, double fsc=1.0):
return f_arr


def rfft_numpy(x, n=None, axis=-1, fwd_scale=1.0):
def rfft(x, n=None, axis=-1, fwd_scale=1.0):
return _rc_fft1d_impl(x, n=n, axis=axis, fsc=fwd_scale)


def irfft_numpy(x, n=None, axis=-1, fwd_scale=1.0):
def irfft(x, n=None, axis=-1, fwd_scale=1.0):
return _rc_ifft1d_impl(x, n=n, axis=axis, fsc=fwd_scale)


Expand Down Expand Up @@ -1121,12 +1121,12 @@ def ifftn(x, shape=None, axes=None, overwrite_x=False, fwd_scale=1.0):
return _fftnd_impl(x, shape=shape, axes=axes, overwrite_x=overwrite_x, direction=-1, fsc=fwd_scale)


def rfft2_numpy(x, s=None, axes=(-2,-1), fwd_scale=1.0):
return rfftn_numpy(x, s=s, axes=axes, fsc=fwd_scale)
def rfft2(x, s=None, axes=(-2,-1), fwd_scale=1.0):
return rfftn(x, s=s, axes=axes, fsc=fwd_scale)


def irfft2_numpy(x, s=None, axes=(-2,-1), fwd_scale=1.0):
return irfftn_numpy(x, s=s, axes=axes, fsc=fwd_scale)
def irfft2(x, s=None, axes=(-2,-1), fwd_scale=1.0):
return irfftn(x, s=s, axes=axes, fsc=fwd_scale)


def _remove_axis(s, axes, axis_to_remove):
Expand Down Expand Up @@ -1181,16 +1181,15 @@ def _fix_dimensions(cnp.ndarray arr, object s, object axes):
return np.pad(arr, tuple(pad_widths), 'constant')


def rfftn_numpy(x, s=None, axes=None, fwd_scale=1.0):
def rfftn(x, s=None, axes=None, fwd_scale=1.0):
a = np.asarray(x)
no_trim = (s is None) and (axes is None)
s, axes = _cook_nd_args(a, s, axes)
la = axes[-1]
# trim array, so that rfft_numpy avoids doing
# unnecessary computations
# trim array, so that rfft avoids doing unnecessary computations
if not no_trim:
a = _trim_array(a, s, axes)
a = rfft_numpy(a, n = s[-1], axis=la, fwd_scale=fwd_scale)
a = rfft(a, n = s[-1], axis=la, fwd_scale=fwd_scale)
if len(s) > 1:
if not no_trim:
ss = list(s)
Expand All @@ -1214,7 +1213,7 @@ def rfftn_numpy(x, s=None, axes=None, fwd_scale=1.0):
return a


def irfftn_numpy(x, s=None, axes=None, fwd_scale=1.0):
def irfftn(x, s=None, axes=None, fwd_scale=1.0):
a = np.asarray(x)
no_trim = (s is None) and (axes is None)
s, axes = _cook_nd_args(a, s, axes, invreal=True)
Expand Down Expand Up @@ -1243,5 +1242,5 @@ def irfftn_numpy(x, s=None, axes=None, fwd_scale=1.0):
for ii in range(len(axes)-1):
a = ifft(a, s[ii], axes[ii], overwrite_x=ovr_x)
ovr_x = True
a = irfft_numpy(a, n = s[-1], axis=la, fwd_scale=fwd_scale)
a = irfft(a, n = s[-1], axis=la, fwd_scale=fwd_scale)
return a
Loading
Loading