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

"Multiplicity" parameter to unambiguously select `Tensor`s with same indices #68

Closed mofeing closed 8 months ago

mofeing commented 1 year ago

There is a non-solved semantic issue with the refactor and it's that there can be (actually, are) Tensors within a TensorNetwork that are connected by the same indices. This case always appears in the contraction of a closed TN, since the last 2 tensors will forcibly have the same indices.

In other cases, this behavior is more strange but it still can happen.

The way mathematicians have solved it in graph theory is adding a "multiplicity" parameter to the edges. Since a TensorNetwork can represent both the nominal graph of TN and its inverse graph, it is easy mathematically to add a multiplicity paramater on functions that access Tensors.

In Tenet, calling select with "multiplicity" of $i$ should select the tensors that matches all the indices and choose the $i$-th element in the list. But does this function always computes the list in the same order? There should be some order but I'm still undecided about what order should it be.

@bsc-quantic/software @bsc-quantic/tensor-networks I'm invoking you to give your opinion on this.

mofeing commented 8 months ago

Fixed in 5b3e11b47d164d8c9c9475d5784f3afb91c8cdd8