Skip to content

Max-balance dense blocks with an adjacency-matrix tree - #97

Merged
timholy merged 1 commit into
mainfrom
teh/dense-maxbal
Oct 25, 2026
Merged

timholy merged 1 commit into
mainfrom
teh/dense-maxbal

Conversation

@timholy

@timholy timholy commented Oct 25, 2026

Copy link
Copy Markdown
Member

_maxbalance holds a block with more than n²/8 arcs in a DenseParametricTree: two n×n weight matrices with parallel arcs merged into the heaviest, and an indexed heap over nodes keyed by the best candidate arc entering each, rescanned lazily when a key may have fallen. A node whose depth changes then costs one pass over the live nodes instead of a heap update for each incident arc on a heap of n² entries. Sparser blocks keep the arc-list ParametricTree; the keyword dense selects the representation explicitly. The initial tree and the summation of the contraction chains are shared.

On dense random lognormal matrices, cover_transversal(PowerMean{2}(), A; maxbalance=true) takes 0.8 s at n = 1600 and 20 s at n = 6400, and the shifts agree with the arc-list path to roundoff.

Assisted-by: Claude Opus 5.5 and Claude Fable 5.1 noreply@anthropic.com

`_maxbalance` holds a block with more than `n²/8` arcs in a
`DenseParametricTree`: two `n×n` weight matrices with parallel arcs
merged into the heaviest, and an indexed heap over nodes keyed by the
best candidate arc entering each, rescanned lazily when a key may
have fallen. A node whose depth changes then costs one pass over the
live nodes instead of a heap update for each incident arc on a heap
of `n²` entries. Sparser blocks keep the arc-list `ParametricTree`;
the keyword `dense` selects the representation explicitly. The
initial tree and the summation of the contraction chains are shared.

On dense random lognormal matrices, `cover_transversal(PowerMean{2}(),
A; maxbalance=true)` takes 0.8 s at n = 1600 and 20 s at n = 6400,
and the shifts agree with the arc-list path to roundoff.

Assisted-by: Claude Opus 5.5 and Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.74%. Comparing base (b8c4ec4) to head (50595d5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #97      +/-   ##
==========================================
+ Coverage   98.71%   98.74%   +0.02%     
==========================================
  Files          25       25              
  Lines        7240     7406     +166     
==========================================
+ Hits         7147     7313     +166     
  Misses         93       93              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@timholy
timholy merged commit 8d65af1 into main Oct 25, 2026
7 checks passed
@timholy
timholy deleted the teh/dense-maxbal branch October 25, 2026 08:27
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