Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions changes/902.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Changed internal ``scipy.sparse.*_matrix`` to ``*_array``

This is necessary to further the usage of scipy which
now encourages the use of ``*_array``.

There are some missing features using the array-like
interface, but they should be easy to circumvent
until full compatibility is shipped in scipy.
4 changes: 2 additions & 2 deletions src/sisl/_core/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
tile,
unique,
)
from scipy.sparse import csr_matrix
from scipy.sparse import csr_array

import sisl._array as _a
from sisl._category import Category, GenericCategory
Expand Down Expand Up @@ -4078,7 +4078,7 @@ def sphere_grid_index(grid, center, R):
grid_indices = grid_indices[:i_value]
orbital_indices = orbital_indices[:i_value]

psi_values = csr_matrix(
psi_values = csr_array(
(grid_values, (grid_indices, orbital_indices)),
shape=(np.prod(grid.shape), sp_grid_geom.no_s),
)
Expand Down
8 changes: 5 additions & 3 deletions src/sisl/_core/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import numpy as np
from numpy import add, asarray, cos, dot, floor, int32, ogrid, sin, take
from scipy.ndimage import zoom as ndimage_zoom

# TODO: scipy >= 1.11 use diags_array
from scipy.sparse import SparseEfficiencyWarning
from scipy.sparse import diags as sp_diags

Expand Down Expand Up @@ -1067,7 +1069,7 @@ def pyamg_fix(self, A, b, pyamg_indices, value):

Parameters
----------
A : `~scipy.sparse.csr_matrix`/`~scipy.sparse.csc_matrix`
A : `~scipy.sparse.csr_array`/`~scipy.sparse.csc_matrix`
sparse matrix describing the LHS for the linear system of equations
b : numpy.ndarray
a vector containing RHS of :math:`\mathbf A \mathbf x = \mathbf b` for the solution of the grid stencil
Expand Down Expand Up @@ -1111,7 +1113,7 @@ def pyamg_boundary_condition(self, A, b):

Parameters
----------
A : scipy.sparse.csr_matrix
A : scipy.sparse.csr_array
sparse matrix describing the grid
b : numpy.ndarray
a vector containing RHS of :math:`\mathbf A \mathbf x = \mathbf b` for the solution of the grid stencil
Expand Down Expand Up @@ -1203,7 +1205,7 @@ def topyamg(self, dtype=None):

Returns
-------
scipy.sparse.csr_matrix
scipy.sparse.csr_array
the stencil for the `pyamg` solver
numpy.ndarray
RHS of the linear system of equations
Expand Down
Loading
Loading