Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ITensorMPS] Added option for MPO-MPS zipup #1536

Closed
wants to merge 10 commits into from
8 changes: 4 additions & 4 deletions src/lib/ITensorMPS/src/mpo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ end
function ITensors.contract(
::Algorithm"zipup",
A::MPO,
B::MPO;
B::AbstractMPS;
cutoff=1e-14,
maxdim=maxlinkdim(A) * maxlinkdim(B),
mindim=1,
Expand All @@ -836,14 +836,15 @@ function ITensors.contract(
N = length(A)
N != length(B) &&
throw(DimensionMismatch("lengths of MPOs A ($N) and B ($(length(B))) do not match"))
ResultType = typeof(B)
corbett5 marked this conversation as resolved.
Show resolved Hide resolved
# Special case for a single site
N == 1 && return MPO([A[1] * B[1]])
N == 1 && return ResultType([A[1] * B[1]])
corbett5 marked this conversation as resolved.
Show resolved Hide resolved
A = orthogonalize(A, 1)
B = orthogonalize(B, 1)
A = sim(linkinds, A)
sA = siteinds(uniqueinds, A, B)
sB = siteinds(uniqueinds, B, A)
C = MPO(N)
C = ResultType(N)
corbett5 marked this conversation as resolved.
Show resolved Hide resolved
lCᵢ = Index[]
R = ITensor(true)
for i in 1:(N - 2)
Expand Down Expand Up @@ -874,7 +875,6 @@ function ITensors.contract(
mindim,
kwargs...,
)
truncate!(C; kwargs...)
corbett5 marked this conversation as resolved.
Show resolved Hide resolved
return C
end

Expand Down
Loading