Skip to content

NetlistCircuit update following Elecsolver and SparseLinearDAE transition to csc,csr & coo array - #10

Draft
Pimss wants to merge 4 commits into
pathsim:mainfrom
Pimss:main
Draft

Pimss wants to merge 4 commits into
pathsim:mainfrom
Pimss:main

Conversation

@Pimss

@Pimss Pimss commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Follows pathsim-rf issue #9. SparseLinearDAE (dae.py) is moved from csc_matrix/csr_matrix to csc_array/csr_array in a draft PR, since the sparse matrix classes are expected to be deprecated in SciPy. Elecsolver also has performed this transition. NetlistCircuit needed to be updated accordingly.

This PR is a draft because csc_matrix, csr_matrix and coo_matrix are not deprecated yet.

Changes

  • pyproject.toml: raise the minimum to scipy>=1.8, the first release with the csc/csr/coo array classes.
  • circuit.py (NetlistCircuit):
    • _source_matrix builds the source columns with csc_array and returns a csr_array.
    • The output matrices C and D are built as csr_array.
    • Update the docstring.
  • netlist_to_statespace.py: _solve_with_scipy factorizes a csc_array instead of a csc_matrix.
  • tests/test_circuit.py: add test_system_matrices_are_sparse_arrays, which checks that the system matrices of a NetlistCircuit (S1, S2, B, C, D, _P, _S2r) are sparse arrays.

Test plan

  • pytest passes, including the NetlistCircuit and netlist-to-statespace tests
  • New code is covered by tests under tests/
======================= 85 passed, 1 skipped in 10.26s ========================

@Pimss

Pimss commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

I believe those tests failling are linked to PR 306 not been merge as current release still uses matrix for sparse array rather than their array counterpart.

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.

1 participant