What is MITIQ?
This package is for
implementing error mitigation technology on quantum computers.
Current quantum computers
- Interaction with the environment
- Incomplete gate application
- There is a lot of noise due to state preparation and measurement errors
.
Error mitigation attempts to mitigate these effects at the software level by
cleverly compiling quantum programs.
start
Install.
!pip install mitiq
We define a function that inputs the circuit, returns the expected value we want to calculate, and
uses mitiq to mitigate errors.
import cirq
from mitiq import zne, benchmarks
def execute(circuit: cirq. Circuit, noise_level: float = 0.001) -> float:
"""Returs Tr[ρ |0⟩⟨0|] where ρ is the state prepared by the circuit with depolarizing noise."""
noisy_circuit = circuit.with_noise(cirq.depolarize(p=noise_level))
return cirq. DensityMatrixSimulator().simulate(noisy_circuit).final_density_matrix[0, 0].real
circuit: cirq. Circuit = benchmarks.generate_rb_circuits(n_qubits=1, num_cliffords=50)[0]
true_value = execute(circuit, noise_level=0.0) # ideal
noisy_value = execute(circuit) # noisy
zne_value = zne.execute_with_zne(circuit, execute) # noisey + mitiq
print(f"Error (w/o Mitiq): %0.4f" %abs((true_value - noisy_value) / true_value))
print(f"Error (with Mitiq): %0.4f" %abs((true_value - zne_value) / true_value))
Error (w/o Mitiq): 0.0688
Error (with Mitiq): 0.0002