Skip to content

Commit a29e8de

Browse files
dschultdschmitz89
authored andcommitted
DOC: sparse.linalg: add two recent functions to namespace and fix doctests (scipy#22374)
* fix doctests and make two recent functions visible * update refguide [docs only] * fix capitalization [docs only] Co-authored-by: Daniel Schmitz <40656107+dschmitz89@users.noreply.github.com> --------- Co-authored-by: Daniel Schmitz <40656107+dschmitz89@users.noreply.github.com>
1 parent 5f2d99e commit a29e8de

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

scipy/sparse/linalg/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
4444
spsolve -- Solve the sparse linear system Ax=b
4545
spsolve_triangular -- Solve sparse linear system Ax=b for a triangular A.
46+
is_sptriangular -- Check if sparse A is triangular.
47+
spbandwidth -- Find the bandwidth of a sparse matrix.
4648
factorized -- Pre-factorize matrix to a function solving a linear system
4749
MatrixRankWarning -- Warning on exactly singular matrices
4850
use_solver -- Select direct solver to use

scipy/sparse/linalg/_dsolve/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262

6363
__all__ = [
6464
'MatrixRankWarning', 'SuperLU', 'factorized',
65-
'spilu', 'splu', 'spsolve',
66-
'spsolve_triangular', 'use_solver'
65+
'spilu', 'splu', 'spsolve', 'is_sptriangular',
66+
'spsolve_triangular', 'use_solver', 'spbandwidth',
6767
]
6868

6969
from scipy._lib._testutils import PytestTester

scipy/sparse/linalg/_dsolve/linsolve.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -768,11 +768,12 @@ def is_sptriangular(A):
768768
--------
769769
>>> import numpy as np
770770
>>> from scipy.sparse import csc_array, eye_array
771+
>>> from scipy.sparse.linalg import is_sptriangular
771772
>>> A = csc_array([[3, 0, 0], [1, -1, 0], [2, 0, 1]], dtype=float)
772-
>>> scipy.sparse.linalg.is_sptriangular(A)
773+
>>> is_sptriangular(A)
773774
(True, False)
774-
>>> D = eye_array((3,3), format='csr')
775-
>>> scipy.sparse.linalg.is_sptriangular(D)
775+
>>> D = eye_array(3, format='csr')
776+
>>> is_sptriangular(D)
776777
(True, True)
777778
"""
778779
if not (issparse(A) and A.format in ("csc", "csr", "coo", "dia", "dok", "lil")):
@@ -841,12 +842,13 @@ def spbandwidth(A):
841842
Examples
842843
--------
843844
>>> import numpy as np
845+
>>> from scipy.sparse.linalg import spbandwidth
844846
>>> from scipy.sparse import csc_array, eye_array
845847
>>> A = csc_array([[3, 0, 0], [1, -1, 0], [2, 0, 1]], dtype=float)
846-
>>> scipy.sparse.linalg.spbandwidth(A)
848+
>>> spbandwidth(A)
847849
(2, 0)
848-
>>> D = eye_array((3,3), format='csr')
849-
>>> scipy.sparse.linalg.spbandwidth(D)
850+
>>> D = eye_array(3, format='csr')
851+
>>> spbandwidth(D)
850852
(0, 0)
851853
"""
852854
if not (issparse(A) and A.format in ("csc", "csr", "coo", "dia", "dok")):

0 commit comments

Comments
 (0)