From 3a76f1b0a311adc05b1fc18a58567a9579cf6594 Mon Sep 17 00:00:00 2001 From: AFeuerpfeil Date: Sat, 28 Feb 2026 09:21:53 -0500 Subject: [PATCH 01/11] remove explicit call to InfiniteMPS in VUMPS and IDMRG --- src/algorithms/groundstate/idmrg.jl | 2 +- src/algorithms/groundstate/vumps.jl | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/algorithms/groundstate/idmrg.jl b/src/algorithms/groundstate/idmrg.jl index fab2c96da..913880150 100644 --- a/src/algorithms/groundstate/idmrg.jl +++ b/src/algorithms/groundstate/idmrg.jl @@ -102,7 +102,7 @@ function find_groundstate(mps, operator, alg::alg_type, envs = environments(mps, end alg_gauge = updatetol(alg.alg_gauge, it.state.iter, it.state.ϵ) - ψ′ = InfiniteMPS(it.state.mps.AR[1:end]; alg_gauge.tol, alg_gauge.maxiter) + ψ′ = typeof(mps)(it.state.mps.AR; alg_gauge.tol, alg_gauge.maxiter) envs = recalculate!(it.state.envs, ψ′, it.state.operator, ψ′) return ψ′, envs, it.state.ϵ end diff --git a/src/algorithms/groundstate/vumps.jl b/src/algorithms/groundstate/vumps.jl index 99da8234c..c3d497603 100644 --- a/src/algorithms/groundstate/vumps.jl +++ b/src/algorithms/groundstate/vumps.jl @@ -151,9 +151,11 @@ function _localupdate_vumps_step!( return regauge!(AC, C; alg = alg_orth) end -function gauge_step!(it::IterativeSolver{<:VUMPS}, state, ACs::AbstractVector) +function gauge_step!( + it::IterativeSolver{<:VUMPS,VUMPSState{S}}, state, ACs::AbstractVector + ) where {S} alg_gauge = updatetol(it.alg_gauge, state.iter, state.ϵ) - return InfiniteMPS(ACs, state.mps.C[end]; alg_gauge.tol, alg_gauge.maxiter) + return S(ACs, state.mps.C[end]; alg_gauge.tol, alg_gauge.maxiter) end function gauge_step!(it::IterativeSolver{<:VUMPS}, state, ACs::AbstractMatrix) alg_gauge = updatetol(it.alg_gauge, state.iter, state.ϵ) From 1829e5db16207ab1bb7e2524f153c5c83ffe51d3 Mon Sep 17 00:00:00 2001 From: AFeuerpfeil Date: Sat, 28 Feb 2026 09:26:57 -0500 Subject: [PATCH 02/11] fix formatting --- src/algorithms/groundstate/vumps.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/groundstate/vumps.jl b/src/algorithms/groundstate/vumps.jl index c3d497603..9752f135a 100644 --- a/src/algorithms/groundstate/vumps.jl +++ b/src/algorithms/groundstate/vumps.jl @@ -152,7 +152,7 @@ function _localupdate_vumps_step!( end function gauge_step!( - it::IterativeSolver{<:VUMPS,VUMPSState{S}}, state, ACs::AbstractVector + it::IterativeSolver{<:VUMPS, VUMPSState{S}}, state, ACs::AbstractVector ) where {S} alg_gauge = updatetol(it.alg_gauge, state.iter, state.ϵ) return S(ACs, state.mps.C[end]; alg_gauge.tol, alg_gauge.maxiter) From ed3745ce469cebfeedc0f765097ef98880b9fd76 Mon Sep 17 00:00:00 2001 From: AFeuerpfeil Date: Mon, 2 Mar 2026 06:40:46 -0500 Subject: [PATCH 03/11] revert original change and instead use gaugefix! in the gauging step --- src/algorithms/groundstate/idmrg.jl | 5 ++++- src/algorithms/groundstate/vumps.jl | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/algorithms/groundstate/idmrg.jl b/src/algorithms/groundstate/idmrg.jl index 913880150..01b662b97 100644 --- a/src/algorithms/groundstate/idmrg.jl +++ b/src/algorithms/groundstate/idmrg.jl @@ -102,7 +102,10 @@ function find_groundstate(mps, operator, alg::alg_type, envs = environments(mps, end alg_gauge = updatetol(alg.alg_gauge, it.state.iter, it.state.ϵ) - ψ′ = typeof(mps)(it.state.mps.AR; alg_gauge.tol, alg_gauge.maxiter) + ψ′ = gaugefix!( + similar(it.state.mps), copy(it.state.mps.AR); + tol = alg_gauge.tol, maxiter = alg_gauge.maxiter + ) envs = recalculate!(it.state.envs, ψ′, it.state.operator, ψ′) return ψ′, envs, it.state.ϵ end diff --git a/src/algorithms/groundstate/vumps.jl b/src/algorithms/groundstate/vumps.jl index 9752f135a..68370f520 100644 --- a/src/algorithms/groundstate/vumps.jl +++ b/src/algorithms/groundstate/vumps.jl @@ -151,11 +151,12 @@ function _localupdate_vumps_step!( return regauge!(AC, C; alg = alg_orth) end -function gauge_step!( - it::IterativeSolver{<:VUMPS, VUMPSState{S}}, state, ACs::AbstractVector - ) where {S} +function gauge_step!(it::IterativeSolver{<:VUMPS}, state, ACs::AbstractVector) alg_gauge = updatetol(it.alg_gauge, state.iter, state.ϵ) - return S(ACs, state.mps.C[end]; alg_gauge.tol, alg_gauge.maxiter) + return gaugefix!( + state.mps, ACs, state.mps.C[end]; + alg_gauge.tol, alg_gauge.maxiter + ) end function gauge_step!(it::IterativeSolver{<:VUMPS}, state, ACs::AbstractMatrix) alg_gauge = updatetol(it.alg_gauge, state.iter, state.ϵ) From 5340c31f9d66c4fc310177d598d3dfe924fd06f7 Mon Sep 17 00:00:00 2001 From: AFeuerpfeil Date: Mon, 2 Mar 2026 06:45:03 -0500 Subject: [PATCH 04/11] format --- src/algorithms/groundstate/idmrg.jl | 2 +- src/algorithms/groundstate/vumps.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/groundstate/idmrg.jl b/src/algorithms/groundstate/idmrg.jl index 01b662b97..b62e201e3 100644 --- a/src/algorithms/groundstate/idmrg.jl +++ b/src/algorithms/groundstate/idmrg.jl @@ -103,7 +103,7 @@ function find_groundstate(mps, operator, alg::alg_type, envs = environments(mps, alg_gauge = updatetol(alg.alg_gauge, it.state.iter, it.state.ϵ) ψ′ = gaugefix!( - similar(it.state.mps), copy(it.state.mps.AR); + similar(it.state.mps), copy(it.state.mps.AR); tol = alg_gauge.tol, maxiter = alg_gauge.maxiter ) envs = recalculate!(it.state.envs, ψ′, it.state.operator, ψ′) diff --git a/src/algorithms/groundstate/vumps.jl b/src/algorithms/groundstate/vumps.jl index 68370f520..c4a5fac6a 100644 --- a/src/algorithms/groundstate/vumps.jl +++ b/src/algorithms/groundstate/vumps.jl @@ -154,7 +154,7 @@ end function gauge_step!(it::IterativeSolver{<:VUMPS}, state, ACs::AbstractVector) alg_gauge = updatetol(it.alg_gauge, state.iter, state.ϵ) return gaugefix!( - state.mps, ACs, state.mps.C[end]; + state.mps, ACs, state.mps.C[end]; alg_gauge.tol, alg_gauge.maxiter ) end From 3b44006438b00a43a463577d9658bcb998808cff Mon Sep 17 00:00:00 2001 From: AFeuerpfeil Date: Mon, 2 Mar 2026 07:58:52 -0500 Subject: [PATCH 05/11] copy mps in VUMPSState to avoid modifying the input mps during the iteration --- src/algorithms/groundstate/vumps.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/groundstate/vumps.jl b/src/algorithms/groundstate/vumps.jl index c4a5fac6a..974154cf5 100644 --- a/src/algorithms/groundstate/vumps.jl +++ b/src/algorithms/groundstate/vumps.jl @@ -61,7 +61,7 @@ function dominant_eigsolve( alg_environments = updatetol(alg.alg_environments, iter, ϵ) recalculate!(envs, mps, operator, mps; alg_environments.tol) - state = VUMPSState(mps, operator, envs, iter, ϵ, which) + state = VUMPSState(copy(mps), operator, envs, iter, ϵ, which) it = IterativeSolver(alg, state) return LoggingExtras.withlevel(; alg.verbosity) do From 3f540b6a6e7f1dc6ddc09fa9a0489912522153c9 Mon Sep 17 00:00:00 2001 From: Andreas Feuerpfeil Date: Mon, 2 Mar 2026 08:58:50 -0500 Subject: [PATCH 06/11] copy instead of similar in IDMRG --- src/algorithms/groundstate/idmrg.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/groundstate/idmrg.jl b/src/algorithms/groundstate/idmrg.jl index b62e201e3..5e0e7f78e 100644 --- a/src/algorithms/groundstate/idmrg.jl +++ b/src/algorithms/groundstate/idmrg.jl @@ -103,7 +103,7 @@ function find_groundstate(mps, operator, alg::alg_type, envs = environments(mps, alg_gauge = updatetol(alg.alg_gauge, it.state.iter, it.state.ϵ) ψ′ = gaugefix!( - similar(it.state.mps), copy(it.state.mps.AR); + copy(it.state.mps), copy(it.state.mps.AR); tol = alg_gauge.tol, maxiter = alg_gauge.maxiter ) envs = recalculate!(it.state.envs, ψ′, it.state.operator, ψ′) From b31c40f3d7a6b9ce49ee3c9748d83276db58e2ea Mon Sep 17 00:00:00 2001 From: AFeuerpfeil Date: Mon, 2 Mar 2026 13:12:06 -0500 Subject: [PATCH 07/11] fix vumps --- src/algorithms/groundstate/vumps.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/algorithms/groundstate/vumps.jl b/src/algorithms/groundstate/vumps.jl index 974154cf5..0cc6c5ad4 100644 --- a/src/algorithms/groundstate/vumps.jl +++ b/src/algorithms/groundstate/vumps.jl @@ -57,11 +57,12 @@ function dominant_eigsolve( ) log = IterLog("VUMPS") iter = 0 + mps = copy(mps) ϵ = calc_galerkin(mps, operator, mps, envs) alg_environments = updatetol(alg.alg_environments, iter, ϵ) recalculate!(envs, mps, operator, mps; alg_environments.tol) - state = VUMPSState(copy(mps), operator, envs, iter, ϵ, which) + state = VUMPSState(mps, operator, envs, iter, ϵ, which) it = IterativeSolver(alg, state) return LoggingExtras.withlevel(; alg.verbosity) do From 4440785ecd2f14b058dced019107d5ecc1f65e77 Mon Sep 17 00:00:00 2001 From: AFeuerpfeil Date: Mon, 2 Mar 2026 14:14:46 -0500 Subject: [PATCH 08/11] hopefully fix idmrg bug (no copy needed, as mps is copied at the beginning) --- src/algorithms/groundstate/idmrg.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/groundstate/idmrg.jl b/src/algorithms/groundstate/idmrg.jl index 5e0e7f78e..712fe228e 100644 --- a/src/algorithms/groundstate/idmrg.jl +++ b/src/algorithms/groundstate/idmrg.jl @@ -103,7 +103,7 @@ function find_groundstate(mps, operator, alg::alg_type, envs = environments(mps, alg_gauge = updatetol(alg.alg_gauge, it.state.iter, it.state.ϵ) ψ′ = gaugefix!( - copy(it.state.mps), copy(it.state.mps.AR); + it.state.mps, copy(it.state.mps.AR); tol = alg_gauge.tol, maxiter = alg_gauge.maxiter ) envs = recalculate!(it.state.envs, ψ′, it.state.operator, ψ′) From 1bfac7818dc5d2998c60d017011d83faa98747be Mon Sep 17 00:00:00 2001 From: AFeuerpfeil Date: Tue, 3 Mar 2026 07:19:51 -0500 Subject: [PATCH 09/11] hopefully fix idmrg --- src/algorithms/groundstate/idmrg.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/algorithms/groundstate/idmrg.jl b/src/algorithms/groundstate/idmrg.jl index 712fe228e..265148ae9 100644 --- a/src/algorithms/groundstate/idmrg.jl +++ b/src/algorithms/groundstate/idmrg.jl @@ -102,8 +102,10 @@ function find_groundstate(mps, operator, alg::alg_type, envs = environments(mps, end alg_gauge = updatetol(alg.alg_gauge, it.state.iter, it.state.ϵ) + V = _firstspace(it.state.mps.AR[1]) + C₀ = isomorphism(storagetype(eltype(it.state.mps.AR)), V, V) ψ′ = gaugefix!( - it.state.mps, copy(it.state.mps.AR); + copy(it.state.mps), copy(it.state.mps.AR), C₀; tol = alg_gauge.tol, maxiter = alg_gauge.maxiter ) envs = recalculate!(it.state.envs, ψ′, it.state.operator, ψ′) From cef9c0e7d8cd0e2d305906f9bf7431da78f3641a Mon Sep 17 00:00:00 2001 From: AFeuerpfeil Date: Wed, 4 Mar 2026 11:52:28 -0500 Subject: [PATCH 10/11] format --- src/algorithms/groundstate/idmrg.jl | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/algorithms/groundstate/idmrg.jl b/src/algorithms/groundstate/idmrg.jl index 265148ae9..4b95de042 100644 --- a/src/algorithms/groundstate/idmrg.jl +++ b/src/algorithms/groundstate/idmrg.jl @@ -102,12 +102,7 @@ function find_groundstate(mps, operator, alg::alg_type, envs = environments(mps, end alg_gauge = updatetol(alg.alg_gauge, it.state.iter, it.state.ϵ) - V = _firstspace(it.state.mps.AR[1]) - C₀ = isomorphism(storagetype(eltype(it.state.mps.AR)), V, V) - ψ′ = gaugefix!( - copy(it.state.mps), copy(it.state.mps.AR), C₀; - tol = alg_gauge.tol, maxiter = alg_gauge.maxiter - ) + ψ′ = InfiniteMPS(it.state.mps.AR; alg_gauge.tol, alg_gauge.maxiter) envs = recalculate!(it.state.envs, ψ′, it.state.operator, ψ′) return ψ′, envs, it.state.ϵ end From 548d2d5f4f3c7b02df9eccc80fa6f4a80fcda506 Mon Sep 17 00:00:00 2001 From: lkdvos Date: Fri, 20 Mar 2026 13:42:06 -0400 Subject: [PATCH 11/11] small weird fixes --- src/algorithms/groundstate/vumps.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/algorithms/groundstate/vumps.jl b/src/algorithms/groundstate/vumps.jl index 0cc6c5ad4..47c638db9 100644 --- a/src/algorithms/groundstate/vumps.jl +++ b/src/algorithms/groundstate/vumps.jl @@ -111,7 +111,7 @@ function localupdate_step!( mps = state.mps src_Cs = mps isa Multiline ? eachcol(mps.C) : mps.C src_ACs = mps isa Multiline ? eachcol(mps.AC) : mps.AC - ACs = similar(mps.AC) + ACs = mps.AL dst_ACs = mps isa Multiline ? eachcol(ACs) : ACs tforeach(eachsite(mps), src_ACs, src_Cs; scheduler) do site, AC₀, C₀ @@ -154,10 +154,12 @@ end function gauge_step!(it::IterativeSolver{<:VUMPS}, state, ACs::AbstractVector) alg_gauge = updatetol(it.alg_gauge, state.iter, state.ϵ) - return gaugefix!( + mps = gaugefix!( state.mps, ACs, state.mps.C[end]; - alg_gauge.tol, alg_gauge.maxiter + alg_gauge.tol, alg_gauge.maxiter, order = :R ) + mul!.(mps.AC, mps.AL, mps.C) + return mps end function gauge_step!(it::IterativeSolver{<:VUMPS}, state, ACs::AbstractMatrix) alg_gauge = updatetol(it.alg_gauge, state.iter, state.ϵ)