Add Smith Normal Form, Jacobian group, and Picard group#31
Open
Copilot wants to merge 3 commits into
Open
Conversation
3 tasks
…near equivalence Agent-Logs-Url: https://github.com/DhyeyMavani2003/chipfiring/sessions/6d06702b-f457-44dc-b70b-9ceb014dccf7 Co-authored-by: DhyeyMavani2003 <82772894+DhyeyMavani2003@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DhyeyMavani2003/chipfiring/sessions/6d06702b-f457-44dc-b70b-9ceb014dccf7 Co-authored-by: DhyeyMavani2003 <82772894+DhyeyMavani2003@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add Smith Normal Form algorithm for linear equivalence
Add Smith Normal Form, Jacobian group, and Picard group
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the three follow-up items from the issue: a Smith Normal Form (SNF) routine, the Jacobian/critical group, the Picard group, and an SNF-based path through
linear_equivalence.Changes
CFSmithNormalForm.py—smith_normal_form(A) -> (D, U, V)withU @ A @ V == D,U/Vunimodular. Pure-integer arithmetic via NumPyobjectdtype (no float / no new deps). Pluselementary_divisors(A)helper.CFPicardJacobian.py—JacobianGroup(graph)andPicardGroup(graph), both built from the SNF of the graph Laplacian.JacobianGroup:order(= number of spanning trees),invariant_factors,structure(),contains(divisor).PicardGroup:free_rank,torsion_order,invariant_factors,structure(),equivalent(d1, d2).free_rankreflects connected-component count;JacobianGroup.orderraises on disconnected graphs.algo.linear_equivalence— newmethodkwarg:"ewd"(default, unchanged) or"smith", the latter dispatching toPicardGroup.equivalentfor a purely algebraic check. Docstring notes that callers running many checks on one graph should reuse aPicardGroupto avoid repeated SNF computation.chipfiring/__init__.py.tests/test_picard_jacobian.py, 31 cases) cover SNF invariants (U A V = D, unimodularity, divisibility chain), known group structures (K₃ →Z/3Z, K₄ →(Z/4Z)², trees → trivial, C₄ →Z/4Z),contains/equivalentmembership, disconnected-graph handling, and EWD-vs-SNF agreement on K₄.Example