quimb icon indicating copy to clipboard operation
quimb copied to clipboard

TN: index mangling doesn't trigger when inner index matches *outer* index

Open jcmgray opened this issue 6 years ago • 0 comments

In the following, the 'b' index should be mangled on the first TN upon combination:

>>> import quimb.tensor as qtn

>>> qtn.rand_tensor([2, 2], ['a', 'b']) & qtn.rand_tensor([2, 2], ['b', 'c'])
>>> print(tn1 & qtn.rand_tensor([2, 2], ['b', 'c']))
TensorNetwork([
    Tensor(shape=(2, 2), inds=('a', 'b'), tags=set()),
    Tensor(shape=(2, 2), inds=('b', 'c'), tags=set()),
    Tensor(shape=(2, 2), inds=('b', 'c'), tags=set()),
])

This is because it is an inner index and therefore shouldn't be automatically matched up, whereas on the second tensor the 'b' is an outer index so should be preserved.

Possibly mangle all indices apart from when 'virtually' combining?

jcmgray avatar Nov 17 '19 18:11 jcmgray