Skip to content

Commit 406693e

Browse files
committed
Update index url and check for macos
1 parent 129f485 commit 406693e

5 files changed

Lines changed: 9 additions & 86 deletions

File tree

pylops/signalprocessing/fft.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import pyfftw
2323

2424
if mkl_fft_message is None:
25-
import mkl_fft.interfaces.scipy_fft as mkl_backend
25+
import mkl_fft.interfaces.numpy_fft as mkl_backend
2626

2727
logger = logging.getLogger(__name__)
2828

@@ -414,21 +414,6 @@ def __init__(
414414
dtype: DTypeLike = "complex128",
415415
**kwargs_fft,
416416
) -> None:
417-
if np.dtype(dtype) == np.float16:
418-
warnings.warn(
419-
"mkl_fft backend is unavailable with float16 dtype. Will use float32."
420-
)
421-
dtype = np.float32
422-
elif np.dtype(dtype) == np.complex256:
423-
warnings.warn(
424-
"mkl_fft backend is unavailable with complex256 dtype. Will use complex128."
425-
)
426-
dtype = np.complex128
427-
elif np.dtype(dtype) == np.float128:
428-
warnings.warn(
429-
"mkl_fft backend is unavailable with float128 dtype. Will use float64."
430-
)
431-
dtype = np.float64
432417
super().__init__(
433418
dims=dims,
434419
axis=axis,
@@ -452,12 +437,6 @@ def __init__(
452437

453438
@reshaped
454439
def _matvec(self, x: NDArray) -> NDArray:
455-
if x.dtype == np.float16:
456-
x = x.astype(np.float32)
457-
elif x.dtype == np.float128:
458-
x = x.astype(np.float64)
459-
elif x.dtype == np.complex256:
460-
x = x.astype(np.complex128)
461440
if self.ifftshift_before:
462441
x = mkl_backend.ifftshift(x, axes=self.axis)
463442
if not self.clinear:
@@ -477,12 +456,6 @@ def _matvec(self, x: NDArray) -> NDArray:
477456

478457
@reshaped
479458
def _rmatvec(self, x: NDArray) -> NDArray:
480-
if x.dtype == np.float16:
481-
x = x.astype(np.float32)
482-
elif x.dtype == np.float128:
483-
x = x.astype(np.float64)
484-
elif x.dtype == np.complex256:
485-
x = x.astype(np.complex128)
486459
if self.fftshift_after:
487460
x = mkl_backend.ifftshift(x, axes=self.axis)
488461
if self.real:

pylops/signalprocessing/fft2d.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
mkl_fft_message = deps.mkl_fft_import("the mkl fft module")
1717

1818
if mkl_fft_message is None:
19-
import mkl_fft.interfaces.scipy_fft as mkl_backend
19+
import mkl_fft.interfaces.numpy_fft as mkl_backend
2020

2121

2222
class _FFT2D_numpy(_BaseFFTND):
@@ -257,21 +257,6 @@ def __init__(
257257
dtype: DTypeLike = "complex128",
258258
**kwargs_fft,
259259
) -> None:
260-
if np.dtype(dtype) == np.float16:
261-
warnings.warn(
262-
"mkl_fft backend is unavailable with float16 dtype. Will use float32."
263-
)
264-
dtype = np.float32
265-
elif np.dtype(dtype) == np.complex256:
266-
warnings.warn(
267-
"mkl_fft backend is unavailable with complex256 dtype. Will use complex128."
268-
)
269-
dtype = np.complex128
270-
elif np.dtype(dtype) == np.float128:
271-
warnings.warn(
272-
"mkl_fft backend is unavailable with float128 dtype. Will use float64."
273-
)
274-
dtype = np.float64
275260
super().__init__(
276261
dims=dims,
277262
axes=axes,
@@ -305,12 +290,6 @@ def __init__(
305290

306291
@reshaped
307292
def _matvec(self, x):
308-
if x.dtype == np.float16:
309-
x = x.astype(np.float32)
310-
elif x.dtype == np.float128:
311-
x = x.astype(np.float64)
312-
elif x.dtype == np.complex256:
313-
x = x.astype(np.complex128)
314293
if self.ifftshift_before.any():
315294
x = mkl_backend.ifftshift(x, axes=self.axes[self.ifftshift_before])
316295
if not self.clinear:
@@ -335,12 +314,6 @@ def _matvec(self, x):
335314

336315
@reshaped
337316
def _rmatvec(self, x):
338-
if x.dtype == np.float16:
339-
x = x.astype(np.float32)
340-
elif x.dtype == np.float128:
341-
x = x.astype(np.float64)
342-
elif x.dtype == np.complex256:
343-
x = x.astype(np.complex128)
344317
if self.fftshift_after.any():
345318
x = mkl_backend.ifftshift(x, axes=self.axes[self.fftshift_after])
346319
if self.real:

pylops/signalprocessing/fftnd.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
mkl_fft_message = deps.mkl_fft_import("the mkl fft module")
1717

1818
if mkl_fft_message is None:
19-
import mkl_fft.interfaces.scipy_fft as mkl_backend
19+
import mkl_fft.interfaces.numpy_fft as mkl_backend
2020

2121

2222
class _FFTND_numpy(_BaseFFTND):
@@ -238,21 +238,6 @@ def __init__(
238238
dtype: DTypeLike = "complex128",
239239
**kwargs_fft,
240240
) -> None:
241-
if np.dtype(dtype) == np.float16:
242-
warnings.warn(
243-
"mkl_fft backend is unavailable with float16 dtype. Will use float32."
244-
)
245-
dtype = np.float32
246-
elif np.dtype(dtype) == np.complex256:
247-
warnings.warn(
248-
"mkl_fft backend is unavailable with complex256 dtype. Will use complex128."
249-
)
250-
dtype = np.complex128
251-
elif np.dtype(dtype) == np.float128:
252-
warnings.warn(
253-
"mkl_fft backend is unavailable with float128 dtype. Will use float64."
254-
)
255-
dtype = np.float64
256241
super().__init__(
257242
dims=dims,
258243
axes=axes,
@@ -275,12 +260,6 @@ def __init__(
275260

276261
@reshaped
277262
def _matvec(self, x: NDArray) -> NDArray:
278-
if x.dtype == np.float16:
279-
x = x.astype(np.float32)
280-
elif x.dtype == np.float128:
281-
x = x.astype(np.float64)
282-
elif x.dtype == np.complex256:
283-
x = x.astype(np.complex128)
284263
if self.ifftshift_before.any():
285264
x = mkl_backend.ifftshift(x, axes=self.axes[self.ifftshift_before])
286265
if not self.clinear:
@@ -305,12 +284,6 @@ def _matvec(self, x: NDArray) -> NDArray:
305284

306285
@reshaped
307286
def _rmatvec(self, x: NDArray) -> NDArray:
308-
if x.dtype == np.float16:
309-
x = x.astype(np.float32)
310-
elif x.dtype == np.float128:
311-
x = x.astype(np.float64)
312-
elif x.dtype == np.complex256:
313-
x = x.astype(np.complex128)
314287
if self.fftshift_after.any():
315288
x = mkl_backend.ifftshift(x, axes=self.axes[self.fftshift_after])
316289
if self.real:

requirements-dev.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
--index-url https://software.repos.intel.com/python/pypi
2+
--extra-index-url https://pypi.org/simple
3+
mkl_fft
14
numpy>=2.0.0
25
scipy>=1.13.0
36
jax
@@ -30,4 +33,3 @@ black
3033
flake8
3134
mypy
3235
pytensor>=2.28.0
33-
mkl-fft; sys_platform != "darwin"

requirements-doc.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
--index-url https://software.repos.intel.com/python/pypi
2+
--extra-index-url https://pypi.org/simple
3+
mkl_fft
14
numpy>=2.0.0
25
scipy>=1.13.0
36
jax
@@ -31,4 +34,3 @@ flake8
3134
mypy
3235
pytensor>=2.28.0
3336
pymc>=5.21.0
34-
mkl-fft; sys_platform != "darwin"

0 commit comments

Comments
 (0)