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
Expand Up @@ -26,7 +26,7 @@ Accessors = "0.1"
FLoops = "0.1, 0.2"
FastClosures = "0.3"
FoldsThreads = "0.1"
KrylovKit = "=0.8.1"
KrylovKit = "0.8.3"
LinearAlgebra = "1.6"
LoggingExtras = "1"
OptimKit = "0.3.1"
Expand Down
14 changes: 6 additions & 8 deletions src/algorithms/derivatives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ function ∂AC(x::MPSTensor{S}, opp::Number, leftenv::MPSTensor{S},
end

# mpo multiline
function ∂AC(x::RecursiveVec, opp, leftenv, rightenv)
return RecursiveVec(circshift(map(t -> ∂AC(t...), zip(x.vecs, opp, leftenv, rightenv)),
1))
function ∂AC(x::Vector, opp, leftenv, rightenv)
return circshift(map(t -> ∂AC(t...), zip(x, opp, leftenv, rightenv)), 1)
end

function ∂AC(x::MPSTensor, ::Nothing, leftenv, rightenv)
Expand Down Expand Up @@ -160,9 +159,8 @@ function ∂AC2(x::MPOTensor, ::Nothing, ::Nothing, leftenv, rightenv)
@plansor y[-1 -2; -3 -4] := x[1 -2; 2 -4] * leftenv[-1; 1] * rightenv[2; -3]
end

function ∂AC2(x::RecursiveVec, opp1, opp2, leftenv, rightenv)
return RecursiveVec(circshift(map(t -> ∂AC2(t...),
zip(x.vecs, opp1, opp2, leftenv, rightenv)), 1))
function ∂AC2(x::Vector, opp1, opp2, leftenv, rightenv)
return circshift(map(t -> ∂AC2(t...), zip(x, opp1, opp2, leftenv, rightenv)), 1)
end

"""
Expand Down Expand Up @@ -192,8 +190,8 @@ function ∂C(x::MPSBondTensor, leftenv::MPSBondTensor, rightenv::MPSBondTensor)
@plansor toret[-1; -2] := leftenv[-1; 1] * x[1; 2] * rightenv[2; -2]
end

function ∂C(x::RecursiveVec, leftenv, rightenv)
return RecursiveVec(circshift(map(t -> ∂C(t...), zip(x.vecs, leftenv, rightenv)), 1))
function ∂C(x::Vector, leftenv, rightenv)
return circshift(map(t -> ∂C(t...), zip(x, leftenv, rightenv)), 1)
end

#downproject for approximate
Expand Down
8 changes: 4 additions & 4 deletions src/algorithms/excitation/quasiparticleexcitation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,15 @@ function excitations(H::MPOMultiline, alg::QuasiparticleAnsatz, ϕ₀::Multiline
lenvs, renvs; num=1, solver=Defaults.linearsolver)
qp_envs(ϕ) = environments(ϕ, H, lenvs, renvs; solver)
function H_eff(ϕ′)
ϕ = Multiline(ϕ′.vecs)
return RecursiveVec(effective_excitation_hamiltonian(H, ϕ, qp_envs(ϕ)).data.data)
ϕ = Multiline(ϕ′)
return effective_excitation_hamiltonian(H, ϕ, qp_envs(ϕ)).data.data
end

Es, ϕs, convhist = eigsolve(H_eff, RecursiveVec(ϕ₀.data.data), num, :LM, alg.alg)
Es, ϕs, convhist = eigsolve(H_eff, ϕ₀.data.data, num, :LM, alg.alg)
convhist.converged < num &&
@warn "excitation failed to converge: normres = $(convhist.normres)"

return Es, map(x -> Multiline(x.vecs), ϕs)
return Es, map(Multiline, ϕs)
end

function excitations(H::MPOMultiline, alg::QuasiparticleAnsatz, ϕ₀::Multiline{<:InfiniteQP},
Expand Down
8 changes: 4 additions & 4 deletions src/algorithms/statmech/vomps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,24 @@ function leading_boundary(ψ::MPSMultiline, O::MPOMultiline, alg::VOMPS,
@sync for col in 1:size(ψ, 2)
Threads.@spawn begin
H_AC = ∂∂AC(col, ψ, O, envs)
ac = RecursiveVec(ψ.AC[:, col])
ac = ψ.AC[:, col]
temp_ACs[:, col] .= H_AC(ac)
end

Threads.@spawn begin
H_C = ∂∂C(col, ψ, O, envs)
c = RecursiveVec(ψ.CR[:, col])
c = ψ.CR[:, col]
temp_Cs[:, col] .= H_C(c)
end
end
else
for col in 1:size(ψ, 2)
H_AC = ∂∂AC(col, ψ, O, envs)
ac = RecursiveVec(ψ.AC[:, col])
ac = ψ.AC[:, col]
temp_ACs[:, col] .= H_AC(ac)

H_C = ∂∂C(col, ψ, O, envs)
c = RecursiveVec(ψ.CR[:, col])
c = ψ.CR[:, col]
temp_Cs[:, col] .= H_C(c)
end
end
Expand Down
16 changes: 8 additions & 8 deletions src/algorithms/statmech/vumps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,29 @@ function leading_boundary(ψ::MPSMultiline, H, alg::VUMPS, envs=environments(ψ,
@sync for col in 1:size(ψ, 2)
Threads.@spawn begin
H_AC = ∂∂AC($col, $ψ, $H, $envs)
ac = RecursiveVec($ψ.AC[:, col])
ac = $ψ.AC[:, col]
_, ac′ = fixedpoint(H_AC, ac, :LM, alg_eigsolve)
$temp_ACs[:, col] = ac′.vecs[:]
$temp_ACs[:, col] = ac′[:]
end

Threads.@spawn begin
H_C = ∂∂C($col, $ψ, $H, $envs)
c = RecursiveVec($ψ.CR[:, col])
c = $ψ.CR[:, col]
_, c′ = fixedpoint(H_C, c, :LM, alg_eigsolve)
$temp_Cs[:, col] = c′.vecs[:]
$temp_Cs[:, col] = c′[:]
end
end
else
for col in 1:size(ψ, 2)
H_AC = ∂∂AC(col, ψ, H, envs)
ac = RecursiveVec(ψ.AC[:, col])
ac = ψ.AC[:, col]
_, ac′ = fixedpoint(H_AC, ac, :LM, alg_eigsolve)
temp_ACs[:, col] = ac′.vecs[:]
temp_ACs[:, col] = ac′[:]

H_C = ∂∂C(col, ψ, H, envs)
c = RecursiveVec(ψ.CR[:, col])
c = ψ.CR[:, col]
_, c′ = fixedpoint(H_C, c, :LM, alg_eigsolve)
temp_Cs[:, col] = c′.vecs[:]
temp_Cs[:, col] = c′[:]
end
end

Expand Down
6 changes: 3 additions & 3 deletions src/algorithms/timestep/timeevmpo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ function make_time_mpo(H::MPOHamiltonian{S,T}, dt, alg::WII) where {S,T}
domain(H[i][1, H.odim]))
init = [init_1, zero(H[i][1, k]), zero(H[i][j, H.odim]), zero(H[i][j, k])]

(y, convhist) = exponentiate(1.0, RecursiveVec(init),
(y, convhist) = exponentiate(1.0, init,
Arnoldi(; tol=alg.tol, maxiter=alg.maxiter)) do x
out = similar(x.vecs)
out = similar(x)

@plansor out[1][-1 -2; -3 -4] := δ * x[1][-1 1; -3 -4] *
H[i][1, H.odim][2 3; 1 4] * τ[-2 4; 2 3]
Expand All @@ -186,7 +186,7 @@ function make_time_mpo(H::MPOHamiltonian{S,T}, dt, alg::WII) where {S,T}
@plansor out[4][-1 -2; -3 -4] += sqrt(δ) * x[3][-1 4; -3 3] *
H[i][1, k][2 -2; 1 -4] * τ[3 4; 1 2]

return RecursiveVec(out)
return out
end
convhist.converged == 0 &&
@warn "exponentiate failed to converge: normres = $(convhist.normres)"
Expand Down
8 changes: 0 additions & 8 deletions src/transfermatrix/transfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,6 @@ function transfer_right(v::MPOTensor, O::MPOTensor, A::MPSTensor, Ab::MPSTensor)
@plansor v[-1 -2; -3 -4] := A[-1 4; 5] * O[-2 2; 4 3] * conj(Ab[-4 2; 1]) * v[5 3; -3 1]
end

# --- the following really needs a proper rewrite; probably without transducers
function transfer_left(vec::RecursiveVec, opp, A, Ab)
return RecursiveVec(transfer_left(vec.vecs, opp, A, Ab))
end;
function transfer_right(vec::RecursiveVec, opp, A, Ab)
return RecursiveVec(transfer_right(vec.vecs, opp, A, Ab))
end;

# usual sparsemposlice transfer
function transfer_left(vec::AbstractVector{V}, ham::SparseMPOSlice, A::V,
Ab::V) where {V<:MPSTensor}
Expand Down