-
Notifications
You must be signed in to change notification settings - Fork 26
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
Compile any QuantumWorld
to qubits
#76
Conversation
Sorry for the large PR. The interesting part is just in |
self.add_object(new_obj) | ||
self.ancilla_names.add(ancilla_name) | ||
new_obj = self._add_ancilla(namespace=obj.name, value=result) | ||
# Swap the input and ancilla qubits using a remapping dict. |
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.
Is there a test case that exercises this new force measurement code?
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.
Added a bunch more tests. During those tests, realized that SparseSimulator does not support qudits at all but we can support that via this compilation.
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.
LGTM!
@@ -110,22 +177,98 @@ def test_pop(simulator): | |||
assert all(result[1] != popped for result in results) | |||
|
|||
|
|||
# TODO: Consider moving to qudit_effects.py if this can be broadly useful. |
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.
Agreed. Can be a separate PR though.
Part of #79
For enabling hardware-based runs, added an option to
QuantumWorld
that replaces qudits by ancilla qubits and transforms any qudit-basedQuantumEffect
and measurements to be qubit-based. Uses the utils added in #69 for the actual unitary transformations.Updated all the applicable tests under
unitary/alpha
andunitary/examples/tictactoe
to run in both regular mode and qubit-compiled mode.This is still not all-powerful because the underlying qudit-to-qubit transforms assumed that all qudits in the system have the same dimension. Will work on generalizing that further next.