diff options
| author | Charles Harris <charlesr.harris@gmail.com> | 2023-03-28 21:41:24 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-28 21:41:24 -0400 |
| commit | 95eeb2a45f76062bcf77101fcd14067ca8075166 (patch) | |
| tree | 9a719e4280d1a2851f7cbfe539af531069b5220b | |
| parent | 94d4f702017be274acb130cbe9cf163910137fbc (diff) | |
| parent | baff4644364d5b5e8ac6196ba918c470f7e43782 (diff) | |
| download | numpy-95eeb2a45f76062bcf77101fcd14067ca8075166.tar.gz | |
Merge pull request #23480 from rgommers/remove-dual
DEP: remove deprecated `numpy.dual` module
| -rw-r--r-- | doc/release/upcoming_changes/23480.expired.rst | 1 | ||||
| -rw-r--r-- | doc/source/reference/routines.dual.rst | 47 | ||||
| -rw-r--r-- | doc/source/reference/routines.rst | 1 | ||||
| -rw-r--r-- | numpy/__init__.py | 4 | ||||
| -rw-r--r-- | numpy/dual.py | 83 | ||||
| -rw-r--r-- | numpy/meson.build | 1 | ||||
| -rw-r--r-- | numpy/tests/test_public_api.py | 1 |
7 files changed, 1 insertions, 137 deletions
diff --git a/doc/release/upcoming_changes/23480.expired.rst b/doc/release/upcoming_changes/23480.expired.rst new file mode 100644 index 000000000..164677b98 --- /dev/null +++ b/doc/release/upcoming_changes/23480.expired.rst @@ -0,0 +1 @@ +* The ``np.dual`` submodule has been removed. diff --git a/doc/source/reference/routines.dual.rst b/doc/source/reference/routines.dual.rst deleted file mode 100644 index 18c7791d0..000000000 --- a/doc/source/reference/routines.dual.rst +++ /dev/null @@ -1,47 +0,0 @@ -Optionally SciPy-accelerated routines (:mod:`numpy.dual`) -========================================================= - -.. automodule:: numpy.dual - -Linear algebra --------------- - -.. currentmodule:: numpy.linalg - -.. autosummary:: - - cholesky - det - eig - eigh - eigvals - eigvalsh - inv - lstsq - norm - pinv - solve - svd - -FFT ---- - -.. currentmodule:: numpy.fft - -.. autosummary:: - - fft - fft2 - fftn - ifft - ifft2 - ifftn - -Other ------ - -.. currentmodule:: numpy - -.. autosummary:: - - i0 diff --git a/doc/source/reference/routines.rst b/doc/source/reference/routines.rst index 24117895b..72ed80972 100644 --- a/doc/source/reference/routines.rst +++ b/doc/source/reference/routines.rst @@ -24,7 +24,6 @@ indentation. routines.ctypeslib routines.datetime routines.dtype - routines.dual routines.emath routines.err routines.fft diff --git a/numpy/__init__.py b/numpy/__init__.py index e41f7eae6..1880ceace 100644 --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -74,10 +74,6 @@ test Run numpy unittests show_config Show numpy build configuration -dual - Overwrite certain functions with high-performance SciPy tools. - Note: `numpy.dual` is deprecated. Use the functions from NumPy or Scipy - directly instead of importing them from `numpy.dual`. matlib Make everything matrices. __version__ diff --git a/numpy/dual.py b/numpy/dual.py deleted file mode 100644 index eb7e61aac..000000000 --- a/numpy/dual.py +++ /dev/null @@ -1,83 +0,0 @@ -""" -.. deprecated:: 1.20 - -*This module is deprecated. Instead of importing functions from* -``numpy.dual``, *the functions should be imported directly from NumPy -or SciPy*. - -Aliases for functions which may be accelerated by SciPy. - -SciPy_ can be built to use accelerated or otherwise improved libraries -for FFTs, linear algebra, and special functions. This module allows -developers to transparently support these accelerated functions when -SciPy is available but still support users who have only installed -NumPy. - -.. _SciPy : https://www.scipy.org - -""" -import warnings - - -warnings.warn('The module numpy.dual is deprecated. Instead of using dual, ' - 'use the functions directly from numpy or scipy.', - category=DeprecationWarning, - stacklevel=2) - -# This module should be used for functions both in numpy and scipy if -# you want to use the numpy version if available but the scipy version -# otherwise. -# Usage --- from numpy.dual import fft, inv - -__all__ = ['fft', 'ifft', 'fftn', 'ifftn', 'fft2', 'ifft2', - 'norm', 'inv', 'svd', 'solve', 'det', 'eig', 'eigvals', - 'eigh', 'eigvalsh', 'lstsq', 'pinv', 'cholesky', 'i0'] - -import numpy.linalg as linpkg -import numpy.fft as fftpkg -from numpy.lib import i0 -import sys - - -fft = fftpkg.fft -ifft = fftpkg.ifft -fftn = fftpkg.fftn -ifftn = fftpkg.ifftn -fft2 = fftpkg.fft2 -ifft2 = fftpkg.ifft2 - -norm = linpkg.norm -inv = linpkg.inv -svd = linpkg.svd -solve = linpkg.solve -det = linpkg.det -eig = linpkg.eig -eigvals = linpkg.eigvals -eigh = linpkg.eigh -eigvalsh = linpkg.eigvalsh -lstsq = linpkg.lstsq -pinv = linpkg.pinv -cholesky = linpkg.cholesky - -_restore_dict = {} - -def register_func(name, func): - if name not in __all__: - raise ValueError("{} not a dual function.".format(name)) - f = sys._getframe(0).f_globals - _restore_dict[name] = f[name] - f[name] = func - -def restore_func(name): - if name not in __all__: - raise ValueError("{} not a dual function.".format(name)) - try: - val = _restore_dict[name] - except KeyError: - return - else: - sys._getframe(0).f_globals[name] = val - -def restore_all(): - for name in _restore_dict.keys(): - restore_func(name) diff --git a/numpy/meson.build b/numpy/meson.build index b366b7b05..cc5a79bb2 100644 --- a/numpy/meson.build +++ b/numpy/meson.build @@ -103,7 +103,6 @@ python_sources = [ 'conftest.py', 'ctypeslib.py', 'ctypeslib.pyi', - 'dual.py', 'exceptions.py', 'exceptions.pyi', 'matlib.py', diff --git a/numpy/tests/test_public_api.py b/numpy/tests/test_public_api.py index 108ba0b74..e0681426e 100644 --- a/numpy/tests/test_public_api.py +++ b/numpy/tests/test_public_api.py @@ -248,7 +248,6 @@ PRIVATE_BUT_PRESENT_MODULES = ['numpy.' + s for s in [ "distutils.numpy_distribution", "distutils.pathccompiler", "distutils.unixccompiler", - "dual", "f2py.auxfuncs", "f2py.capi_maps", "f2py.cb_rules", |
