Skip to content

Commit

Permalink
rename the rest of the MPSMultiline occurences
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorVanthilt committed Dec 16, 2024
1 parent f9b8d4f commit 9606248
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/algorithms/approximate/idmrg.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function approximate(ost::MPSMultiline, toapprox::Tuple{<:MPOMultiline,<:MPSMultiline},
function approximate(ost::MultilineMPS, toapprox::Tuple{<:MPOMultiline,<:MultilineMPS},
alg::IDMRG1, oenvs=environments(ost, toapprox))
ψ = copy(ost)
mpo, above = toapprox
Expand Down Expand Up @@ -52,12 +52,12 @@ function approximate(ost::MPSMultiline, toapprox::Tuple{<:MPOMultiline,<:MPSMult
end
end

nst = MPSMultiline(map(x -> x, ψ.AR); tol=alg.tol_gauge)
nst = MultilineMPS(map(x -> x, ψ.AR); tol=alg.tol_gauge)
nenvs = environments(nst, toapprox)
return nst, nenvs, ϵ
end

function approximate(ost::MPSMultiline, toapprox::Tuple{<:MPOMultiline,<:MPSMultiline},
function approximate(ost::MultilineMPS, toapprox::Tuple{<:MPOMultiline,<:MultilineMPS},
alg::IDMRG2, oenvs=environments(ost, toapprox))
length(ost) < 2 && throw(ArgumentError("unit cell should be >= 2"))
mpo, above = toapprox
Expand Down Expand Up @@ -139,7 +139,7 @@ function approximate(ost::MPSMultiline, toapprox::Tuple{<:MPOMultiline,<:MPSMult
end
end

nst = MPSMultiline(map(x -> x, ψ.AR); tol=alg.tol_gauge)
nst = MultilineMPS(map(x -> x, ψ.AR); tol=alg.tol_gauge)
nenvs = environments(nst, toapprox)
return nst, nenvs, ϵ
end
2 changes: 1 addition & 1 deletion src/algorithms/changebonds/changebonds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function _expand!(ψ::InfiniteMPS, AL′::PeriodicVector, AR′::PeriodicVector)
end
return normalize!(ψ)
end
function _expand!::MPSMultiline, AL′::PeriodicMatrix, AR′::PeriodicMatrix)
function _expand!::MultilineMPS, AL′::PeriodicMatrix, AR′::PeriodicMatrix)
for i in 1:size(ψ, 1)
_expand!(ψ[i], AL′[i, :], AR′[i, :])
end
Expand Down
6 changes: 3 additions & 3 deletions src/algorithms/expval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ function expectation_value(ψ::FiniteQP, mpo::FiniteMPO)
return expectation_value(convert(FiniteMPS, ψ), mpo)
end
function expectation_value::InfiniteMPS, mpo::InfiniteMPO, envs...)
return expectation_value(convert(MPSMultiline, ψ), convert(MPOMultiline, mpo), envs...)
return expectation_value(convert(MultilineMPS, ψ), convert(MPOMultiline, mpo), envs...)
end
function expectation_value::MPSMultiline, O::MPOMultiline{<:Union{DenseMPO,SparseMPO}},
function expectation_value::MultilineMPS, O::MPOMultiline{<:Union{DenseMPO,SparseMPO}},
envs::InfiniteMPOEnvironments=environments(ψ, O))
return prod(product(1:size(ψ, 1), 1:size(ψ, 2))) do (i, j)
GL = leftenv(envs, i, j, ψ)
Expand All @@ -130,7 +130,7 @@ function expectation_value(ψ::MPSMultiline, O::MPOMultiline{<:Union{DenseMPO,Sp
conj.AC[i + 1, j][1 4; 8])
end
end
function expectation_value::MPSMultiline, mpo::MPOMultiline, envs...)
function expectation_value::MultilineMPS, mpo::MPOMultiline, envs...)

Check warning on line 133 in src/algorithms/expval.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/expval.jl#L133

Added line #L133 was not covered by tests
# TODO: fix environments
return prod(x -> expectation_value(x...), zip(parent(ψ), parent(mpo)))
end
Expand Down
14 changes: 7 additions & 7 deletions src/algorithms/grassmann.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ function ManifoldPoint(state::Union{InfiniteMPS,FiniteMPS}, envs)
return ManifoldPoint(state, envs, g, Rhoreg)
end

function ManifoldPoint(state::MPSMultiline, envs)
function ManifoldPoint(state::MultilineMPS, envs)
# FIXME: add support for unitcells
@assert length(state.AL) == 1 "GradientGrassmann only supports MPSMultiline without unitcells for now"
@assert length(state.AL) == 1 "GradientGrassmann only supports MultilineMPS without unitcells for now"

# TODO: this really should not use the operator from the environment
f = expectation_value(state, envs.operator, envs)
Expand Down Expand Up @@ -128,8 +128,8 @@ function fg(x::ManifoldPoint{T}) where {T<:Union{InfiniteMPS,FiniteMPS}}

return real(f), g_prec
end
function fg(x::ManifoldPoint{<:MPSMultiline})
@assert length(x.state) == 1 "GradientGrassmann only supports MPSMultiline without unitcells for now"
function fg(x::ManifoldPoint{<:MultilineMPS})
@assert length(x.state) == 1 "GradientGrassmann only supports MultilineMPS without unitcells for now"
# the gradient I want to return is the preconditioned gradient!
g_prec = map(enumerate(x.g)) do (i, cg)
return PrecGrad(rmul!(copy(cg), x.state.CR[i]'), x.Rhoreg[i])
Expand All @@ -145,9 +145,9 @@ function fg(x::ManifoldPoint{<:MPSMultiline})
end

"""
Retract a left-canonical MPSMultiline along Grassmann tangent `g` by distance `alpha`.
Retract a left-canonical MultilineMPS along Grassmann tangent `g` by distance `alpha`.
"""
function retract(x::ManifoldPoint{<:MPSMultiline}, tg, alpha)
function retract(x::ManifoldPoint{<:MultilineMPS}, tg, alpha)
g = reshape(tg, size(x.state))

nal = similar(x.state.AL)
Expand All @@ -157,7 +157,7 @@ function retract(x::ManifoldPoint{<:MPSMultiline}, tg, alpha)
h[i] = PrecGrad(th)
end

nstate = MPSKit.MPSMultiline(nal, x.state.CR[:, end])
nstate = MPSKit.MultilineMPS(nal, x.state.CR[:, end])
newpoint = ManifoldPoint(nstate, x.envs)

return newpoint, h[:]
Expand Down

0 comments on commit 9606248

Please sign in to comment.