-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CliffordCircuitPredicate if we're using the stabilizer simulator (#…
…560)
- Loading branch information
1 parent
73693ba
commit 07a4367
Showing
5 changed files
with
48 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import pytest | ||
|
||
from pytket.extensions.quantinuum import QuantinuumAPIOffline, QuantinuumBackend | ||
from pytket.predicates import CliffordCircuitPredicate | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"simulator_type,should_have_clifford_predicate", | ||
[ | ||
("state-vector", False), | ||
("stabilizer", True), | ||
], | ||
) | ||
def test_clifford_circuits_for_stabilizer( | ||
simulator_type: str, | ||
should_have_clifford_predicate: bool, | ||
) -> None: | ||
"""Check that the stabilizer simulator restricts circuits to be Clifford circuits, | ||
and the statevector simulator does not.""" | ||
qapi_offline = QuantinuumAPIOffline() | ||
backend = QuantinuumBackend( | ||
"H1-1E", | ||
api_handler=qapi_offline, # type: ignore | ||
simulator=simulator_type, | ||
) | ||
required_predicates = backend.required_predicates | ||
assert should_have_clifford_predicate == any( | ||
isinstance(pred, CliffordCircuitPredicate) for pred in required_predicates | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters