Reconsider demanding logical circuit equivalence for unmeasured qubits
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 25
- Forks
- 12
- Avg merge
- 2h 13m
- Merged PRs (30d)
- 10
Description
Description
Currently, qubits that don't end in a measurement must be right-dressed at the end of a circuit to catch any virtual gates. This is treated as necessary so that, after the build() process, the template circuit bound with a randomization is logically equivalent to the input circuit.
Since this isn't an observable effect on the executed circuit (how could it be if the qubits are not measured?), we should reconsider this requirement. The upside to maintaining logical equivalence is that it's easier to check if everything is working just by looking at operator equivalence of the simulated circuit, though this is already broken today because we don't expect operator equivalence when measurements are present due to measurement twirling. The downside is that it can add overhead in some situations by inserting empty boxes to collect virtual gates: 1) these empty boxes actually require dressing gates to be implemented, and 2) users need to manually deselect them during mitigation to avoid their learning and gamma overhead.
Further,
- Everything above about "end of circuit" also applies to qubits directly before a reset operation.
- If we go all the way with this, we could maybe even completely deprecate the concept of right-dressing.
Acceptance criteria
If "reconsider" gets decided as "keep logical equivalence", then just close this issue.
Otherwise, circuits like this should be valid:
circuit = QuantumCircuit(5, 2)
with circuit.box([Twirl()]):
circuit.noop(range(5))
with circuit.box([Twirl()]):
circuit.cx(0, 1)
with circuit.box([Twirl()]):
circuit.measure([0,1], [0, 1])
The transpiler will need to be updated too, to either select whether or not to terminate with right-dressing, or if we deprecate right-dressing entirely, to not right-dress any more.
There are probably a laundry list of other things to do like update the docs as this is a fairly deep change.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the build process and transpiler behavior around right-dressing for unmeasured qubits and qubits immediately before reset, including the possibility of deprecating right-dressing. Use the acceptance example to define the desired circuit validity; completion also includes the related documentation updates if right-dressing behavior changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- quantum-computing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100