Skip to content

Commit 5a257c8

Browse files
committed
Added option for MPO-MPS zipup.
1 parent 9e3efd2 commit 5a257c8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib/ITensorMPS/src/mpo.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ end
822822
function ITensors.contract(
823823
::Algorithm"zipup",
824824
A::MPO,
825-
B::MPO;
825+
B::AbstractMPS;
826826
cutoff=1e-14,
827827
maxdim=maxlinkdim(A) * maxlinkdim(B),
828828
mindim=1,
@@ -836,14 +836,15 @@ function ITensors.contract(
836836
N = length(A)
837837
N != length(B) &&
838838
throw(DimensionMismatch("lengths of MPOs A ($N) and B ($(length(B))) do not match"))
839+
ResultType = typeof(B)
839840
# Special case for a single site
840-
N == 1 && return MPO([A[1] * B[1]])
841+
N == 1 && return ResultType([A[1] * B[1]])
841842
A = orthogonalize(A, 1)
842843
B = orthogonalize(B, 1)
843844
A = sim(linkinds, A)
844845
sA = siteinds(uniqueinds, A, B)
845846
sB = siteinds(uniqueinds, B, A)
846-
C = MPO(N)
847+
C = ResultType(N)
847848
lCᵢ = Index[]
848849
R = ITensor(true)
849850
for i in 1:(N - 2)
@@ -874,7 +875,6 @@ function ITensors.contract(
874875
mindim,
875876
kwargs...,
876877
)
877-
truncate!(C; kwargs...)
878878
return C
879879
end
880880

0 commit comments

Comments
 (0)