1- Base. @deprecate (approximate (ψ:: MultilineMPS , toapprox:: Tuple{<:MultilineMPO,<:MultilineMPS} ,
2- alg:: VUMPS , envs... ; kwargs... ),
3- approximate (ψ, toapprox,
4- VOMPS (; alg. tol, alg. maxiter, alg. finalize,
5- alg. verbosity, alg. alg_gauge, alg. alg_environments),
6- envs... ; kwargs... ))
7-
8- function approximate (mps:: MultilineMPS , toapprox:: Tuple{<:MultilineMPO,<:MultilineMPS} ,
9- alg:: VOMPS , envs= environments (mps, toapprox))
1+ Base. @deprecate (
2+ approximate (
3+ ψ:: MultilineMPS , toapprox:: Tuple{<:MultilineMPO, <:MultilineMPS} , alg:: VUMPS , envs... ;
4+ kwargs...
5+ ),
6+ approximate (
7+ ψ, toapprox,
8+ VOMPS (; alg. tol, alg. maxiter, alg. finalize, alg. verbosity, alg. alg_gauge, alg. alg_environments),
9+ envs... ; kwargs...
10+ )
11+ )
12+
13+ function approximate (
14+ mps:: MultilineMPS , toapprox:: Tuple{<:MultilineMPO, <:MultilineMPS} , alg:: VOMPS ,
15+ envs = environments (mps, toapprox)
16+ )
1017 log = IterLog (" VOMPS" )
1118 iter = 0
1219 ϵ = calc_galerkin (mps, toapprox... , envs)
3845
3946# need to specialize a bunch of functions because different arguments are passed with tuples
4047# TODO : can we avoid this?
41- function Base. iterate (it:: IterativeSolver{<:VOMPS} , state:: VOMPSState{<:Any,<:Tuple} )
48+ function Base. iterate (it:: IterativeSolver{<:VOMPS} , state:: VOMPSState{<:Any, <:Tuple} )
4249 ACs = localupdate_step! (it, state)
4350 mps = gauge_step! (it, state, ACs)
4451 envs = envs_step! (it, state, mps)
@@ -55,28 +62,32 @@ function Base.iterate(it::IterativeSolver{<:VOMPS}, state::VOMPSState{<:Any,<:Tu
5562 return (mps, envs, ϵ), it. state
5663end
5764
58- function localupdate_step! (:: IterativeSolver{<:VOMPS} , state:: VOMPSState{<:Any,<:Tuple} ,
59- :: SerialScheduler )
65+ function localupdate_step! (
66+ :: IterativeSolver{<:VOMPS} , state:: VOMPSState{<:Any, <:Tuple} , :: SerialScheduler
67+ )
6068 alg_orth = QRpos ()
6169
6270 ACs = similar (state. mps. AC)
6371 dst_ACs = state. mps isa Multiline ? eachcol (ACs) : ACs
6472
6573 foreach (eachsite (state. mps)) do site
66- AC = circshift ([AC_projection (CartesianIndex (row, site), state. mps, state. operator,
67- state. envs)
68- for row in 1 : size (state. mps, 1 )], 1 )
69- C = circshift ([C_projection (CartesianIndex (row, site), state. mps, state. operator,
70- state. envs)
71- for row in 1 : size (state. mps, 1 )], 1 )
72- dst_ACs[site] = regauge! (AC, C; alg= alg_orth)
74+ AC = map (1 : size (state. mps, 1 )) do row
75+ AC_projection (CartesianIndex (row, site), state. mps, state. operator, state. envs)
76+ end
77+ circshift! (AC, 1 )
78+ C = map (1 : size (state. mps, 1 )) do row
79+ C_projection (CartesianIndex (row, site), state. mps, state. operator, state. envs)
80+ end
81+ circshift! (C, 1 )
82+ dst_ACs[site] = regauge! (AC, C; alg = alg_orth)
7383 return nothing
7484 end
7585
7686 return ACs
7787end
78- function localupdate_step! (:: IterativeSolver{<:VOMPS} , state:: VOMPSState{<:Any,<:Tuple} ,
79- scheduler)
88+ function localupdate_step! (
89+ :: IterativeSolver{<:VOMPS} , state:: VOMPSState{<:Any, <:Tuple} , scheduler
90+ )
8091 alg_orth = QRpos ()
8192
8293 ACs = similar (state. mps. AC)
@@ -86,24 +97,26 @@ function localupdate_step!(::IterativeSolver{<:VOMPS}, state::VOMPSState{<:Any,<
8697 local AC, C
8798 @sync begin
8899 Threads. @spawn begin
89- AC = circshift ([AC_projection (CartesianIndex (row, site), state. mps,
90- state. operator, state. envs)
91- for row in 1 : size (state. mps, 1 )], 1 )
100+ AC = map (1 : size (state. mps, 1 )) do row
101+ AC_projection (CartesianIndex (row, site), state. mps, state. operator, state. envs)
102+ end
103+ circshift! (AC, 1 )
92104 end
93105 Threads. @spawn begin
94- C = circshift ([C_projection (CartesianIndex (row, site), state. mps,
95- state. operator, state. envs)
96- for row in 1 : size (state. mps, 1 )], 1 )
106+ C = map (1 : size (state. mps, 1 )) do row
107+ C_projection (CartesianIndex (row, site), state. mps, state. operator, state. envs)
108+ end
109+ circshift! (C, 1 )
97110 end
98111 end
99- dst_ACs[site] = regauge! (AC, C; alg= alg_orth)
112+ dst_ACs[site] = regauge! (AC, C; alg = alg_orth)
100113 return nothing
101114 end
102115
103116 return ACs
104117end
105118
106- function envs_step! (it:: IterativeSolver{<:VOMPS} , state:: VOMPSState{<:Any,<:Tuple} , mps)
119+ function envs_step! (it:: IterativeSolver{<:VOMPS} , state:: VOMPSState{<:Any, <:Tuple} , mps)
107120 alg_environments = updatetol (it. alg_environments, state. iter, state. ϵ)
108121 return recalculate! (state. envs, mps, state. operator... ; alg_environments. tol)
109122end
0 commit comments