Skip to content

Commit 2ca5129

Browse files
authored
Add support for building operators without a link space (#171)
1 parent c87775d commit 2ca5129

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/abstractindsnetwork.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,13 @@ function insert_linkinds(
138138
for e in edges
139139
# TODO: Change to check if it is empty.
140140
if !isassigned(indsnetwork, e)
141-
iₑ = Index(link_space, edge_tag(e))
142-
# TODO: Allow setting with just `Index`.
143-
indsnetwork[e] = [iₑ]
141+
if !isnothing(link_space)
142+
iₑ = Index(link_space, edge_tag(e))
143+
# TODO: Allow setting with just `Index`.
144+
indsnetwork[e] = [iₑ]
145+
else
146+
indsnetwork[e] = []
147+
end
144148
end
145149
end
146150
return indsnetwork

src/formnetworks/bilinearformnetwork.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ function BilinearFormNetwork(
6363
kwargs...,
6464
)
6565
@assert issetequal(flatten_siteinds(bra), flatten_siteinds(ket))
66+
link_space = isempty(flatten_siteinds(bra)) ? 1 : nothing
6667
operator_inds = union_all_inds(siteinds(ket), dual_site_index_map(siteinds(ket)))
6768
# TODO: Define and use `identity_network` here.
68-
O = ITensorNetwork(Op("I"), operator_inds)
69+
O = ITensorNetwork(Op("I"), operator_inds; link_space)
6970
return BilinearFormNetwork(O, bra, ket; dual_site_index_map, kwargs...)
7071
end
7172

src/gauging.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ function Base.copy(ψ::VidalITensorNetwork)
2525
return VidalITensorNetwork(copy(site_tensors(ψ)), copy(bond_tensors(ψ)))
2626
end
2727

28-
function default_norm_cache::ITensorNetwork)
29-
ψψ = norm_sqr_network(ψ)
30-
return BeliefPropagationCache(ψψ, group(v -> first(v), vertices(ψψ)))
31-
end
28+
default_norm_cache::ITensorNetwork) = BeliefPropagationCache(QuadraticFormNetwork(ψ))
3229

3330
function ITensorNetwork(
3431
ψ_vidal::VidalITensorNetwork; (cache!)=nothing, update_gauge=false, update_kwargs...

0 commit comments

Comments
 (0)