@@ -586,38 +586,37 @@ function LinearAlgebra.factorize(tn::AbstractITensorNetwork, edge::Pair; kwargs.
586586end
587587
588588# 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...
591591)
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
597603end
598604
599605# For ambiguity error; TODO : decide whether to use graph mutating methods when resulting graph is unchanged?
600606function gauge_walk (
601- alg:: Algorithm"orthogonalize" ,
602- tn:: AbstractITensorNetwork ,
603- edges:: Vector{<:AbstractEdge} ;
604- kwargs... ,
607+ alg:: Algorithm , tn:: AbstractITensorNetwork , edges:: Vector{<:AbstractEdge} ; kwargs...
605608)
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))
610609 tn = copy (tn)
611610 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... )
617612 end
618613 return tn
619614end
620615
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+
621620function gauge_walk (
622621 alg:: Algorithm , tn:: AbstractITensorNetwork , edges:: Vector{<:Pair} ; kwargs...
623622)
0 commit comments