Skip to content

SciPy sparse array migration from sparse matrices #700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dschult
Copy link

@dschult dschult commented May 15, 2025

As per the SciPy sparray migration guide this is a "pass 1" set of changes.
"Pass 1" essentially makes sure your code is compatible for both sparray and spmatrix. It doesn't actually change any sparse objects to sparray. It only changes usage of * and ** and gets rid of some functions like spdiags.

In this repo, we only need to change one use of ** for matrix power. Once scipy v1.12 is the minimal version we can use scipy.sparse.linalg.matrix_power for matrix power. But this PR uses @ repeatedly instead. It is close to the same speed for large matrices.

This change should also help if/when the code gets moved from using w to graph.

Copy link

codecov bot commented May 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.2%. Comparing base (4037c70) to head (02f8d2c).
Report is 111 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #700     +/-   ##
=======================================
+ Coverage   97.4%   98.2%   +0.8%     
=======================================
  Files         26      40     +14     
  Lines       4328    7166   +2838     
=======================================
+ Hits        4214    7034   +2820     
- Misses       114     132     +18     
Files with missing lines Coverage Δ
momepy/weights.py 98.5% <100.0%> (-1.5%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@martinfleis
Copy link
Member

Thanks. Though the whole function has been deprecated and is marked for a removal in the upcoming release. So while I'm happy to merge this, it will be gone anyway :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants