Skip to content

Commit 9dc9117

Browse files
Merge branch 'main' into fermion_map_eigvals
2 parents 6fa2bc6 + c4eecb0 commit 9dc9117

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ITensorNetworks"
22
uuid = "2919e153-833c-4bdc-8836-1ea460a35fc7"
33
authors = ["Matthew Fishman <[email protected]>, Joseph Tindall <[email protected]> and contributors"]
4-
version = "0.13.13"
4+
version = "0.13.16"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
@@ -68,7 +68,7 @@ KrylovKit = "0.6, 0.7, 0.8, 0.9"
6868
MacroTools = "0.5"
6969
NDTensors = "0.3, 0.4"
7070
NamedGraphs = "0.6.0"
71-
OMEinsumContractionOrders = "0.8.3, 0.9"
71+
OMEinsumContractionOrders = "0.8.3, 0.9, 1"
7272
Observers = "0.2.4"
7373
SerializedElementArrays = "0.1"
7474
SimpleTraits = "0.9"

src/apply.jl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ using LinearAlgebra: eigen, norm, svd
2727
using NamedGraphs: NamedEdge, has_edge
2828

2929
function full_update_bp(
30-
o,
30+
o::Union{NamedEdge,ITensor},
3131
ψ,
3232
v⃗;
3333
envs,
@@ -81,7 +81,9 @@ function full_update_bp(
8181
return ψᵥ₁, ψᵥ₂
8282
end
8383

84-
function simple_update_bp_full(o, ψ, v⃗; envs, callback=Returns(nothing), apply_kwargs...)
84+
function simple_update_bp_full(
85+
o::Union{NamedEdge,ITensor}, ψ, v⃗; envs, callback=Returns(nothing), apply_kwargs...
86+
)
8587
cutoff = 10 * eps(real(scalartype(ψ)))
8688
envs_v1 = filter(env -> hascommoninds(env, ψ[v⃗[1]]), envs)
8789
envs_v2 = filter(env -> hascommoninds(env, ψ[v⃗[2]]), envs)
@@ -133,7 +135,9 @@ function simple_update_bp_full(o, ψ, v⃗; envs, callback=Returns(nothing), app
133135
end
134136

135137
# Reduced version
136-
function simple_update_bp(o, ψ, v⃗; envs, callback=Returns(nothing), apply_kwargs...)
138+
function simple_update_bp(
139+
o::Union{NamedEdge,ITensor}, ψ, v⃗; envs, callback=Returns(nothing), apply_kwargs...
140+
)
137141
cutoff = 10 * eps(real(scalartype(ψ)))
138142
envs_v1 = filter(env -> hascommoninds(env, ψ[v⃗[1]]), envs)
139143
envs_v2 = filter(env -> hascommoninds(env, ψ[v⃗[2]]), envs)
@@ -186,7 +190,7 @@ function simple_update_bp(o, ψ, v⃗; envs, callback=Returns(nothing), apply_kw
186190
end
187191

188192
function ITensors.apply(
189-
o,
193+
o::Union{NamedEdge,ITensor},
190194
ψ::AbstractITensorNetwork;
191195
envs=ITensor[],
192196
normalize=false,
@@ -256,7 +260,7 @@ function ITensors.apply(
256260
end
257261

258262
function ITensors.apply(
259-
o⃗::Vector{ITensor},
263+
o⃗::Union{Vector{NamedEdge},Vector{ITensor}},
260264
ψ::AbstractITensorNetwork;
261265
normalize=false,
262266
ortho=false,
@@ -319,7 +323,9 @@ end
319323
#In the future we will try to unify this into apply() above but currently leave it mostly as a separate function
320324
"""Apply() function for an ITN in the Vidal Gauge. Hence the bond tensors are required.
321325
Gate does not necessarily need to be passed. Can supply an edge to do an identity update instead. Uses Simple Update procedure assuming gate is two-site"""
322-
function ITensors.apply(o, ψ::VidalITensorNetwork; normalize=false, apply_kwargs...)
326+
function ITensors.apply(
327+
o::Union{NamedEdge,ITensor}, ψ::VidalITensorNetwork; normalize=false, apply_kwargs...
328+
)
323329
updated_ψ = copy(site_tensors(ψ))
324330
updated_bond_tensors = copy(bond_tensors(ψ))
325331
v⃗ = _gate_vertices(o, ψ)

src/caches/abstractbeliefpropagationcache.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,22 +212,26 @@ function set_message(bpc::AbstractBeliefPropagationCache, pe::PartitionEdge, mes
212212
bpc = copy(bpc)
213213
return set_message!(bpc, pe, message)
214214
end
215-
function delete_messages!(bpc::AbstractBeliefPropagationCache, pes::Vector{<:PartitionEdge})
215+
function delete_messages!(
216+
bpc::AbstractBeliefPropagationCache, pes::Vector{<:PartitionEdge}=keys(messages(bpc))
217+
)
216218
ms = messages(bpc)
217219
for pe in pes
218220
delete!(ms, pe)
219221
end
220222
return bpc
221223
end
222224
function delete_message!(bpc::AbstractBeliefPropagationCache, pe::PartitionEdge)
223-
return delete_message!(bpc, [pe])
225+
return delete_messages!(bpc, [pe])
224226
end
225-
function delete_messages(bpc::AbstractBeliefPropagationCache, pes::Vector{<:PartitionEdge})
227+
function delete_messages(
228+
bpc::AbstractBeliefPropagationCache, pes::Vector{<:PartitionEdge}=keys(messages(bpc))
229+
)
226230
bpc = copy(bpc)
227231
return delete_messages!(bpc, pes)
228232
end
229233
function delete_message(bpc::AbstractBeliefPropagationCache, pe::PartitionEdge)
230-
return delete_message(bpc, [pe])
234+
return delete_messages(bpc, [pe])
231235
end
232236

233237
"""

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ LinearAlgebra = "1.10.0"
5151
Metis = "1.5.0"
5252
NDTensors = "0.3, 0.4"
5353
NamedGraphs = "0.6.6"
54-
OMEinsumContractionOrders = "0.9.5"
54+
OMEinsumContractionOrders = "0.9.5, 1"
5555
Observers = "0.2.5"
5656
OrdinaryDiffEqTsit5 = "1.1.0"
5757
Pkg = "1.10.0"

0 commit comments

Comments
 (0)