Skip to content

refactor: transfer_spectrum and correlation_length default to sector-centered implementation#452

Merged
lkdvos merged 9 commits into
mainfrom
ld-transfer
Jul 10, 2026
Merged

refactor: transfer_spectrum and correlation_length default to sector-centered implementation#452
lkdvos merged 9 commits into
mainfrom
ld-transfer

Conversation

@lkdvos

@lkdvos lkdvos commented Jul 6, 2026

Copy link
Copy Markdown
Member

This PR refactors the transfer_spectrum function to be more in line with the entanglement_spectrum function, and return a SectorVector for the different sectors that may appear.
This also gives us the opportunity to actually compute the correlation length in the dominant sector, rather than defaulting to the trivial sector instead, which is something that had surfaced before: See also QuantumKitHub/PEPSKit.jl#216

Something else that had been bothering me for a long time is that the krylov dimension is selected once up front, and then never changed, so it really required quite a bit of manual scripting to actually get a reasonable set of transfer values for all different sectors.
Here i've introduced oversampling and oversampling_factor as ways to set the krylov dimension from the requested values instead, which might be a bit more ergonomic?

Finally, this is in preparation of improving the plotting functionality, see also #428, which I'd like to give similar interfaces so it might be useful to think about this a bit.

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.07692% with 21 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/algorithms/transfer_spectrum.jl 72.85% 19 Missing ⚠️
src/utility/plotting.jl 75.00% 2 Missing ⚠️
Files with missing lines Coverage Δ
src/MPSKit.jl 100.00% <ø> (ø)
src/algorithms/toolbox.jl 97.86% <ø> (+1.46%) ⬆️
src/utility/plotting.jl 82.60% <75.00%> (-2.24%) ⬇️
src/algorithms/transfer_spectrum.jl 72.85% <72.85%> (ø)

... and 2 files with indirect coverage changes

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

@lkdvos
lkdvos marked this pull request as ready for review July 6, 2026 23:12
Comment thread docs/src/examples/classic2d/1.hard-hexagon/index.md
@lkdvos
lkdvos requested a review from borisdevos July 7, 2026 17:14

@borisdevos borisdevos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments, but looks good to me!

Comment thread src/algorithms/transfer_spectrum.jl Outdated
Comment thread src/algorithms/transfer_spectrum.jl

@leburgel leburgel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor comments, but looks good to me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems to have changed quite drastically, was this expected?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is the non-injective one so it is more or less numerical noise, the main point is that the dominant value is degenerate, which unfortunately was more visible on the previous plot because it accidentally got wrapped around the branch cut, but I don't really feel like playing whack-a-mole with the RNG...

Comment thread examples/classic2d/1.hard-hexagon/main.jl Outdated
Comment thread examples/classic2d/1.hard-hexagon/main.jl Outdated
Comment thread examples/classic2d/1.hard-hexagon/main.jl Outdated
Comment thread src/algorithms/transfer_spectrum.jl Outdated
Comment thread src/algorithms/transfer_spectrum.jl Outdated
Comment thread src/algorithms/transfer_spectrum.jl Outdated
Comment thread src/algorithms/transfer_spectrum.jl Outdated
@lkdvos
lkdvos enabled auto-merge (squash) July 9, 2026 22:30
@lkdvos
lkdvos disabled auto-merge July 10, 2026 00:51
@lkdvos
lkdvos merged commit 3433e60 into main Jul 10, 2026
28 of 29 checks passed
@lkdvos
lkdvos deleted the ld-transfer branch July 10, 2026 00:51
lkdvos added a commit that referenced this pull request Jul 11, 2026
After rebasing onto main (#452, sector-centered transfer spectrum):
- transfer_spectrum keyword `num_vals` was renamed to `howmany`
- correlation_length now returns a per-sector `SectorDict`; take the largest
  entry (`maximum(values(...))`) to recover the scalar correlation length the
  prose describes

Fixes the two @example blocks (convergence_troubleshooting, statmech) that used
the pre-#452 API. Full Documenter build is green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

3 participants