Three code fixes carved out of the docs pass (#449) - #489
Merged
Conversation
Codecov Report❌ Patch coverage is
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
`first(js) > i || @error "..."` only logged the problem and then let the function continue into a contraction that is not the requested correlator, so an unordered (or equal) site pair returned a meaningless number instead of failing. Make it an `ArgumentError`, and document the ordering requirement in the docstring. All three `correlator` signatures funnel their arguments through the range method, so the test covers each of them. Carved out of #449 to keep that PR documentation-only. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`excitations(H::InfiniteMPO, ::QuasiparticleAnsatz, ϕ₀::InfiniteQP, lenvs, renvs)` constructed its effective Hamiltonian as `EffectiveExcitationHamiltonian(H_eff, lenvs, renvs, E)`. `H_eff` is the local being assigned on that very line, so the read hit an uninitialized slot and every call through this method threw `UndefVarError: H_eff not defined in local scope` — the path was dead rather than silently wrong. The momentum entry point is unaffected, since for an `MPO` it converts to a `MultilineMPO` and dispatches to the `MultilineQP` method. The regression test uses the classical Ising transfer matrix rather than the six-vertex model of the neighbouring testset: with the latter the quasiparticle eigenproblem is only loosely converged (the eigenpair residual is ~1e-2 on both entry points), while for the former the two entry points agree to ~1e-11. Carved out of #449 to keep that PR documentation-only. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`Base.isfinite(O::AbstractMPO) = isfinite(typeof(O))` requires every concrete operator type to define the trait, and `WindowMPOHamiltonian` did not, so both `isfinite(H)` and `isfinite(typeof(H))` threw a `MethodError`. A window Hamiltonian acts on a finite number of sites, so the trait is `true`, matching how it otherwise behaves as a finite Hamiltonian; it is spelled and placed like the `FiniteMPO(Hamiltonian)` definitions. Carved out of #449 to keep that PR documentation-only. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Three unrelated code fixes that were buried in the documentation pass of #449, carved out so that PR can stay documentation-only. One commit each, with a test and a changelog entry.
correlatorthrows on unordered sites. Thei < jguard used@error, which only logs and then falls through into the contraction, returning a number that is not the requested correlator. Now anArgumentError. Behaviour change, so### Changed.excitationson anInfiniteMPOwith a quasiparticle input.EffectiveExcitationHamiltonian(H_eff, ...)readH_effon the line assigning it, so the method threwUndefVarErroron every call — a dead path rather than a silently wrong result, so no past computation is suspect. Fixed to passH, which reproduces theMultilineMPOroute exactly.isfiniteforWindowMPOHamiltonian. The trait dispatches on the type and this one was missing, soisfinitethrew aMethodError.Tests for all three pass; the new excitations testset errors against the unfixed source. Full suite not run.
Spotted but not done here:
WindowMPOHamiltonianalso lacksGeometryStyleandOperatorStyle.🤖 Generated with Claude Code