-
Notifications
You must be signed in to change notification settings - Fork 1.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
Unable to print multi-qubit circuit with asymmetric depolarizing noise #5927
Comments
@tanujkhattar I think the output of the above snippet should be
What do you think? |
I thought I had left a comment on this issue when I added the labels, but looks I never finished the draft. Anyways, here are my thoughts: This is a bug and should be fixed. The reason is that the diagram info method returns a single string, instead of returning an Cirq/cirq-core/cirq/ops/common_channels.py Line 142 in 425bf8d
#3262 made the original change to generalize the channel from 1 qubit to multiple qubits. Even though the PR correctly identified that the diagram info would need to be updated, the update that was done was incorrect. This is because for a gate / operation that acts on One easy fix would be to change the return statement to return So, change Cirq/cirq-core/cirq/ops/common_channels.py Line 157 in 425bf8d
to return [f"A({', '.join(error_probabilities)})"] * self._num_qubits In this case, the diagram for the above snippet would look like:
Another alternative would be to return a sequence of strings so that the string corresponding to the gate name along the error probabilities appears on the 0'th qubit and then from qubits 1...N - 1, we just print an integer specifying the ordering of qubits used to apply the gate to construct an operation. i.e. return [f"A({', '.join(error_probabilities)})"] + [f'({i})' for i in range(1, self._num_qubits)] In this case, the diagram for the above snippet would look like:
This would make sure that the diagram has enough information for users to figure out which error channels are applied on which qubits in case the error is asymmetric (eg: We could also do a hybrid where each term is the entire cc @viathor for opinions on different approaches to plot the diagrams. And while we are at it, I should also point out that Cirq/cirq-core/cirq/ops/common_channels.py Lines 195 to 203 in 425bf8d
|
From cirq sync: Let's use do the second approach for diagrams and keep it consistent with other multi-qubit gates like QFT: Cirq/cirq-core/cirq/ops/fourier_transform.py Line 192 in ec68a55
|
@tanujkhattar Just to clarify, in the qft example it looks like they're starting from 1. So for example, you get something like this:
Why don't we start from 0 so the number corresponds to the line qubit #? |
Discussion from cirq cync: python is zero-based indexing, so we slightly prefer zero based indexing here as well. |
From Cirq Sync...0 based indexing. |
quantumlib#5931) Closes quantumlib#5927. Fixes based on discussion in the issue.
Description of the issue
Attempting to print a multi-qubit circuit with asymmetric depolarizing noise results in an error being thrown.
How to reproduce the issue
ValueError: Wanted diagram info from cirq.asymmetric_depolarize(error_probabilities={'XX': 0.1, 'II': 0.9}).on(cirq.LineQubit(0), cirq.LineQubit(1)) for [cirq.LineQubit(0), cirq.LineQubit(1)]) but got cirq.CircuitDiagramInfo(wire_symbols=('A(XX:0.1, II:0.9)',), exponent=1, connected=True, exponent_qubit_index=None, auto_exponent_parens=True)
Cirq version
1.0.0
The text was updated successfully, but these errors were encountered: