Skip to content
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c845947
Blah
JoeyT1994 Sep 13, 2024
90c7251
Merge remote-tracking branch 'origin/main'
JoeyT1994 Oct 17, 2024
86f3087
Merge remote-tracking branch 'upstream/main'
JoeyT1994 Oct 17, 2024
6ff0cd5
Bug fix in current ortho. Change test
JoeyT1994 Oct 17, 2024
34e8e5e
Merge remote-tracking branch 'upstream/main'
JoeyT1994 Nov 22, 2024
d096722
Fix bug
JoeyT1994 Nov 26, 2024
70a3f7e
Merge remote-tracking branch 'upstream/main'
JoeyT1994 Dec 5, 2024
9d64fe8
Merge remote-tracking branch 'upstream/main'
JoeyT1994 Mar 19, 2025
9d6c1bc
File removed
JoeyT1994 Mar 19, 2025
ae17245
Merge remote-tracking branch 'upstream/main'
JoeyT1994 Mar 23, 2025
b648353
Merge remote-tracking branch 'upstream/main'
JoeyT1994 Apr 1, 2025
4e7d189
Merge remote-tracking branch 'upstream/main'
JoeyT1994 Apr 3, 2025
83c92b0
Merge remote-tracking branch 'upstream/main'
JoeyT1994 Apr 7, 2025
6f024ee
Merge remote-tracking branch 'upstream/main'
JoeyT1994 Apr 11, 2025
1106403
Merge remote-tracking branch 'upstream/main'
JoeyT1994 Apr 17, 2025
5641d32
Merge remote-tracking branch 'upstream/main'
JoeyT1994 Apr 30, 2025
59ef115
Merge remote-tracking branch 'upstream/main'
JoeyT1994 May 9, 2025
72bea86
Merge remote-tracking branch 'upstream/main'
JoeyT1994 May 13, 2025
bc14b33
Merge remote-tracking branch 'upstream/main'
JoeyT1994 May 20, 2025
fdd47c8
Merge remote-tracking branch 'upstream/main'
JoeyT1994 May 24, 2025
d8d3e52
Merge remote-tracking branch 'upstream/main'
JoeyT1994 Jul 21, 2025
79b3aa2
Fix bug in delete_messages. Parameter restrictions in apply.jl
JoeyT1994 Jul 21, 2025
04a7ea9
Version bump
JoeyT1994 Jul 21, 2025
adb1293
Update src/apply.jl
JoeyT1994 Jul 21, 2025
29d053e
Apply suggestions from code review
mtfishman Jul 21, 2025
db3af9e
Update Project.toml
JoeyT1994 Jul 21, 2025
8f1d0be
Merge branch 'main' into fixes
mtfishman Jul 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ITensorNetworks"
uuid = "2919e153-833c-4bdc-8836-1ea460a35fc7"
authors = ["Matthew Fishman <[email protected]>, Joseph Tindall <[email protected]> and contributors"]
version = "0.13.12"
version = "0.13.13"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand All @@ -16,6 +16,7 @@ Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
IsApprox = "28f27b66-4bd8-47e7-9110-e2746eb8bed7"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
Expand Down Expand Up @@ -64,6 +65,7 @@ GraphsFlows = "0.1.1"
ITensors = "0.7, 0.8, 0.9"
IsApprox = "0.1, 1, 2"
IterTools = "1.4.0"
JuliaFormatter = "2.1.2"
KrylovKit = "0.6, 0.7, 0.8, 0.9"
MacroTools = "0.5"
NDTensors = "0.3, 0.4"
Expand Down
18 changes: 12 additions & 6 deletions src/apply.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using LinearAlgebra: eigen, norm, svd
using NamedGraphs: NamedEdge, has_edge

function full_update_bp(
o,
o::Union{NamedEdge,ITensor},
ψ,
v⃗;
envs,
Expand Down Expand Up @@ -81,7 +81,9 @@ function full_update_bp(
return ψᵥ₁, ψᵥ₂
end

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

# Reduced version
function simple_update_bp(o, ψ, v⃗; envs, callback=Returns(nothing), apply_kwargs...)
function simple_update_bp(
o::Union{NamedEdge,ITensor}, ψ, v⃗; envs, callback=Returns(nothing), apply_kwargs...
)
cutoff = 10 * eps(real(scalartype(ψ)))
envs_v1 = filter(env -> hascommoninds(env, ψ[v⃗[1]]), envs)
envs_v2 = filter(env -> hascommoninds(env, ψ[v⃗[2]]), envs)
Expand Down Expand Up @@ -186,7 +190,7 @@ function simple_update_bp(o, ψ, v⃗; envs, callback=Returns(nothing), apply_kw
end

function ITensors.apply(
o,
o::Union{NamedEdge,ITensor},
ψ::AbstractITensorNetwork;
envs=ITensor[],
normalize=false,
Expand Down Expand Up @@ -256,7 +260,7 @@ function ITensors.apply(
end

function ITensors.apply(
o⃗::Vector{ITensor},
o⃗::Union{Vector{ITensor},Vector{NamedEdge}},
ψ::AbstractITensorNetwork;
normalize=false,
ortho=false,
Expand Down Expand Up @@ -319,7 +323,9 @@ end
#In the future we will try to unify this into apply() above but currently leave it mostly as a separate function
"""Apply() function for an ITN in the Vidal Gauge. Hence the bond tensors are required.
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"""
function ITensors.apply(o, ψ::VidalITensorNetwork; normalize=false, apply_kwargs...)
function ITensors.apply(
o::Union{NamedEdge,ITensor}, ψ::VidalITensorNetwork; normalize=false, apply_kwargs...
)
updated_ψ = copy(site_tensors(ψ))
updated_bond_tensors = copy(bond_tensors(ψ))
v⃗ = _gate_vertices(o, ψ)
Expand Down
12 changes: 8 additions & 4 deletions src/caches/abstractbeliefpropagationcache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,22 +212,26 @@ function set_message(bpc::AbstractBeliefPropagationCache, pe::PartitionEdge, mes
bpc = copy(bpc)
return set_message!(bpc, pe, message)
end
function delete_messages!(bpc::AbstractBeliefPropagationCache, pes::Vector{<:PartitionEdge})
function delete_messages!(
bpc::AbstractBeliefPropagationCache, pes::Vector{<:PartitionEdge}=keys(messages(bpc))
)
ms = messages(bpc)
for pe in pes
delete!(ms, pe)
end
return bpc
end
function delete_message!(bpc::AbstractBeliefPropagationCache, pe::PartitionEdge)
return delete_message!(bpc, [pe])
return delete_messages!(bpc, [pe])
end
function delete_messages(bpc::AbstractBeliefPropagationCache, pes::Vector{<:PartitionEdge})
function delete_messages(
bpc::AbstractBeliefPropagationCache, pes::Vector{<:PartitionEdge}=keys(messages(bpc))
)
bpc = copy(bpc)
return delete_messages!(bpc, pes)
end
function delete_message(bpc::AbstractBeliefPropagationCache, pe::PartitionEdge)
return delete_message(bpc, [pe])
return delete_messages(bpc, [pe])
end

"""
Expand Down
Loading