Package: mitiq
Mitiq is a Python toolkit for implementing error mitigation techniques on
quantum computers.Current quantum computers are noisy due to interactions with the environment,
imperfect gate applications, state preparation and measurement errors, etc.
Error mitigation seeks to reduce these effects at the software level by
compiling quantum programs in clever ways.Want to know more? Check out ourdocumentationand chat with us onDiscord.QuickstartInstallationpipinstallmitiqExampleDefine a function which inputs a circuit and returns an expectation value you want to compute, then use Mitiq to mitigate errors.importcirqfrommitiqimportzne,benchmarksdefexecute(circuit,noise_level=0.005):"""Returns Tr[ρ |0⟩⟨0|] where ρ is the state prepared by the circuitwith 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=benchmarks.generate_rb_circuits(n_qubits=1,num_cliffords=50)[0]true_value=execute(circuit,noise_level=0.0)# Ideal quantum computernoisy_value=execute(circuit)# Noisy quantum computerzne_value=zne.execute_with_zne(circuit,execute)# Noisy quantum computer + Mitiqprint(f"Error w/o  Mitiq:{abs((true_value-noisy_value)/true_value):.3f}")print(f"Error w Mitiq:{abs((true_value-zne_value)/true_value):.3f}")Sample output:Error w/o  Mitiq: 0.264
Error w Mitiq:    0.073CalibrationUnsure which error mitigation technique or parameters to use?
Try out the calibration module demonstrated below to help find the best parameters for your particular backend!See ourguidesandexamplesfor more explanation, techniques, and benchmarks.Quick TourError mitigation techniquesTechniqueDocumentationMitiq modulePaper Reference(s)Zero-noise extrapolationZNEmitiq.zne1611.093011612.020581805.04492Probabilistic error cancellationPECmitiq.pec1612.020581712.092711905.10135(Variable-noise) Clifford data regressionCDRmitiq.cdr2005.101892011.01157Digital dynamical decouplingDDDmitiq.ddd98030571807.08768Readout-error mitigationREMmitiq.rem1907.085182006.14044See ourroadmapfor additional candidate techniques to implement. If there is a technique you are looking for, please file afeature request.InterfaceWe refer to any programming language you can write quantum circuits in as afrontend, and any quantum computer / simulator you can simulate circuits in as abackend.Supported frontendsCirqQiskitpyQuilBraketPennyLaneNote: Cirq is a core requirement of Mitiq and is installed when youpip install mitiq.Supported backendsYou can use Mitiq with any backend you have access to that can interface with supported frontends.Citing MitiqIf you use Mitiq in your research, please reference theMitiq whitepaperusing the bibtex entry found inCITATION.bib.A list of papers citing Mitiq can be found onGoogle Scholar/Semantic Scholar.LicenseGNU GPL v.3.0.ContributingWe welcome contributions to Mitiq including bug fixes, feature requests, etc. To get started, check out ourcontribution
guidelinesand/ordocumentation guidelines.Contributors ✨Thank you to all of thewonderful peoplethat have made this project possible.
Non-code contributors are also much appreciated, and are listed here.
Thank you to@francespobletefor much of Mitiq's design work/visionContributions of any kind are welcome!