jturney / ambit

C++ library for the implementation of tensor product calculations through a clean, concise user interface.
GNU Lesser General Public License v3.0
21 stars 9 forks source link

Fixed bug when all result indices are batched. #34

Closed tyzhang1993 closed 5 years ago

tyzhang1993 commented 5 years ago

This PR fixed a bug when all the indices of result blocked tensor are batched.

Description

In rare case we want to batch over all indices in result tensor, which was not tested. In the previous implementation, contractions like

C["ijrs"] = batched("srji", 0.5 * A["abrs"] * B["ijab"]);

would generate an exception that the each batch of C tensor does not contain any block. However, each batch should actually be a zero-dimension-tensor with only one element, i.e. scalar. The bug is fixed by creating a zero-dimension Tensor object in BlockedTensor.blocks_.

Status