Open Muzhou-Ma opened 1 year ago
Hello @Marsmmz, thank you for your interest in Mitiq! If this is a bug report, please provide screenshots and/or minimum viable code to reproduce your issue, so we can do our best to help get it fixed. If you have any questions in the meantime, you can also ask us on the Unitary Fund Discord.
Hi @Marsmmz, thank you for opening this issue.
Mitiq uses a circuit converter to convert a Qiskit circuit to a Cirq circuit before implementing an error mitigation technique. When the first few error mitigation techniques were added, there was no Cirq equivalent to the Reset
instruction in Qiskit.
It seems Cirq now has a reset gate (added 9 months ago). I think if all circuit representations allowed by mitiq have a reset
gate equivalent, then adding this as a new feature will be a possibility.
Pinging others to correct me @andreamari @Misty-W @natestemen
Thanks @purva-thakre! In terms of conversions it should work, but we'd need to think carefully about how to handle reset gates in ZNE before introducing them into Mitiq.
Based on Andrea's comments from Oct 6 Community Call:
To close this issue,
reset
gate. reset
gate will be an exception to gate-level manipulations by mitiq techniques like unitary folding. (See comment about considering ZNE as an independent issue)about the first step: "Figure out if QASM Converter in Cirq has the ability to handle the conversion with a reset gate in the circuit." The answer is no, the Reset gate is not supported by Cirq import function from QASM. See here for supported gates.
On the other hand, cirq has a Reset gate:
import cirq
from cirq.ops import reset
circuit = cirq.Circuit(reset(cirq.LineQubit(0)))
print(circuit)
0: ───R───
I'll investigate more on what we can do and I'll write any new update here.
About the sub-issue "Figure out if all allowed circuit representations in Mitiq have a reset gate:"
I don't think it's a huge problems however. If you are using braket as a front end and you don't have reset gates you can still use mitiq as usual. So, all we need to do is supporting the reset gate only for the frontends in which it exist.
About the sub-issue " If yes to both above, reset gate will be an exception to gate-level manipulations by mitiq techniques like unitary folding."
Based on the current code, the user will get an error when trying to apply ZNE to a non-unitary circuit. This is due to the check_foldable function https://github.com/unitaryfund/mitiq/blob/ec3feb69133d4353e0f58cbdbce79ca8e408511e/mitiq/zne/scaling/folding.py#L58 which is called by noise scaling functions.
This is good since it avoids any unexpected behavior due to the potentially unintentional/unknown presence of reset gates somewhere in the circuit!
I think supporting a reset gate for ZNE is a further issue that could be considered as a second step. This is highly non-trivial.
As a first step we could focus on just supporting the reset gate for conversions: frontend->cirq->frontend. If we have this, it should be easy to apply techniques like DDD, PEC, REM without too many further changes.
ZNE is a special case since it requires circuit inversions. So I would suggest to consider the potential support of ZNE + Reset as a different issue.
With https://github.com/unitaryfund/mitiq/pull/2128, PEC should become fully compatible with Cirq circuits containing reset gates. This is just a small step towards full support of Reset gates.
Issue Description
It would be really helpful if a "reset" operation could be supported by Mitiq which is corresponded to reset in Qiskit.
Additional References