From fbae95bfc3ad2e489735fb21a7a39ade374dca5d Mon Sep 17 00:00:00 2001 From: Boris De Vos Date: Tue, 18 Aug 2026 14:58:53 +0200 Subject: [PATCH 1/2] update AC's stale right leg + test --- src/algorithms/statmech/idmrg.jl | 1 + test/algorithms/groundstate.jl | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/algorithms/statmech/idmrg.jl b/src/algorithms/statmech/idmrg.jl index 8e283dd6e..84edab763 100644 --- a/src/algorithms/statmech/idmrg.jl +++ b/src/algorithms/statmech/idmrg.jl @@ -149,6 +149,7 @@ function leading_boundary( # update the edge ψ.AC[:, end] .= _mul_front.(ψ.C[:, end - 1], ψ.AR[:, end]) + ψ.AC[:, 1] .= _mul_tail.(ψ.AL[:, 1], ψ.C[:, 1]) ψ.AR[:, 1] .= _transpose_front.(ψ.C[:, end] .\ _transpose_tail.(ψ.AC[:, 1])) ac2 = AC2(ψ, 0; kind = :ACAR) h = AC2_hamiltonian(0, ψ, operator, ψ, envs; alg.backend, allocator) diff --git a/test/algorithms/groundstate.jl b/test/algorithms/groundstate.jl index bbb6f12e5..606aa2a3f 100644 --- a/test/algorithms/groundstate.jl +++ b/test/algorithms/groundstate.jl @@ -481,4 +481,15 @@ end @test expectation_value(ψ, mpo, envs) ≈ 2.5337 atol = 1.0e-3 end end + + @testset "IDMRG2 growing bond dimension" begin + Random.seed!(1234) + V = Vect[Z2Irrep](0 => 1, 1 => 1) + O = randn(ComplexF64, V ⊗ V, V ⊗ V) + mpo = InfiniteMPO([O, O]) + P = physicalspace(O) + ψ₀ = InfiniteMPS([P, P], [V, V]) + ψ, envs = leading_boundary(ψ₀, mpo, IDMRG2(; verbosity = 0, maxiter = 1, trunc = truncrank(8))) + @test ψ isa InfiniteMPS + end end From daececdc957cdb0e6a549852017f61ad568fcdb4 Mon Sep 17 00:00:00 2001 From: Boris De Vos Date: Tue, 18 Aug 2026 15:11:35 +0200 Subject: [PATCH 2/2] changelog --- docs/src/changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/changelog.md b/docs/src/changelog.md index 1788564bd..be8bae968 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -96,6 +96,7 @@ When releasing a new version, move the "Unreleased" changes to a new version sec and the right virtual leg of `mpo[end]` and contracted the two — which at length 1 is the *same* tensor, so it returned `O * O` on twice the physical space instead of `O`. ([#484](https://github.com/QuantumKitHub/MPSKit.jl/pull/484)) +- `leading_boundary` with `IDMRG2` didn't update the left edge of the AC tensor, which could result in space mismatches depending on the truncation scheme. This is corrected for in ([#516](https://github.com/QuantumKitHub/MPSKit.jl/pull/516)). ### Performance