CNOT zero noise extrapolation#4
CNOT zero noise extrapolation#4AndersHR wants to merge 2 commits intoOpenQuantumComputing:masterfrom
Conversation
…CNOT-gates by repeating CNOTs
fgfuchs
left a comment
There was a problem hiding this comment.
Thank you, this i very good code. However, I think it would be great, if the functionality already developed in zero_noise_extrapolation.py could be used and not duplicated. Examples are the functionality for Richardson extrapolation, Pauli twirling, etc.
Consider moving the contents of this file into zero_noise_extrapolation.py.
Optional: It would be nice to have a notebook comparing CNOT error mitigation using this technique with the "random Pauli error" technique.
zero_noise_extrapolation_cnot.py
Outdated
| """ | ||
|
|
||
| if (amp_factor - 1) % 2 != 0: | ||
| print("Invalid amplification factor:", amp_factor) |
There was a problem hiding this comment.
use raise Exception("....") instead
zero_noise_extrapolation_cnot.py
Outdated
| factors 1, 3, 5, ..., 2n + 1, where 1 means the bare circuit without noise amplification, and 3 means every | ||
| CNOT gate is extended as CNOT*CNOT*CNOT. | ||
|
|
||
| As CNOT*CNOT = Id, the identity, in the noise-free case the amplified CNOT have the same action as a single CNOT, |
zero_noise_extrapolation_cnot.py
Outdated
| # The 'Unroller' transpiler pass 'unrolls' (decomposes) the circuit gates to be expressed in terms of the | ||
| # physical gate set [u1,u2,u3,cx] | ||
|
|
||
| # This is still general for backends with possibly different native gate sets, as we can still express the |
There was a problem hiding this comment.
To me this is not obvious. One would probably always want to mitigate a gate type that is native on the device. It is OK to limit to IBM's devices (superconducting qubits). Maybe just remove the comment.
zero_noise_extrapolation_cnot.py
Outdated
|
|
||
| def propagate(control_in: str, target_in: str): | ||
| """ | ||
| Propagates Pauli gates through a CNOT in accordance with the following circuit identities: |
There was a problem hiding this comment.
Are you trying to remove Pauli gates? If yes, I think this will not result in a twirl.
zero_noise_extrapolation_cnot.py
Outdated
| self.backend = backend | ||
| self.is_simulator = backend.configuration().simulator | ||
|
|
||
| # Do an initial heavy optimization of the input circuit |
There was a problem hiding this comment.
This is optional, right? If we provide an empty pass_manager, nothing will be done.
…e 3-qubit SWAP-test circuit as an example.
60ea0c7 to
8d13c76
Compare
ZeroNoiseExtrapolation-class for mitigating CNOT-noise by multiplying CNOT-gates by factors 1,3,5,...,2n+1. Added an example notebook with the 3qubit SWAP-test circuit.