You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ENH: Plan the scipy.sparse matrix-to-array migration #879
markov/core.py, markov/ddp.py, markov/random.py, _graph_tools.py, and game_theory/localint.py are written against scipy.sparsematrix classes (csr_matrix, coo_matrix). SciPy's announced direction is sparse arrays; the matrix classes — whose semantics rest on np.matrix, itself slated for removal — are on the way out. Our dependence is behavioral, not just nominal: markov/core.py:201 comments that row_sums is np.matrix (ndim=2) and the surrounding reduction code relies on that quirk. And it is user-visible: public APIs accept and return these types (MarkovChain docstrings advertise scipy.sparse.csr_matrix).
Proposed change (staged)
Now: accept both matrix and array inputs everywhere (sp.issparse already covers both); add a test leg that feeds csr_array inputs through MarkovChain / DiscreteDP.
Next minor: convert internals to array semantics (explicit-axis reductions replacing np.matrix-shaped sums — removes the core.py:201 reliance).
Announced release: switch sparse return types to arrays with a changelog notice and, if warranted, a one-release FutureWarning on the affected attributes.
Acceptance criteria
Suite green under sparse-array inputs end-to-end
No internal reliance on np.matrix semantics
Return-type change announced before it ships
From the July 2026 technical-debt audit (AI-assisted; claims verified against 28d4b3b on 2026-07-25).
Activity