Repository navigation
Improve the performance of cover_transversal - #96
Merged
Merged
Conversation
Replace the policy iteration in _maxbalance, which found one cycle per pass, with the minimum-balance algorithm of Young, Tarjan & Orlin (1991), adapted to maximum cycle means by reversing signs. The algorithm maintains a shortest-path tree for arc lengths λ - w as λ decreases, keeps the non-tree arcs in an indexed heap keyed by the λ at which each becomes tight, and contracts each zero-length cycle in place. Each time an arc becomes tight, the work is proportional to the size of the subtrees whose depths change, so the total is near-linear for most sparse blocks and at most O(nm + n² log n). _howard! and its tie tolerance are removed. The shifts agree with the previous implementation to roundoff. Assisted-by: Claude Fable 5.1 <noreply@anthropic.com> Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
_laplacian_solve! gains rtol and refine keywords. _balanced_direction!
now solves its conjugate-gradient systems to a relative residual of
1e-4 and skips iterative refinement. The Newton direction does not need
to be accurate: every CG iterate started from zero is a descent
direction, and the reduced gradient is recomputed at each step. The
defaults keep the refinement, which the AbsLog{2} minimal-cover solver
needs to certify its KKT conditions.
_balanced_factor! also records the order and number of nonzeros of the
last pattern whose Cholesky factor exceeded the fill or flop budget.
While later patterns stay more than half that size in both, it skips
the CHOLMOD symbolic analysis and goes straight to CG; the fallback
factorization is analyzed only if CG fails.
For cover_transversal(PowerMean{2}(), A; target=1e-2) on a random
sparse 16000×16000 matrix with five entries per row, the run time
drops from 90 s to 11 s.
Assisted-by: Claude Fable 5.1 <noreply@anthropic.com>
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #96 +/- ##
==========================================
- Coverage 98.71% 98.71% -0.01%
==========================================
Files 25 25
Lines 7093 7240 +147
==========================================
+ Hits 7002 7147 +145
- Misses 91 93 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Improves
cover_transversal(ϕ::PowerMean{p}, A; kwargs...)with bothmaxbalance=trueandfalse.