Skip to main content

Mitiq is an open source toolkit for implementing error mitigation techniques on most current intermediate-scale quantum computers.

Project description

Mitiq logo

All Contributors

build Documentation Status codecov PyPI version arXiv Downloads Repository Unitary Fund Discord Chat Binder

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 our documentation and chat with us on Discord.

Do you use near-term quantum hardware? Have you tried Mitiq? Either way, take our survey and help make Mitiq better! bit.ly/mitiq-survey

Quickstart

Installation

pip install mitiq

Example

Define a function which inputs a circuit and returns an expectation value you want to compute, then use Mitiq to mitigate errors.

import cirq
from mitiq import zne, benchmarks


def execute(circuit: cirq.Circuit, noise_level: float = 0.001) -> float:
    """Returns 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 quantum computer.
noisy_value = execute(circuit)                       # Noisy quantum computer.
zne_value = zne.execute_with_zne(circuit, execute)   # Noisy quantum computer + 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))

Sample output:

Error (w/o  Mitiq): 0.0688
Error (with Mitiq): 0.0002

See our guides and examples for more explanation, techniques, and benchmarks. The examples and other notebooks can be run interactively on the cloud with mybinder.org.

Quick Tour

Error mitigation techniques

Technique Documentation Mitiq module Paper Reference(s)
Zero-noise extrapolation ZNE mitiq.zne 1611.09301
1612.02058
1805.04492
Probabilistic error cancellation PEC mitiq.pec 1612.02058
1712.09271
1905.10135
(Variable-noise) Clifford data regression CDR mitiq.cdr 2005.10189
2011.01157
Dynamical decoupling DDD mitiq.cdd 9803057
1807.08768
Readout-error mitigation REM mitiq.rem 2009.13485 (Appendix H)
1704.05018 (Appendix V.B)

See our roadmap for additional candidate techniques to implement. If there is a technique you are looking for, please file a feature request.

Interface

We refer to any programming language you can write quantum circuits in as a frontend, and any quantum computer / simulator you can simulate circuits in as a backend.

Supported frontends

Cirq Qiskit pyQuil Braket PennyLane
Cirq logo Qiskit logo Rigetti logo AWS logo    PennyLane logo

Note: Cirq is a core requirement of Mitiq and is installed when you pip install mitiq.

Supported backends

You can use Mitiq with any backend you have access to that can interface with supported frontends.

Benchmarks

Mitiq uses asv to benchmark the core functionalities of the project. They are found in the benchmarks/ directory and their changes can be seen overtime at https://benchmarks.mitiq.dev/.

Citing Mitiq

If you use Mitiq in your research, please reference the Mitiq whitepaper using the bibtex entry found in CITATION.bib.

A list of papers citing Mitiq can be found on Google Scholar / Semantic Scholar.

License

GNU GPL v.3.0.

Contributing

We welcome contributions to Mitiq including bug fixes, feature requests, etc. To get started, check out our contribution guidelines and/or documentation guidelines. An up-to-date list of contributors can be found here and below.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Yash-10
Yash-10

⚠️ 💻
Laurent AJDNIK
Laurent AJDNIK

📖
Tianyi Hao
Tianyi Hao

💻 🐛
Brian Lui
Brian Lui

💻 🐛
Cole Kissane
Cole Kissane

💻 🐛
Michał Stęchły
Michał Stęchły

💻
Kunal Marwaha
Kunal Marwaha

📖
k-m-schultz
k-m-schultz

💡
Bobin Mathew
Bobin Mathew

📖
LogMoss
LogMoss

📖 🐛
DSamuel1
DSamuel1

💡 💻
sid1993
sid1993

💻 🐛
Yousef Hindy
Yousef Hindy

💻 ⚠️ 📖
Mohamed El Mandouh
Mohamed El Mandouh

💻 ⚠️ 📖
Aaron Robertson
Aaron Robertson

💡 ⚠️ 🐛 🤔 💻 📖
Ashish Panigrahi
Ashish Panigrahi

📖
Maxime Tremblay
Maxime Tremblay

💻 📖 🤔
Andre
Andre

📖 ⚠️
Purva Thakre
Purva Thakre

📖 🚇 💻 🤔
Peter Karalekas
Peter Karalekas

🚧 💻 📖 🚇 🤔
Sarah Kaiser
Sarah Kaiser

🚧 💻 📖 🚇 🤔
Andrea Mari
Andrea Mari

🚧 💻 📖 🚇 🤔
Will Zeng
Will Zeng

🚧 💻 📖 🚇 🤔
Nathan Shammah
Nathan Shammah

🚧 💻 📖 🚇 🤔
Ryan LaRose
Ryan LaRose

🚧 💻 📖 🚇 🤔
francespoblete
francespoblete

🎨
Misty-W
Misty-W

💻 💡 🤔 ⚠️ 🚧 📖
AkashNarayanan B
AkashNarayanan B

🚇
L-P-B
L-P-B

⚠️ 💻
Rahul Mistri
Rahul Mistri

⚠️ 💻
Victory Omole
Victory Omole

⚠️ 💻
nate stemen
nate stemen

🚇 📖 ⚠️ 💻
Luciano Bello
Luciano Bello

🚇 💻
Amir Ebrahimi
Amir Ebrahimi

💻 ⚠️ 📖

This project follows the all-contributors specification. Contributions of any kind are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mitiq-0.22.0.tar.gz (115.0 kB view details)

Uploaded Source

Built Distribution

mitiq-0.22.0-py3-none-any.whl (157.0 kB view details)

Uploaded Python 3

File details

Details for the file mitiq-0.22.0.tar.gz.

File metadata

  • Download URL: mitiq-0.22.0.tar.gz
  • Upload date:
  • Size: 115.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for mitiq-0.22.0.tar.gz
Algorithm Hash digest
SHA256 9d413e3fb482a14f6d75680a25f60a4c08bb2f3b566236e6448fa5e3cc4c8f5b
MD5 da9ac0f4c9018cd7833655de64b0d210
BLAKE2b-256 cdcf308b2d114f5c0540efc38192c47bce4a144c650d14b50168055650891841

See more details on using hashes here.

File details

Details for the file mitiq-0.22.0-py3-none-any.whl.

File metadata

  • Download URL: mitiq-0.22.0-py3-none-any.whl
  • Upload date:
  • Size: 157.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for mitiq-0.22.0-py3-none-any.whl
Algorithm Hash digest
SHA256 359fe099896c419bf71480c197cbe19b41c04bc2ce1df885735ee8e12b42a6eb
MD5 f782e47df3f8a648dc3afc0b905bb5df
BLAKE2b-256 a2e2bcef36bbb75b74cc08d7d78ea12e73a4e8357df2e9b730a3f76ac1e5699d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page