get_block(blockindex) should drop an error if blockindex != 0 for non-symmetric tensors
Blocks can be access with get_block(blockindex). This works for symmetric as well as for non-symmetric UniTensors. For the latter, the blockindex is not needed. But it can still be specified and is currently simply ignored. If a blockindex != 0 is given, the user seems to assume a block form, which is wrong.
I would suggest that there is a check: for a UniTensor which is not in block form, blockindex has to be either 0 or omitted. Otherwise there should be an error.
Python Example:
Create an UniTensor from Tensor
T = cytnx.UniTensor(cytnx.ones([3,3])) print(T.get_block(2))
Should produce something like: [ERROR] Trying to access a block with blockindex != 0 on a UniTensor without block form!
This will add overhead to get_block though... Maybe just state clearly in user-guide?
How about implementing the relevant functions get_block(_) in SparseUniTensor and BlockUniTensor only, instead of providing it for all UniTensor? This seems to be a cleaner structure to me, since not all UniTensors have blocks, so functionality concerning blocks should only be provided in the relevant subclasses.
Let's just let it popping error on DenseUT then.