-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add CircuitOperation blurb #5399
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
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
| "id": "cDAVDT7bAwDO" | ||
| }, | ||
| "source": [ | ||
| "Especially useful is dropping the last moment (which are often just measurements): `circuit[:-1]`, or reversing a circuit: `circuit[::-1]`.\n" |
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.
Does CircuitOperation add a link to the reference page or we need to write cirq.CircuitOperation ? Please change, here and elsewhere, if it's the latter.
Reply via ReviewNB
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.
Done for the first appearance of CircuitOperation - I think this is our strategy in general, similar to Wikipedia-style linking.
| "id": "cDAVDT7bAwDO" | ||
| }, | ||
| "source": [ | ||
| "Especially useful is dropping the last moment (which are often just measurements): `circuit[:-1]`, or reversing a circuit: `circuit[::-1]`.\n" |
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.
I think we should also add a section to explain circuit_op.repeat_until and circuit_op.mapped_circuit.
Reply via ReviewNB
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.
repeat_until requires measurement and classical control, neither of which are discussed in this high-level doc. Happy to add mapped_circuit, though.
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.
Done.
| "id": "cDAVDT7bAwDO" | ||
| }, | ||
| "source": [ | ||
| "Especially useful is dropping the last moment (which are often just measurements): `circuit[:-1]`, or reversing a circuit: `circuit[::-1]`.\n" |
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.
qubits = [cirq.GridQubit(x, y) for x in range(3) for y in range(3)] can be qubits=cirq.GridQubit.square(3)
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.
Done.
| "subcircuit_op = cirq.CircuitOperation(cirq.FrozenCircuit(CZ(q0, q1)))\n", | ||
| "repeated_subcircuit_op = subcircuit_op.repeat(2)\n", | ||
| "moved_subcircuit_op = subcircuit_op.with_qubit_mapping({q0: q2})\n", | ||
| "circuit = cirq.Circuit(\n", |
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.
It might be useful to have some line comments to further explain this example.
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.
Done.
augustehirth
left a comment
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.
Pending others' comments, looks great to me.
|
Pinging @dstrain115 or @tanujkhattar for final approval. |
dstrain115
left a comment
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
Documents `CircuitOperation` usage on the "Circuits" page.
Documents
CircuitOperationusage on the "Circuits" page.