The behavior of the UniTensor methods bond and bonds seems inconsistent:
bond(idx) returns a copy of the bond
bond_(idx) returns a reference to the bond
bonds() returns references to the bonds
bonds_() does not exist
I was wondering if this is intended, and methods with return type vector always return a shared view. But this seems not generally true, e.g.:
UniTensor::labels() returns references
Tensor::shape() returns references, but
UniTensor::shape() returns cloned values
The shape should never be changed directly by the user anyway. But for methods such as bonds() and labels(), this matters. I would suggest defining the behavior and documenting it.
The behavior of the
UniTensormethodsbondandbondsseems inconsistent:bond(idx)returns a copy of the bondbond_(idx)returns a reference to the bondbonds()returns references to the bondsbonds_()does not existI was wondering if this is intended, and methods with return type vector always return a shared view. But this seems not generally true, e.g.:
UniTensor::labels()returns referencesTensor::shape()returns references, butUniTensor::shape()returns cloned valuesThe shape should never be changed directly by the user anyway. But for methods such as
bonds()andlabels(), this matters. I would suggest defining the behavior and documenting it.