Skip to content

Commit

Permalink
Account for possible rounding error in beta-scaling with complex arit…
Browse files Browse the repository at this point in the history
…hmetic. Fixes #30.
  • Loading branch information
devinamatthews committed Jun 8, 2020
1 parent 5ccacba commit 3e4c4b8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
8 changes: 4 additions & 4 deletions test/3t/contract.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ REPLICATED_TEMPLATED_TEST_CASE(contract, R, T, all_types)
TENSOR_INFO(C);

auto idx_AB = intersection(idx_A, idx_B);
auto neps = prod(select_from(A.lengths(), idx_A, idx_AB))*prod(C.lengths());
auto neps = (prod(select_from(A.lengths(), idx_A, idx_AB))+1)*prod(C.lengths());

impl = BLAS_BASED;
D.reset(C);
Expand Down Expand Up @@ -103,7 +103,7 @@ REPLICATED_TEMPLATED_TEST_CASE(dpd_contract, R, T, all_types)
unsigned irrep_AC = A.irrep()^irrep_AB;
unsigned irrep_BC = B.irrep()^irrep_AB;

neps += size_AB[irrep_AB]*
neps += (size_AB[irrep_AB]+1)*
size_AC[irrep_AC]*
size_BC[irrep_BC];
}
Expand Down Expand Up @@ -145,7 +145,7 @@ REPLICATED_TEMPLATED_TEST_CASE(indexed_contract, R, T, all_types)
INDEXED_TENSOR_INFO(C);

auto idx_AB = intersection(idx_A, idx_B);
auto neps = prod(select_from(A.lengths(), idx_A, idx_AB))*prod(C.lengths());
auto neps = (prod(select_from(A.lengths(), idx_A, idx_AB))+1)*prod(C.lengths());

dpd_impl = dpd_impl_t::BLOCKED;
D.reset(C);
Expand Down Expand Up @@ -189,7 +189,7 @@ REPLICATED_TEMPLATED_TEST_CASE(indexed_dpd_contract, R, T, all_types)
unsigned irrep_AC = A.irrep()^irrep_AB;
unsigned irrep_BC = B.irrep()^irrep_AB;

neps += size_AB[irrep_AB]*
neps += (size_AB[irrep_AB]+1)*
size_AC[irrep_AC]*
size_BC[irrep_BC];
}
Expand Down
22 changes: 20 additions & 2 deletions test/3t/mult.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ REPLICATED_TEMPLATED_TEST_CASE(mult, R, T, all_types)
TENSOR_INFO(C);

auto idx_AB = exclusion(intersection(idx_A, idx_B), idx_C);
auto neps = prod(select_from(A.lengths(), idx_A, idx_AB))*prod(C.lengths());
auto neps = (prod(select_from(A.lengths(), idx_A, idx_AB))+1)*prod(C.lengths());

impl = REFERENCE;
D.reset(C);
Expand Down Expand Up @@ -116,6 +116,15 @@ REPLICATED_TEMPLATED_TEST_CASE(dpd_mult, R, T, all_types)
size_AC[irrep_AC]*
size_BC[irrep_BC];
}
for (unsigned irrep_AC = 0;irrep_AC < nirrep;irrep_AC++)
for (unsigned irrep_BC = 0;irrep_BC < nirrep;irrep_BC++)
{
unsigned irrep_ABC = irrep_AC^irrep_BC^C.irrep();

neps += size_ABC[irrep_ABC]*
size_AC[irrep_AC]*
size_BC[irrep_BC];
}

dpd_impl = dpd_impl_t::BLOCKED;
D.reset(C);
Expand Down Expand Up @@ -148,7 +157,7 @@ REPLICATED_TEMPLATED_TEST_CASE(indexed_mult, R, T, all_types)
INDEXED_TENSOR_INFO(C);

auto idx_AB = exclusion(intersection(idx_A, idx_B), idx_C);
auto neps = prod(select_from(A.lengths(), idx_A, idx_AB))*prod(C.lengths());
auto neps = (prod(select_from(A.lengths(), idx_A, idx_AB))+1)*prod(C.lengths());

dpd_impl = dpd_impl_t::BLOCKED;
D.reset(C);
Expand Down Expand Up @@ -202,6 +211,15 @@ REPLICATED_TEMPLATED_TEST_CASE(indexed_dpd_mult, R, T, all_types)
size_AC[irrep_AC]*
size_BC[irrep_BC];
}
for (unsigned irrep_AC = 0;irrep_AC < nirrep;irrep_AC++)
for (unsigned irrep_BC = 0;irrep_BC < nirrep;irrep_BC++)
{
unsigned irrep_ABC = irrep_AC^irrep_BC^C.irrep();

neps += size_ABC[irrep_ABC]*
size_AC[irrep_AC]*
size_BC[irrep_BC];
}

dpd_impl = dpd_impl_t::BLOCKED;
D.reset(C);
Expand Down

0 comments on commit 3e4c4b8

Please sign in to comment.