Repository navigation
Use comprehensions for dims, dual and flip of SumSpace - #90
Open
KristofferC wants to merge 1 commit into
Open
KristofferC wants to merge 1 commit into
KristofferC wants to merge 1 commit into
Conversation
When the type of a `SumSpace` is not concrete, `map(dual, S.spaces)` maps over a vector with an abstract element type. If such a call is reached from within another `map` call, type inference applies its recursion limit to it. The limited results are not cached, so every function between the two `map` calls is inferred again at every call site (JuliaLang/julia#64862). Comprehensions give the same result and are not limited. First call of `InfiniteMPOHamiltonian([P, P], (1, 2) => h, (2, 3) => h)` from that issue, with MPSKit at 263fe273: | Julia | before | after | |---------------|------------------|------------------| | 1.10.13 | 10.7 s, 4.5 GiB | 9.4 s, 3.5 GiB | | 1.13.3 | 36.0 s, 16.7 GiB | 17.5 s, 7.8 GiB | | 1.14.0-alpha2 | 29.5 s, 16.4 GiB | 14.4 s, 7.8 GiB | Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This was referenced Nov 11, 2026
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
When the type of a
SumSpaceis not concrete,map(dual, S.spaces)maps over a vector with an abstract element type. If that call is reached from within anothermapcall, type inference applies its recursion limit to it, and since limited results are not cached, every function between the twomapcalls is inferred again at every call site. Comprehensions give the same result and are not limited. The analysis is in JuliaLang/julia#64862; QuantumKitHub/MPSKit.jl#554 removes the outermapfor this particular case.First call of
InfiniteMPOHamiltonian([P, P], (1, 2) => h, (2, 3) => h)from that issue, with MPSKitmain:main🤖 Generated with Claude Code