-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CliffordCircuitPredicate if we're using the stabilizer simulator #560
Add CliffordCircuitPredicate if we're using the stabilizer simulator #560
Conversation
06e4876
to
8114290
Compare
@@ -615,6 +616,8 @@ def required_predicates(self) -> list[Predicate]: | |||
assert self.backend_info is not None | |||
preds.append(MaxNQubitsPredicate(self.backend_info.n_nodes)) | |||
preds.append(MaxNClRegPredicate(cast(int, self.backend_info.n_cl_reg))) | |||
if self.simulator_type == "stabilizer": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test or two showing that this is working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do - I think this makes sense to just be a unit test. Any objections to me adding a new unit test file, given that this doesn't really fit with any of the existing unit test filenames?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a related test here which could be extended. (In fact, don't we expect that test to now throw an error from process_circuit()
?)
e7d1410
to
1c671f3
Compare
Integration test is currently failing because |
pytket v1.40 is out now so I think this should be unblocked hopefully. https://docs.quantinuum.com/tket/api-docs/changelog.html#february-2025 |
It's possible to request the stabilizer simulator for non-Clifford circuits at the moment, which doesn't make sense. This commit adds a predicate to make sure that if we request the (non-default) stabilizer simulator, the circuit we submit or compile has to be a Clifford circuit.
ebdadf7
to
3c79cb1
Compare
Added a new unit test that checks we include the CliffordCircuitPredicate only when we're running with a stabilizer simulator type (and not when we have a statevector simulator). Also update test_simulator to expect to fail on the predicate check in process_circuit(), rather than breaking on get_result().
It looks like mypy correctly detects these @given items as the appropriate type, so we can remove the type: ignore and add annotations.
3c79cb1
to
b232639
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Description
QuantinuumBackend currently doesn't check if a circuit compiled for or run on the stabilizer simulator is a Clifford circuit. This PR fixes that by adding a predicate check in that case.
Checklist