bsc-quantic / Tenet.jl

Composable Tensor Network library in Julia
https://bsc-quantic.github.io/Tenet.jl/
Apache License 2.0
17 stars 1 forks source link

Excessive contraction in `Tenet.transform!` with `Tenet.ContractSimplification()` #144

Closed Todorbsc closed 1 month ago

Todorbsc commented 1 month ago

When executing

Tenet.transform!(tn::TensorNetwork, config::ContractSimplification)

with Tenet.ContractSimplification(), the targets are all the indices of the tensor network. Maybe the error is in this line https://github.com/bsc-quantic/Tenet.jl/blob/921b66bda2b8d298cf700e3a19a564813006d8ff/src/Transformations.jl#L147 because of the initialization of the target indices.

The execution in a MN5 interactive node gives:

ERROR: KeyError: key :ݿ not found
Stacktrace:
 [1] getindex
   @ ./dict.jl:498 [inlined]
 [2] tensors
   @ ~/.julia/dev/Tenet/src/TensorNetwork.jl:96 [inlined]
 [3] tensors
   @ ~/.julia/dev/Tenet/src/TensorNetwork.jl:93 [inlined]
 [4] tensors(tn::TensorNetwork; kwargs::@Kwargs{intersects::Vector{Symbol}})
   @ Tenet ~/.julia/dev/Tenet/src/TensorNetwork.jl:81
 [5] tensors
   @ ~/.julia/dev/Tenet/src/TensorNetwork.jl:75 [inlined]
 [6] contract!(tn::TensorNetwork, i::Vector{Symbol})
   @ Tenet ~/.julia/dev/Tenet/src/TensorNetwork.jl:533
 [7] contract!(tn::TensorNetwork, i::Vector{Symbol})
   @ Tenet ~/.julia/dev/Tenet/src/TensorNetwork.jl:543 [inlined]
 [8] transform!(tn::TensorNetwork, config::Tenet.ContractSimplification)
   @ Tenet ~/.julia/dev/Tenet/src/Transformations.jl:153
 [9] top-level scope
   @ REPL[10]:1
mofeing commented 1 month ago

Fixed in dccc6f5cf831ebe3dc7c42ad6e66d7581a3999af