Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MPSKit"
uuid = "bb1c41ca-d63c-52ed-829e-0820dda26502"
authors = "Lukas Devos, Maarten Van Damme and contributors"
version = "0.13.0"
version = "0.13.1"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
7 changes: 3 additions & 4 deletions src/algorithms/approximate/vomps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@
function localupdate_step!(::IterativeSolver{<:VOMPS}, state::VOMPSState{<:Any,<:Tuple},
::SerialScheduler)
alg_orth = QRpos()
eachsite = 1:length(state.mps)

ACs = similar(state.mps.AC)
dst_ACs = state.mps isa Multiline ? eachcol(ACs) : ACs

foreach(eachsite) do site
foreach(eachsite(state.mps)) do site

Check warning on line 65 in src/algorithms/approximate/vomps.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/approximate/vomps.jl#L65

Added line #L65 was not covered by tests
AC = circshift([AC_projection(CartesianIndex(row, site), state.mps, state.operator,
state.envs)
for row in 1:size(state.mps, 1)], 1)
Expand All @@ -78,12 +78,11 @@
function localupdate_step!(::IterativeSolver{<:VOMPS}, state::VOMPSState{<:Any,<:Tuple},
scheduler)
alg_orth = QRpos()
eachsite = 1:length(state.mps)

ACs = similar(state.mps.AC)
dst_ACs = state.mps isa Multiline ? eachcol(ACs) : ACs

tforeach(eachsite; scheduler) do site
tforeach(eachsite(state.mps); scheduler) do site

Check warning on line 85 in src/algorithms/approximate/vomps.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/approximate/vomps.jl#L85

Added line #L85 was not covered by tests
local AC, C
@sync begin
Threads.@spawn begin
Expand Down
3 changes: 1 addition & 2 deletions src/algorithms/groundstate/vumps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,12 @@ function localupdate_step!(it::IterativeSolver{<:VUMPS}, state,
alg_orth = QRpos()

mps = state.mps
eachsite = 1:length(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)
dst_ACs = mps isa Multiline ? eachcol(ACs) : ACs

tforeach(eachsite, src_ACs, src_Cs; scheduler) do site, AC₀, C₀
tforeach(eachsite(mps), src_ACs, src_Cs; scheduler) do site, AC₀, C₀
dst_ACs[site] = _localupdate_vumps_step!(site, mps, state.operator, state.envs,
AC₀, C₀; parallel=false, alg_orth,
state.which, alg_eigsolve)
Expand Down
3 changes: 1 addition & 2 deletions src/algorithms/statmech/vomps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,12 @@
scheduler=Defaults.scheduler[])
alg_orth = QRpos()
mps = state.mps
eachsite = 1:length(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)
dst_ACs = state.mps isa Multiline ? eachcol(ACs) : ACs

tforeach(eachsite, src_ACs, src_Cs; scheduler) do site, AC₀, C₀
tforeach(eachsite(mps), src_ACs, src_Cs; scheduler) do site, AC₀, C₀

Check warning on line 108 in src/algorithms/statmech/vomps.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/statmech/vomps.jl#L108

Added line #L108 was not covered by tests
dst_ACs[site] = _localupdate_vomps_step!(site, mps, state.operator, state.envs,
AC₀, C₀; alg_orth, parallel=false)
return nothing
Expand Down
7 changes: 7 additions & 0 deletions src/states/abstractmps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,10 @@ physicalspace(A::MPSTensor) = space(A, 2)
physicalspace(A::GenericMPSTensor) = prod(x -> space(A, x), 2:(numind(A) - 1))
physicalspace(O::MPOTensor) = space(O, 2)
physicalspace(O::AbstractBlockTensorMap{<:Any,<:Any,2,2}) = only(space(O, 2))

"""
eachsite(state::AbstractMPS)

Return an iterator over the sites of the MPS `state`.
"""
eachsite(ψ::AbstractMPS) = eachindex(ψ)
2 changes: 2 additions & 0 deletions src/utility/multiline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
end
Base.eachindex(m::Multiline) = CartesianIndices(size(m))

eachsite(m::Multiline) = eachsite(first(parent(m)))

Check warning on line 33 in src/utility/multiline.jl

View check run for this annotation

Codecov / codecov/patch

src/utility/multiline.jl#L33

Added line #L33 was not covered by tests

Base.getindex(m::Multiline, i::Int) = getindex(parent(m), i)
Base.setindex!(m::Multiline, v, i::Int) = (setindex!(parent(m), v, i); m)

Expand Down
Loading