Skip to content

Commit

Permalink
Update test_GreedyPauli.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
sjdilkes committed Dec 4, 2024
1 parent b7fb3a2 commit 571ff17
Showing 1 changed file with 1 addition and 72 deletions.
73 changes: 1 addition & 72 deletions tket/test/src/test_GreedyPauli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,82 +825,11 @@ SCENARIO("Test GreedyPauliSimp with multiple trials and threads") {
0.7, 0.3, 500, 500, 0, true, 1, 10)
.apply(d));
REQUIRE(Transforms::greedy_pauli_optimisation(
0.7, 0.3, 500, 500, 0, true, 10, 10)
0.7, 0.3, 500, 500, 0, true, 100, 10)
.apply(d));
REQUIRE(test_unitary_comparison(circ, d, true));
}
}

SCENARIO(
"Test GreedyPauliSimp with large enough timeout to hit PauliGraph "
"construction") {
GIVEN("Large circuit") {
Circuit circ(6);
for (unsigned i = 0; i < 1000; i++) {
circ.add_box(
PauliExpBox(SymPauliTensor({Pauli::X, Pauli::X}, 0.3)), {0, 1});
circ.add_box(
PauliExpBox(SymPauliTensor({Pauli::Z, Pauli::Y, Pauli::X}, 0.2)),
{0, 1, 2});
circ.add_box(
PauliExpCommutingSetBox({
{{Pauli::I, Pauli::Y, Pauli::I, Pauli::Z}, 1.2},
{{Pauli::X, Pauli::Y, Pauli::Z, Pauli::I}, 0.8},
{{Pauli::I, Pauli::I, Pauli::I, Pauli::Z}, 1.25},
}),
{1, 2, 3, 4});
circ.add_box(
PauliExpBox(SymPauliTensor({Pauli::Y, Pauli::X}, 0.1)), {2, 3});
circ.add_box(
PauliExpBox(SymPauliTensor({Pauli::Z, Pauli::Y, Pauli::X}, 0.11)),
{1, 3, 4});
circ.add_box(
PauliExpBox(SymPauliTensor({Pauli::Y, Pauli::Y}, 0.2)), {4, 5});
circ.add_box(
PauliExpBox(SymPauliTensor({Pauli::Z, Pauli::Z, Pauli::X}, 0.15)),
{2, 4, 5});
circ.add_box(
PauliExpBox(
SymPauliTensor({Pauli::X, Pauli::X, Pauli::X, Pauli::X}, 0.25)),
{2, 4, 5, 0});
circ.add_box(
PauliExpBox(
SymPauliTensor({Pauli::Y, Pauli::Z, Pauli::Z, Pauli::X}, 0.125)),
{1, 3, 5, 0});

circ.add_box(
PauliExpBox(SymPauliTensor(
{Pauli::X, Pauli::Z, Pauli::Y, Pauli::Y, Pauli::Z, Pauli::X},
0.125)),
{1, 3, 5, 0, 2, 4});

circ.add_box(
PauliExpBox(SymPauliTensor(
{Pauli::Z, Pauli::Y, Pauli::Y, Pauli::Z, Pauli::Z, Pauli::X},
0.125)),
{0, 1, 2, 3, 4, 5});

circ.add_box(
PauliExpBox(SymPauliTensor(
{Pauli::X, Pauli::Z, Pauli::Y, Pauli::Z, Pauli::Z, Pauli::X},
0.125)),
{5, 2, 4, 1, 3, 0});

circ.add_box(
PauliExpBox(SymPauliTensor(
{Pauli::X, Pauli::Z, Pauli::Y, Pauli::Y, Pauli::Z, Pauli::X},
0.125)),
{0, 5, 1, 4, 3, 2});
}
Circuit d(circ);
REQUIRE(!Transforms::greedy_pauli_optimisation(
0.7, 0.3, 500, 500, 0, true, 1, 1)
.apply(d));
REQUIRE(Transforms::greedy_pauli_optimisation(
0.7, 0.3, 500, 500, 0, true, 100, 1)
.apply(d));
REQUIRE(test_unitary_comparison(circ, d, true));
}
}
} // namespace test_GreedyPauliSimp
} // namespace tket

0 comments on commit 571ff17

Please sign in to comment.