Skip to content

Suspicious check in UniTensor::put_block() #501

@ianmccul

Description

@ianmccul

This code is very suspicious:

Cytnx/include/UniTensor.hpp

Lines 1497 to 1505 in fa4596e

if (b < 0) {
if (check) {
cytnx_error_msg(true,
"[ERROR][put_block][BlockUniTensor] no avaliable block exists, "
"check=true, so error throws. \n If you want without error when block "
"is not avaliable, set check=false.%s",
"\n");
}
} else {

This is replacing a block of a UniTensor, but if the caller specifies check = false then it silently ignores the error if the block to replace doesn't exist. What is the use case for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions