Skip to content

Commit 4ba8a3d

Browse files
ilan-goldmeeseeksmachine
authored andcommitted
Backport PR scverse#1999: (fix): scipy 1.16rc comparison issue
1 parent 0952258 commit 4ba8a3d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/anndata/_core/merge.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,15 @@ def equal_sparse(a, b) -> bool:
181181
# Comparison broken for CSC matrices
182182
# https://github.com/cupy/cupy/issues/7757
183183
a, b = CupyCSRMatrix(a), CupyCSRMatrix(b)
184+
if Version(scipy.__version__) >= Version("1.16.0rc1"):
185+
# TODO: https://github.com/scipy/scipy/issues/23068
186+
return bool(
187+
a.format == b.format
188+
and (a.shape == b.shape)
189+
and np.all(a.indptr == b.indptr)
190+
and np.all(a.indices == b.indices)
191+
and np.all((a.data == b.data) | (np.isnan(a.data) & np.isnan(b.data)))
192+
)
184193
comp = a != b
185194
if isinstance(comp, bool):
186195
return not comp

0 commit comments

Comments
 (0)