Skip to content

Commit

Permalink
Fix Graph checks for the scipy_sparse backend
Browse files Browse the repository at this point in the history
  • Loading branch information
vabor112 committed Oct 25, 2024
1 parent 3b6799e commit 9281d5e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion geometric_kernels/lab_extras/numpy/sparse_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
SparseArray defines a lab data type that covers all possible sparse
scipy arrays, so that multiple dispatch works with such arrays.
"""
if sys.version_info[:2] <= (3, 9):
if sys.version_info[:2] <= (3, 8):
SparseArray = Union[
sp.bsr_matrix,
sp.coo_matrix,
Expand Down
5 changes: 2 additions & 3 deletions geometric_kernels/spaces/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ def _checks(adjacency):
Checks if `adjacency` is a square symmetric matrix.
"""
assert (
len(B.shape(adjacency)) == 2 and adjacency.shape[0] == adjacency.shape[1]
len(adjacency.shape) == 2 and adjacency.shape[0] == adjacency.shape[1]
), "Matrix is not square."

# this is more efficient than (adj == adj.T).all()
assert not B.any(adjacency != B.T(adjacency)), "Adjacency is not symmetric."
assert not B.any(adjacency != B.T(adjacency)), "Adjacency is not symmetric"

@property
def dimension(self) -> int:
Expand Down

0 comments on commit 9281d5e

Please sign in to comment.