Did I find the right examples for you? yes no

# scipy.sparse.base.isspmatrix

All Samples(10)  |  Call(6)  |  Derive(0)  |  Import(4)

```from scipy.linalg.basic import solve, solve_triangular, inv

from scipy.sparse.base import isspmatrix
from scipy.sparse.construct import eye as speye
from scipy.sparse.linalg import spsolve
```
```def _count_nonzero(A):
# A compatibility function which should eventually disappear.
#XXX There should be a better way to do this when A is sparse
if isspmatrix(A):
```
```def _is_upper_triangular(A):
# This function could possibly be of wider interest.
if isspmatrix(A):
lower_part = scipy.sparse.tril(A, -1)
if lower_part.nnz == 0:
```
```    P = U + V
Q = -U + V
if isspmatrix(U):
return spsolve(Q, P)
elif structure is None:
```

```
from scipy.sparse.csr import csr_matrix
from scipy.sparse.base import isspmatrix

_msg0 = 'x must be a symmetric square matrix!'
```
```        raise ValueError(_msg1 % x.shape)

if isspmatrix(x):
x = x.tocsr()
else:
```

```from scipy.linalg.basic import solve, inv

from scipy.sparse.base import isspmatrix
from scipy.sparse.construct import eye as speye
from scipy.sparse.linalg import spsolve
```
```    """
n_squarings = 0
Aissparse = isspmatrix(A)

if Aissparse:
```

```
from scipy.sparse.csr import csr_matrix
from scipy.sparse.base import isspmatrix

_msg0 = 'x must be a symmetric square matrix!'
```
```        raise ValueError(_msg1 % x.shape)

if isspmatrix(x):
x = x.tocsr()
else:
```