-
Notifications
You must be signed in to change notification settings - Fork 1k
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 double-line diagrams for control keys #4627
Conversation
Use control keys in circuit construction to block controlled gates "earliest" append method from falling back to before the measurement.
@95-martin-orion This is good to go. It's not an easy PR; if there's anyone that knows more about diagrams then their input may be useful. There are also a number of variables still named Also, duly noted we never did formally specify what these should look like. I provided some examples in |
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.
Overall pretty happy with how this turned out. I agree that we should get input from someone familiar with the diagram-drawing tools, though - I'm adding @Strilanc to give this input.
Automerge cancelled: No approved review. |
Follow-up to #4627 that renames diagram lines from "qubits" to "labels", since they now contain control keys as well.
Sits on top of #4627 Creates `ConditionalOperation` class and executes operations conditionally upon the classical bits. Most of this is done in commit 06883d5. Reimplements quantum teleportation example based off this class. Parts 8, 9, 10 of https://tinyurl.com/cirq-feedforward.
Adds double-line wires to diagrams between measurement gates and their associated control gates. * Cbits are represented similarly as qubits with a double-line axis. * The measurement key name is the label of the cbit (and the key label from `M` is removed). * `@` is the symbol for writing to the cbit. * Currently we only allow write-once, but in the future we may want to allow overwrite, xor, bit-and, sum, etc. * `^` is the symbol for reading from / executing conditionally upon a cbit. * `X` below is hard-coded in the test case, but will be the conditional operation applied. * Measurement keys that are not used in control operations will not have a line associated, to reduce clutter. For example a circuit ``` cirq.Circuit( cirq.measure(q0, key='a') ControlOp(qubits=[q1], keys=['a']) ) ``` would have the following representation. ``` 0: ───M─────── ║ 1: ───╫───X─── ║ ║ a: ═══@═══^═══ ``` See `circuit_test` for more examples Parts 6 of https://tinyurl.com/cirq-feedforward.
Follow-up to quantumlib#4627 that renames diagram lines from "qubits" to "labels", since they now contain control keys as well.
Sits on top of quantumlib#4627 Creates `ConditionalOperation` class and executes operations conditionally upon the classical bits. Most of this is done in commit quantumlib@06883d5. Reimplements quantum teleportation example based off this class. Parts 8, 9, 10 of https://tinyurl.com/cirq-feedforward.
Adds double-line wires to diagrams between measurement gates and their associated control gates. * Cbits are represented similarly as qubits with a double-line axis. * The measurement key name is the label of the cbit (and the key label from `M` is removed). * `@` is the symbol for writing to the cbit. * Currently we only allow write-once, but in the future we may want to allow overwrite, xor, bit-and, sum, etc. * `^` is the symbol for reading from / executing conditionally upon a cbit. * `X` below is hard-coded in the test case, but will be the conditional operation applied. * Measurement keys that are not used in control operations will not have a line associated, to reduce clutter. For example a circuit ``` cirq.Circuit( cirq.measure(q0, key='a') ControlOp(qubits=[q1], keys=['a']) ) ``` would have the following representation. ``` 0: ───M─────── ║ 1: ───╫───X─── ║ ║ a: ═══@═══^═══ ``` See `circuit_test` for more examples Parts 6 of https://tinyurl.com/cirq-feedforward.
Follow-up to quantumlib#4627 that renames diagram lines from "qubits" to "labels", since they now contain control keys as well.
Sits on top of quantumlib#4627 Creates `ConditionalOperation` class and executes operations conditionally upon the classical bits. Most of this is done in commit quantumlib@06883d5. Reimplements quantum teleportation example based off this class. Parts 8, 9, 10 of https://tinyurl.com/cirq-feedforward.
Adds double-line wires to diagrams between measurement gates and their associated control gates.
M
is removed).@
is the symbol for writing to the cbit.^
is the symbol for reading from / executing conditionally upon a cbit.X
below is hard-coded in the test case, but will be the conditional operation applied.For example a circuit
would have the following representation.
See
circuit_test
for more examplesParts 6 of https://tinyurl.com/cirq-feedforward.