eigen.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # This file is not meant for public use and will be removed in SciPy v2.0.0.
  2. # Use the `scipy.sparse.linalg` namespace for importing the functions
  3. # included below.
  4. import warnings
  5. from . import _eigen
  6. __all__ = [ # noqa: F822
  7. 'ArpackError', 'ArpackNoConvergence',
  8. 'eigs', 'eigsh', 'lobpcg', 'svds', 'arpack', 'test'
  9. ]
  10. eigen_modules = ['arpack']
  11. def __dir__():
  12. return __all__
  13. def __getattr__(name):
  14. if name not in __all__ and name not in eigen_modules:
  15. raise AttributeError(
  16. "scipy.sparse.linalg.eigen is deprecated and has no attribute "
  17. f"{name}. Try looking in scipy.sparse.linalg instead.")
  18. if name in eigen_modules:
  19. msg = (f'The module `scipy.sparse.linalg.eigen.{name}` is '
  20. 'deprecated. All public names must be imported directly from '
  21. 'the `scipy.sparse.linalg` namespace.')
  22. else:
  23. msg = (f"Please use `{name}` from the `scipy.sparse.linalg` namespace,"
  24. " the `scipy.sparse.linalg.eigen` namespace is deprecated.")
  25. warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
  26. return getattr(_eigen, name)