Open Strilanc opened 2 years ago
As stated in the error message, this will work if converted to a sympy condition. To get it to work for key conditions, we would need to pass in the qid dimension somehow, as this would only be valid for 2D qubits (qasm has no way to express "abc == 1 || abc == 2", nor "abc != 0").
Passing in the dimension will be a big architectural change, as measurement keys don't carry this information at circuit construction time. I'm not sure this will be possible for 1.0.
If qasm doesn't support qudits at all then we could just assume 2D qubits in the output, assuming somewhere else would throw an exception beforehand in the multi-dimensional case. Though even with that, I'm not sure if it would handle multi-qubit measurements correctly.
(Fact is, qasm support will always limited due to differences in how Cirq and Qiskit do measurements. These are highlighted in some of the tests.) xref #5434
I don't know what "converted to a sympy condition" means. The code sample is unambiguous and should work exactly as written. The dimension of all the involved values is clearly 2, because it's using LineQubit. Any ambiguity about that fact is purely a spandrel resulting from the internal implementation failing to explain itself to itself.
This isn't intended as a blocker for 1.0. Just recording that it doesn't work.