@@ -586,38 +586,37 @@ function LinearAlgebra.factorize(tn::AbstractITensorNetwork, edge::Pair; kwargs.
586
586
end
587
587
588
588
# For ambiguity error; TODO : decide whether to use graph mutating methods when resulting graph is unchanged?
589
- function gauge_walk (
590
- alg:: Algorithm , tn:: AbstractITensorNetwork , edge:: AbstractEdge ; kwargs...
589
+ function gauge_edge (
590
+ alg:: Algorithm"orthogonalize" , tn:: AbstractITensorNetwork , edge:: AbstractEdge ; kwargs...
591
591
)
592
- return gauge_walk (tn, [edge]; kwargs... )
593
- end
594
-
595
- function gauge_walk (alg:: Algorithm , tn:: AbstractITensorNetwork , edge:: Pair ; kwargs... )
596
- return gauge_walk (alg:: Algorithm , tn, edgetype (tn)(edge); kwargs... )
592
+ # tn = factorize(tn, edge; kwargs...)
593
+ # # TODO : Implement as `only(common_neighbors(tn, src(edge), dst(edge)))`
594
+ # new_vertex = only(neighbors(tn, src(edge)) ∩ neighbors(tn, dst(edge)))
595
+ # return contract(tn, new_vertex => dst(edge))
596
+ tn = copy (tn)
597
+ left_inds = uniqueinds (tn, edge)
598
+ ltags = tags (tn, edge)
599
+ X, Y = factorize (tn[src (edge)], left_inds; tags= ltags, ortho= " left" , kwargs... )
600
+ tn[src (edge)] = X
601
+ tn[dst (edge)] *= Y
602
+ return tn
597
603
end
598
604
599
605
# For ambiguity error; TODO : decide whether to use graph mutating methods when resulting graph is unchanged?
600
606
function gauge_walk (
601
- alg:: Algorithm"orthogonalize" ,
602
- tn:: AbstractITensorNetwork ,
603
- edges:: Vector{<:AbstractEdge} ;
604
- kwargs... ,
607
+ alg:: Algorithm , tn:: AbstractITensorNetwork , edges:: Vector{<:AbstractEdge} ; kwargs...
605
608
)
606
- # tn = factorize(tn, edge; kwargs...)
607
- # # TODO : Implement as `only(common_neighbors(tn, src(edge), dst(edge)))`
608
- # new_vertex = only(neighbors(tn, src(edge)) ∩ neighbors(tn, dst(edge)))
609
- # return contract(tn, new_vertex => dst(edge))
610
609
tn = copy (tn)
611
610
for edge in edges
612
- left_inds = uniqueinds (tn, edge)
613
- ltags = tags (tn, edge)
614
- X, Y = factorize (tn[src (edge)], left_inds; tags= ltags, ortho= " left" , kwargs... )
615
- tn[src (edge)] = X
616
- tn[dst (edge)] *= Y
611
+ tn = gauge_edge (alg, tn, edge; kwargs... )
617
612
end
618
613
return tn
619
614
end
620
615
616
+ function gauge_walk (alg:: Algorithm , tn:: AbstractITensorNetwork , edge:: Pair ; kwargs... )
617
+ return gauge_edge (alg:: Algorithm , tn, edgetype (tn)(edge); kwargs... )
618
+ end
619
+
621
620
function gauge_walk (
622
621
alg:: Algorithm , tn:: AbstractITensorNetwork , edges:: Vector{<:Pair} ; kwargs...
623
622
)
0 commit comments