Getting started
Installation
For now, we support python versions 3.9 to 3.11, and both Windows, Linux and MacOS (specifically, Linux was validated on Ubuntu LTS 20.04, while Ubuntu 18.04 is not supported, so your milage may vary).
$ pip install mpqp
Note
For mac users, additional steps are required before the installation,
specifically because of the myqlm
library. To run these steps, you can
either follow their instructions on
this page
or run the script we created to facilitate this step:
curl -L https://raw.githubusercontent.com/ColibrITD-SAS/mpqp/main/mac-install.sh | bash -s -- <your-python-bin>
where <your-python-bin>
is the binary you use to invoke python. It could
for instance be python
, python3
, python3.9
, etc…
Your first circuit
A circuit is created by providing QCircuit
a list of Instruction
(gates and measurement). To run a circuit, you can then use the
run
function.
>>> from mpqp import QCircuit
>>> from mpqp.gates import X, CNOT
>>> from mpqp.measures import BasisMeasure
>>> print(QCircuit([X(0),CNOT(0, 1), BasisMeasure([0, 1], shots=100)]))
┌───┐ ┌─┐
q_0: ┤ X ├──■──┤M├───
└───┘┌─┴─┐└╥┘┌─┐
q_1: ─────┤ X ├─╫─┤M├
└───┘ ║ └╥┘
c: 2/═══════════╩══╩═
0 1
Setup remote accesses
Installing MPQP gives you access to setup_connections
a script facilitating
the setting up of remote QPU connections. The three supported providers (qiskit,
Qaptiva and braket) can be setup from this script. Each of these providers have
their own set of data needed to setup the connection, summed up here:
IBM quantum (qiskit): for this provider, you only need your account
API token
, which you can find in your account page;Atos/Eviden (Qaptiva/QLM): for this provider, several connection methods exist. For now we only support the username/password method. You should have received you username and password by email;
AWS (braket): for this provider, you will need more information: all of them can be found in your AWS console. In the console go to the
IAM service
, in theUsers
tab, click on your username, in theSecurity credential
tab, you’ll find anAccess keys
section. In this section, you can create a new access key forMPQP
, you should save it because you will not be able to get back your secret latter on. This will give you your key and your secret, but for the configuration you also need a region (for exampleus-east-1
). In short, one would need:AWS Access Key ID
,AWS Secret Access Key
andDefault region name
.
Execute examples
A few examples are provided in the examples
folder of the repo. To try them
out, you can either download them individually from our GitHub repository or cloning the repository and
executing them as follows:
$ python -m examples.scripts.bell_pair
$ python -m examples.scripts.demonstration
$ python -m examples.scripts.observable_job