summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2023-03-28 23:49:26 +0100
committerRalf Gommers <ralf.gommers@gmail.com>2023-03-28 23:51:36 +0100
commit8bdb8c327696d2f8c834b66f411e7d4216dc612c (patch)
tree637542b49c4f6d48600b25f92fdf2f28ec25515a
parent94d4f702017be274acb130cbe9cf163910137fbc (diff)
downloadnumpy-8bdb8c327696d2f8c834b66f411e7d4216dc612c.tar.gz
DEP: remove deprecated `numpy.dual` module
It has been deprecated since numpy 1.20, and code search engines don't turn up a reason to keep this around. [skip actions] [skip cirrus]
-rw-r--r--doc/release/upcoming_changes/23480.expired.rst1
-rw-r--r--doc/source/reference/routines.dual.rst47
-rw-r--r--doc/source/reference/routines.rst1
-rw-r--r--numpy/__init__.py4
-rw-r--r--numpy/dual.py83
5 files changed, 1 insertions, 135 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)