GridDevice: Exclude MeasurementGates in validation of qubit pairs#5654
Conversation
| cirq.measure( | ||
| device_info.grid_qubits[2 * i + 1], device_info.grid_qubits[2 * (i + 1) + 1] | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Would be good to add some test cases of measurement on more qubits, for example triplets of qubits or all qubits (cirq.measure(*device_info.grid_qubits)).
|
Automerge cancelled: A required status check is not present. Missing statuses: ['Coverage check', 'Doc test', 'Notebook formatting', 'Pytest MacOS (3.7)', 'Pytest MacOS (3.8)', 'Pytest MacOS (3.9)', 'Pytest Ubuntu (3.7)', 'Pytest Ubuntu (3.8)', 'Pytest Ubuntu (3.9)', 'Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)', 'Typescript lint check', 'Typescript tests', 'Typescript tests coverage'] |
|
What about identity gate, does it also need to be allowed? (Yes odd to do identity across multiple qubits, but I think it is technically a multiqubit gate. Reset isn't) |
|
Ah right. I left identity gate as a TODO which will be addressed soon in a separate PR. Will change the check to something like |
|
What about wait gate? Does that need to be handled here? |
|
@dstrain115 does this mean only single-qubit WaitGates are allowed by the CircuitSerializer since both |
|
It's been a while since I dealt with this, but I think wait gates are similar to measurement gates in that they can be any permutation of qubits. I think they were the PERMUTATION_SET in the old device spec. |
43701fb to
bbbfecb
Compare
|
Added WaitGate support |
maffoo
left a comment
There was a problem hiding this comment.
I'd suggest using the term "variadic" to describe these gates, otherwise this looks good to me.
| WAIT_GATE_FAMILY = cirq.GateFamily(cirq.WaitGate) | ||
|
|
||
| # Families of gates which can be applied to any subset of valid qubits. | ||
| _SUBSET_PERMUTATION_GATE_FAMILIES = [MEASUREMENT_GATE_FAMILY, WAIT_GATE_FAMILY] |
There was a problem hiding this comment.
Could we perhaps call this _VARIADIC_GATE_FAMILIES instead? I think the term "variadic" captures the property we want, that these are gates that can be applied to any number of qubits.
There was a problem hiding this comment.
I am going to remember this vocabulary word for when I take the Quantum SATs!
|
Automerge cancelled: A required status check is not present. Missing statuses: ['Build docs', 'Build protos', 'Changed files test', 'Coverage check', 'Doc test', 'Lint check', 'Notebook formatting', 'Pytest MacOS (3.7)', 'Pytest MacOS (3.8)', 'Pytest MacOS (3.9)', 'Pytest Ubuntu (3.7)', 'Pytest Ubuntu (3.8)', 'Pytest Ubuntu (3.9)', 'Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)', 'Type check', 'Typescript lint check', 'Typescript tests', 'Typescript tests coverage'] |
…antumlib#5654) I'm comfortable with special-casing MeasurementGate because it's the only gate today with the property that it can be applied to any subset of qubits. Fixes quantumlib#5652 @maffoo
I'm comfortable with special-casing MeasurementGate because it's the only gate today with the property that it can be applied to any subset of qubits.
Fixes #5652
@maffoo