Skip to content

Commit

Permalink
Fix tuple sorting (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanlevy authored Dec 6, 2023
1 parent 853c435 commit c2a2d6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ version = "0.1.0"

[deps]
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6"

[compat]
julia = "1.6"
ITensors = "0.3.18"
julia = "1.6"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
8 changes: 5 additions & 3 deletions src/correlator_bosonic_recursive.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using TupleTools: TupleTools

# correlator(("A", "B", "C", "D"), [(1, 2, 3, 4), (1, 2, 4, 5), ...])
function correlator_recursive_compact(
psi, #::MPS,
Expand Down Expand Up @@ -52,7 +54,7 @@ function add_operator(

if counter == N
R = ((op_ind) < length(psi) ? delta(dag(ln[op_ind]), ln[op_ind]') : ITensor(1.0)) #create right system
C[tuple([element[k] for k in [findall(x -> x == j, indices)[1] for j in sort(indices)]]...)] = inner(
C[tuple([element[k] for k in [findall(x -> x == j, indices)[1] for j in TupleTools.sort(indices)]]...)] = inner(
dag(L), R
)
else
Expand Down Expand Up @@ -105,7 +107,7 @@ function add_operator_repeat(

if counter == N
R = ((op_ind) < length(psi) ? delta(dag(ln[op_ind]), ln[op_ind]') : ITensor(1.0)) #create right system
C[tuple([element[k] for k in [findall(x -> x == j, indices)[1] for j in sort(indices)]]...)] = inner(
C[tuple([element[k] for k in [findall(x -> x == j, indices)[1] for j in TupleTools.sort(indices)]]...)] = inner(
dag(L), R
)
else
Expand Down Expand Up @@ -189,7 +191,7 @@ function add_operator_fermi(

if counter == N
R = ((op_ind) < length(psi) ? delta(dag(ln[op_ind]), ln[op_ind]') : ITensor(1.0)) #create right system
C[tuple([element[k] for k in [findall(x -> x == j, indices)[1] for j in sort(indices)]]...)] = inner(
C[tuple([element[k] for k in [findall(x -> x == j, indices)[1] for j in TupleTools.sort(indices)]]...)] = inner(
dag(L), R
)
#push!(C, tuple([element[k] for k in [findall(x->x==j,indices)[1] for j in sort(indices)]]...) => inner(dag(L), R))
Expand Down

0 comments on commit c2a2d6f

Please sign in to comment.