Skip to content

Commit c1038d4

Browse files
vlad-perevezentsevantonwolfy
authored andcommitted
Introduce dpnp.scipy submodule (#2603)
This PR proposes introducing `dpnp.scipy` submodule with `linalg` and `special` providing a SciPy-compatible interface of DPNP and a place for future SciPy-specific functions. It moves `dpnp.linalg.lu_factor()`, `dpnp.linalg.lu_solve()` and `dpnp.special.erf` functions to the new submodule, updates tests and adds an API Reference section `Routines (SciPy)`
1 parent d8b95d6 commit c1038d4

28 files changed

+797
-579
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ repos:
113113
"--disable=redefined-builtin",
114114
"--disable=unused-wildcard-import"
115115
]
116-
files: '^dpnp/(dpnp_iface.*|fft|linalg|special|dpnp_array)'
116+
files: '^dpnp/(dpnp_iface.*|fft|linalg|scipy|dpnp_array)'
117117
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
118118
rev: v2.15.0
119119
hooks:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ This release is compatible with NumPy 2.3.3.
2424
* Added implementation of `dpnp.piecewise` [#2550](https://github.com/IntelPython/dpnp/pull/2550)
2525
* Added implementation of `dpnp.linalg.lu_solve` for 2D inputs (SciPy-compatible) [#2575](https://github.com/IntelPython/dpnp/pull/2575)
2626
* Added implementation of `dpnp.special.erfc` [#2588](https://github.com/IntelPython/dpnp/pull/2588)
27+
* Added `dpnp.scipy` submodule to aggregate new SciPy-compatible functions from `linalg` and `special` namespaces [#2603](https://github.com/IntelPython/dpnp/pull/2603)
2728

2829
### Changed
2930

doc/reference/routines.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
--------
2-
Routines
3-
--------
1+
Routines (NumPy)
2+
================
43

54
The following pages describe NumPy-compatible routines.
65
These functions cover a subset of

doc/reference/scipy.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Routines (SciPy) (:mod:`dpnp.scipy`)
2+
====================================
3+
4+
The following pages describe SciPy-compatible routines.
5+
These functions cover a subset of
6+
`SciPy routines <https://docs.scipy.org/doc/scipy/reference/#api-reference>`_.
7+
8+
.. toctree::
9+
:maxdepth: 2
10+
11+
scipy_linalg
12+
scipy_special

doc/reference/scipy_linalg.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.. currentmodule:: dpnp.scipy.linalg
2+
3+
Linear algebra (:mod:`dpnp.scipy.linalg`)
4+
=========================================
5+
6+
.. Hint:: `SciPy API Reference: Linear algebra (scipy.linalg) <https://docs.scipy.org/doc/scipy/reference/linalg.html>`_
7+
8+
Decompositions
9+
--------------
10+
11+
.. autosummary::
12+
:toctree: generated/
13+
:nosignatures:
14+
15+
lu
16+
lu_factor
17+
lu_solve

doc/reference/special.rst renamed to doc/reference/scipy_special.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
.. currentmodule:: dpnp.special
1+
.. currentmodule:: dpnp.scipy.special
22

3-
Special functions (:mod:`dpnp.special`)
3+
Special functions (:mod:`dpnp.scipy.special`)
44
=======================================
55

66
.. Hint:: `SciPy API Reference: Special functions (scipy.special) <https://docs.scipy.org/doc/scipy/reference/special.html>`_

dpnp/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,13 @@
7171
from .dpnp_iface_utils import __all__ as _ifaceutils__all__
7272
from ._version import get_versions
7373
from . import linalg as linalg
74+
from . import scipy as scipy
7475

7576
__all__ = _iface__all__
7677
__all__ += _ifaceutils__all__
7778

7879
# add submodules
79-
__all__ += ["linalg"]
80+
__all__ += ["linalg", "scipy"]
8081

8182

8283
__version__ = get_versions()["version"]

dpnp/dpnp_iface.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
from dpnp.fft import *
5555
from dpnp.memory import *
5656
from dpnp.random import *
57-
from dpnp.special import *
5857

5958
__all__ = [
6059
"are_same_logical_tensors",

dpnp/dpnp_iface_arraycreation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
"""
3939

4040

41+
# pylint: disable=duplicate-code
42+
4143
import operator
4244

4345
import dpctl.tensor as dpt

dpnp/dpnp_iface_manipulation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
"""
3939

4040

41+
# pylint: disable=duplicate-code
42+
4143
import math
4244
import operator
4345
import warnings

0 commit comments

Comments
 (0)