Skip to content

get_block(blockindex) should drop an error if blockindex != 0 for non-symmetric tensors #176

@manuschneider

Description

@manuschneider

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions