Skip to content

Commit

Permalink
Remove old changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeyT1994 committed Jun 12, 2024
1 parent 50369c1 commit 0e5e5d8
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions src/abstractitensornetwork.jl
Original file line number Diff line number Diff line change
Expand Up @@ -797,23 +797,6 @@ end
is_multi_edge(tn::AbstractITensorNetwork, e) = length(linkinds(tn, e)) > 1
is_multi_edge(tn::AbstractITensorNetwork) = Base.Fix1(is_multi_edge, tn)

function edges_equal(e1s, e2s)
if length(e1s) != length(e2s)
return false
end
for e in e1s
if e e2s && reverse(e) e2s
return false
end
end
return true
end


function edges_equal(tn1::AbstractITensorNetwork, tn2::AbstractITensorNetwork)
return edges_equal(edges(tn1), edges(tn2))
end

"""Add two itensornetworks together by growing the bond dimension. The network structures need to be have the same vertex names, same site index on each vertex """
function ITensorMPS.add(tn1::AbstractITensorNetwork, tn2::AbstractITensorNetwork)
@assert issetequal(vertices(tn1), vertices(tn2))
Expand All @@ -823,14 +806,13 @@ function ITensorMPS.add(tn1::AbstractITensorNetwork, tn2::AbstractITensorNetwork

edges_tn1, edges_tn2 = edges(tn1), edges(tn2)

if !edges_equal(tn1, tn2)
if !issetequal(tn1, tn2)
new_edges = union(edges_tn1, edges_tn2)
tn1 = insert_linkinds(tn1, new_edges)
tn2 = insert_linkinds(tn2, new_edges)
end

edges_tn1, edges_tn2 = edges(tn1), edges(tn2)
@assert edges_equal(tn1, tn2)

tn12 = copy(tn1)
new_edge_indices = Dict(
Expand All @@ -852,7 +834,6 @@ function ITensorMPS.add(tn1::AbstractITensorNetwork, tn2::AbstractITensorNetwork
e1_v = filter(x -> src(x) == v || dst(x) == v, edges_tn1)
e2_v = filter(x -> src(x) == v || dst(x) == v, edges_tn2)

@assert edges_equal(e1_v, e2_v)
tn1v_linkinds = Index[only(linkinds(tn1, e)) for e in e1_v]
tn2v_linkinds = Index[only(linkinds(tn2, e)) for e in e1_v]
tn12v_linkinds = Index[new_edge_indices[e] for e in e1_v]
Expand Down

0 comments on commit 0e5e5d8

Please sign in to comment.