Skip to content

Commit

Permalink
Fix putblock error when dtype not same.
Browse files Browse the repository at this point in the history
  • Loading branch information
hunghaoti committed Oct 25, 2023
1 parent 2765079 commit df12df8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/linalg_test/linalg_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,11 @@ TEST_F(linalg_Test, BkUt_Norm) {
Bond I = Bond(BD_IN, {Qs(-1), Qs(1)}, {3, 3});
Bond J = Bond(BD_OUT, {Qs(-1), Qs(1)}, {3, 3});
UniTensor in = UniTensor({I, J});
in.put_block_(arange3x3cd, 0);
in.put_block_(ones3x3cd, 1);
auto cd_in = in.astype(Type.ComplexDouble);
cd_in.put_block_(arange3x3cd, 0);
cd_in.put_block_(ones3x3cd, 1);
// EXPECT_EQ(cytnx_double(linalg::Norm(in).item().real()), ans);
EXPECT_TRUE(abs(cytnx_double(linalg::Norm(in).item().real()) - ans) <
EXPECT_TRUE(abs(cytnx_double(linalg::Norm(cd_in).item().real()) - ans) <
1e-13); // not sure why some precision lost.
}

Expand Down

0 comments on commit df12df8

Please sign in to comment.