Skip to content

MPQP is a python library to create quantum circuits and run them on a multitude of backends from various providers.

License

Notifications You must be signed in to change notification settings

ColibrITD-SAS/mpqp

Repository files navigation

license badge test status badge doc status badge pipy deployment status badge github stars badge

[alt:mpqp logo]

The MPQP library

MPQP stands for Multi-Platform Quantum Programming. It is a python library we at Colibri felt the need for but couldn't find a solution. We are working on quantum algorithms, but until now, there was no good solution to study quantum algorithms across devices, compares the devices, etc...

MPQP is thus the solution we bring to the community to tackle this problem.

[alt:mpqp examples]

On this page, you will find:

  1. how to install the library;
  2. how to start using it;
  3. and the current active contributors.

Install

For now, we support python versions 3.9 to 3.11, and every major OS (Windows, Linux and MacOS). We are dependant on the SDKs we support to enable various python versions and OS support, for instance, MPQP was validated on Ubuntu LTS 20.04, while Ubuntu 18.04 is not supported because myQLM does not support it.

The preferred installation method is with the pipy repo. In order to use this installation method, simply run

pip install mpqp

You can also clone this repo and install from source, for instance if you need to modify something. In that case, we advise you to have a look at our contribution guide.

Usage

To get started with MPQP, you can create a quantum circuit with a few gates, and run it against the backend of your choice:

from mpqp import QCircuit
from mpqp.gates import *
from mpqp.execution import run, IBMDevice
circ = QCircuit([H(0), H(1), Rx(0,0), CNOT(1,2), Y(2)])
print(circ)
#      ┌───┐┌───────┐
# q_0: ┤ H ├┤ Rx(0) ├─────
#      ├───┤└───────┘
# q_1: ┤ H ├────■─────────
#      └───┘  ┌─┴─┐  ┌───┐
# q_2: ───────┤ X ├──┤ Y ├
#             └───┘  └───┘
print(run(circ, IBMDevice.AER_SIMULATOR_STATEVECTOR))
# Result: IBMDevice, AER_SIMULATOR_STATEVECTOR
#  State vector: [0.-0.j  0.+0.5j 0.-0.5j 0.+0.j  0.-0.j  0.+0.5j 0.-0.5j 0.+0.j ]
#  Probabilities: [0.   0.25 0.25 0.   0.   0.25 0.25 0.  ]
#  Number of qubits: 3

More details are available in our documentation.

Contributors


Henri de Boutray

Hamza Jaffali

Muhammad Attallah

JulienCalisto

Ahmed Bejaoui