Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
50 changes: 50 additions & 0 deletions mkl_fft/interfaces/_scipy_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import mkl
import numpy as np
import scipy

import mkl_fft

Expand All @@ -61,6 +62,10 @@
"ihfft2",
"hfftn",
"ihfftn",
"fftshift",
"ifftshift",
"fftfreq",
"rfftfreq",
"get_workers",
"set_workers",
]
Expand Down Expand Up @@ -650,6 +655,51 @@ def ihfftn(
return result


# define thin wrappers for scipy functions to avoid circular dependencies
def fftfreq(n, d=1.0, *, xp=None, device=None):
"""
Return the Discrete Fourier Transform sample frequencies.

For full documentation refer to `scipy.fft.fftfreq`.

"""
return scipy.fft.fftfreq(n, d=d, xp=xp, device=device)


def rfftfreq(n, d=1.0, *, xp=None, device=None):
"""
Return the Discrete Fourier Transform sample frequencies (for usage with
`rfft`, `irfft`).

For full documentation refer to `scipy.fft.rfftfreq`.

"""
return scipy.fft.rfftfreq(n, d=d, xp=xp, device=device)


def fftshift(x, axes=None):
"""
Shift the zero-frequency component to the center of the spectrum.

For full documentation refer to `scipy.fft.fftshift`.

"""
from scipy.fft import fftshift

return fftshift(x, axes=axes)


def ifftshift(x, axes=None):
"""
The inverse of `fftshift`. Although identical for even-length `x`, the
functions differ by one sample for odd-length `x`.

For full documentation refer to `scipy.fft.ifftshift`.

"""
return scipy.fft.ifftshift(x, axes=axes)


def get_workers():
"""
Gets the number of workers used by mkl_fft by default.
Expand Down
93 changes: 0 additions & 93 deletions mkl_fft/interfaces/_scipy_helper.py

This file was deleted.

5 changes: 4 additions & 1 deletion mkl_fft/interfaces/scipy_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@
from ._scipy_fft import (
fft,
fft2,
fftfreq,
fftn,
fftshift,
get_workers,
hfft,
hfft2,
hfftn,
ifft,
ifft2,
ifftn,
ifftshift,
ihfft,
ihfft2,
ihfftn,
Expand All @@ -44,10 +47,10 @@
irfftn,
rfft,
rfft2,
rfftfreq,
rfftn,
set_workers,
)
from ._scipy_helper import fftfreq, fftshift, ifftshift, rfftfreq

__all__ = [
"fft",
Expand Down
Loading