Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
26 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
1319f78
Make compat with 0.9.0
JoeyT1994 Mar 27, 2025
85aeb23
Add TensorOperations to bp test
JoeyT1994 Mar 27, 2025
aa96298
Update src/apply.jl
JoeyT1994 Mar 27, 2025
7eace5b
Use internal ITensorNetworks code for sequence finding
JoeyT1994 Mar 28, 2025
7b1adf0
Dont use itensors.jl for sequence finding callout in apply
JoeyT1994 Mar 28, 2025
aa082fa
Merge branch 'upITensors' of github.com:JoeyT1994/ITensorNetworks.jl …
JoeyT1994 Mar 28, 2025
def2206
Update to remote changes
JoeyT1994 Mar 28, 2025
8cfdb6b
Remove examples
JoeyT1994 Mar 28, 2025
0bfd18d
Formatting
JoeyT1994 Mar 28, 2025
8266278
Bug fix
JoeyT1994 Mar 29, 2025
dc57695
Formatting
JoeyT1994 Mar 29, 2025
0b2426c
Formatting
JoeyT1994 Mar 30, 2025
b978d41
Cast dims to Float64 in contract sequence finding
JoeyT1994 Mar 31, 2025
445a77d
Update TensorOperations
JoeyT1994 Apr 3, 2025
11a37c0
Merge
JoeyT1994 Apr 3, 2025
f7f5fe0
Comment
JoeyT1994 Apr 3, 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: 2 additions & 2 deletions 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.12.0"
version = "0.12.1"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down Expand Up @@ -65,7 +65,7 @@ EinExprs = "0.6.4"
Graphs = "1.8"
GraphsFlows = "0.1.1"
ITensorMPS = "0.3"
ITensors = "0.7, 0.8"
ITensors = "0.7, 0.8, 0.9"
IsApprox = "0.1, 1, 2"
IterTools = "1.4.0"
KrylovKit = "0.6, 0.7, 0.8"
Expand Down
47 changes: 11 additions & 36 deletions src/apply.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ using ITensors:
replaceinds,
unioninds,
uniqueinds
using ITensors.ContractionSequenceOptimization: optimal_contraction_sequence
using ITensorMPS: siteinds
using KrylovKit: linsolve
using LinearAlgebra: eigen, norm, svd
Expand Down Expand Up @@ -407,7 +406,7 @@ function fidelity(
],
envs,
)
term1 = ITensors.contract(term1_tns; sequence=optimal_contraction_sequence(term1_tns))
term1 = ITensors.contract(term1_tns; sequence="automatic")

term2_tns = vcat(
[
Expand All @@ -418,9 +417,9 @@ function fidelity(
],
envs,
)
term2 = ITensors.contract(term2_tns; sequence=optimal_contraction_sequence(term2_tns))
term2 = ITensors.contract(term2_tns; sequence="automatic")
term3_tns = vcat([p_prev, q_prev, prime(dag(p_cur)), prime(dag(q_cur)), gate], envs)
term3 = ITensors.contract(term3_tns; sequence=optimal_contraction_sequence(term3_tns))
term3 = ITensors.contract(term3_tns; sequence="automatic")

f = term3[] / sqrt(term1[] * term2[])
return f * conj(f)
Expand All @@ -447,37 +446,13 @@ function optimise_p_q(
qs_ind = setdiff(inds(q_cur), collect(Iterators.flatten(inds.(vcat(envs, p_cur)))))
ps_ind = setdiff(inds(p_cur), collect(Iterators.flatten(inds.(vcat(envs, q_cur)))))

opt_b_seq = optimal_contraction_sequence(vcat(ITensor[p, q, o, dag(prime(q_cur))], envs))
opt_b_tilde_seq = optimal_contraction_sequence(
vcat(ITensor[p, q, o, dag(prime(p_cur))], envs)
)
opt_M_seq = optimal_contraction_sequence(
vcat(ITensor[q_cur, replaceinds(prime(dag(q_cur)), prime(qs_ind), qs_ind), p_cur], envs)
)
opt_M_tilde_seq = optimal_contraction_sequence(
vcat(ITensor[p_cur, replaceinds(prime(dag(p_cur)), prime(ps_ind), ps_ind), q_cur], envs)
)

function b(
p::ITensor,
q::ITensor,
o::ITensor,
envs::Vector{ITensor},
r::ITensor;
opt_sequence=nothing,
)
function b(p::ITensor, q::ITensor, o::ITensor, envs::Vector{ITensor}, r::ITensor;)
return noprime(
ITensors.contract(vcat(ITensor[p, q, o, dag(prime(r))], envs); sequence=opt_sequence)
ITensors.contract(vcat(ITensor[p, q, o, dag(prime(r))], envs); sequence="automatic")
)
end

function M_p(
envs::Vector{ITensor},
p_q_tensor::ITensor,
s_ind,
apply_tensor::ITensor;
opt_sequence=nothing,
)
function M_p(envs::Vector{ITensor}, p_q_tensor::ITensor, s_ind, apply_tensor::ITensor;)
return noprime(
ITensors.contract(
vcat(
Expand All @@ -488,20 +463,20 @@ function optimise_p_q(
],
envs,
);
sequence=opt_sequence,
sequence="automatic",
),
)
end
for i in 1:nfullupdatesweeps
b_vec = b(p, q, o, envs, q_cur; opt_sequence=opt_b_seq)
M_p_partial = partial(M_p, envs, q_cur, qs_ind; opt_sequence=opt_M_seq)
b_vec = b(p, q, o, envs, q_cur)
M_p_partial = partial(M_p, envs, q_cur, qs_ind)

p_cur, info = linsolve(
M_p_partial, b_vec, p_cur; isposdef=envisposdef, ishermitian=false
)

b_tilde_vec = b(p, q, o, envs, p_cur; opt_sequence=opt_b_tilde_seq)
M_p_tilde_partial = partial(M_p, envs, p_cur, ps_ind; opt_sequence=opt_M_tilde_seq)
b_tilde_vec = b(p, q, o, envs, p_cur)
M_p_tilde_partial = partial(M_p, envs, p_cur, ps_ind)

q_cur, info = linsolve(
M_p_tilde_partial, b_tilde_vec, q_cur; isposdef=envisposdef, ishermitian=false
Expand Down
3 changes: 1 addition & 2 deletions src/caches/abstractbeliefpropagationcache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ using NDTensors: NDTensors
abstract type AbstractBeliefPropagationCache end

function default_message_update(contract_list::Vector{ITensor}; normalize=true, kwargs...)
sequence = optimal_contraction_sequence(contract_list)
updated_messages = contract(contract_list; sequence, kwargs...)
updated_messages = contract(contract_list; sequence="automatic", kwargs...)
message_norm = norm(updated_messages)
if normalize && !iszero(message_norm)
updated_messages /= message_norm
Expand Down
1 change: 1 addition & 0 deletions test/test_gauging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ using ITensors.NDTensors: vector
using LinearAlgebra: diag
using NamedGraphs.NamedGraphGenerators: named_grid
using StableRNGs: StableRNG
using TensorOperations: TensorOperations
using Test: @test, @testset

@testset "gauging" begin
Expand Down
Loading