Skip to main content

Python wrapper for the MIMIQ Quantanium statevector engine.

Project description

Quantanium-python

Python Wrapper for the MIMIQ Quantanium statevector engine.

Prerequisites

Before installing, ensure you have:

  • Python (version 3.10, 3.11, or 3.12)
  • Git installed on your system
  • Virtual environment support (e.g., venv)

Installation

Quantanium is implemented in C++, with a wrapper written in the Python programming language to enhance usability and ensure support with MIMIQ API. For the released versions of Quantanium, we provide binaries via our Git repository, specifically for the Linux platform, which only require a functional Python environment to install. You can do this very easily following the instructions from the next subsection.

Installation Quantanium-python from Binary

Installation Steps:

create a new python environment:

python -m venv .quantanium_venv

activate your environment:

source .quantanium/bin/acitvate

Download the latest release here: https://github.com/qperfect-io/quantanium-python/releases/latest

Extract the content of the zip file using

To install the wheel make sure to select the correct file for your system.

  • the number after cp[NUM] in the name of the whl file must match your python version
  • If you are using macos take the file with macos included in the name, otherwise take the file with manylinux. (not built for windows yet)

For example to install the wheels on ubuntu for python 3.12 run:

pip install  quantaniumpy-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Troubleshooting

  • If installation fails, check that you have the correct Python version (python --version).
  • Ensure all dependencies are installed.
  • In some cases you should consider upgrading via the 'pip install --upgrade pip' command.

Installation from Source

You can also build and install Quantaniumpy from source. Note, in this way, a g++ or clang++ compiler is necessary: make sure that the compiler installed.

In order to install quantaniumpy from source, please follow the next set of instructions:

  1. Clone this repository with
$ git git@git.unistra.fr:code-quantum/quantanium.git
$ cd quantanium
  1. Initialize all the dependencies of the project by typing the following instruction in the command line of your shell terminal:
$ git submodule init && git submodule update
  1. Setup the build directory and build C++ code with python wrapper support by the following instructions in the command line of your shell terminal:
$ mkdir release-python

$ cd release-python

$ cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=On -DQUANTANIUM_WITH_PYTHON=On ../

$ cmake --build . -j 4
  1. Since C++ source code is built, you have to prepare your library environement. In order to do this, please, navigate to root folder of the project quantanium and make the following set of commands:
$ cd ..
$ mkdir python/quantaniumpy/lib
$ cp release-python/lib/quantaniumpy.cpython-310-x86_64-linux-gnu.so python/quantaniumpy/lib
$ export PYTHONPATH=$PYTHONPATH:../../release-python/lib
  • You may need to export path to spdlog library:
export LD_LIBRARY_PATH=../../release-python/libs/spdlog
  1. Building the Python Package with Poetry
  • Navigate to the directory of the python project (supposing you are still in the root folder of the project quantanium):
cd python/
  • Set up Python virtual development environment

Virtual environments are used for development to isolate the development environment from system-wide packages. This way helps to avoid inadvertently becoming dependent on a particular system configuration and makes it easy to maintain multiple environments: e.g. for older versions of Quantanium. Start by creating a new virtual environment with venv:

python -m venv ~/.venvs/quapy 

Activate the environment by invoking the activation command:

source ~/.venvs/quapy/bin/activate
  • Ensure you have Poetry installed. If you don't have it installed, you can install it using the following command:
python -m pip install poetry
  • Build the package using Poetry:
poetry build
  1. Install the package, use pip to install the wheel file generated by Poetry:
pip install dist/quantaniumpy-0.1.0-py3-none-any.whl

Accessible Functions

All accessible functions are defined within the Quantanium class inside Quantanium.py. These include:

  • convert_qasm_to_qua_circuit(qasm_file): Converts a QASM file to a qua::Circuit.
  • convert_qua_to_mimiq_circuit(qua_circuit): Converts a qua::Circuit to a mimiq::Circuit.
  • convert_mimiq_to_qua_circuit(mimiq_circuit): Converts a mimiq::Circuit back to a qua::Circuit.
  • convert_qua_results_to_mimiq_results(qua_results): Converts qua::Results to mimiq::Results.
  • execute(circuit, label="pyapi_v1.0", algorithm="auto", nsamples=1000, bitstrings=None, timelimit=300, bonddim=None, entdim=None, seed=None, qasmincludes=None): Executes the given circuit.

Quick Start

In order to start, you can use an example script from folder examples, e.g.:

$ python examples/example_qasm.py

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

quantanium-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

quantanium-0.1.0-cp312-cp312-macosx_13_0_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.12macOS 13.0+ x86-64

quantanium-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

quantanium-0.1.0-cp311-cp311-macosx_13_0_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.11macOS 13.0+ x86-64

quantanium-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

quantanium-0.1.0-cp310-cp310-macosx_13_0_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.10macOS 13.0+ x86-64

File details

Details for the file quantanium-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for quantanium-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 07a5ced43d6811b11fce8bdd86bb9ad0a9a39d1e9050a06df72a07e1b42e626f
MD5 941e1dee210115d6abe138347326876f
BLAKE2b-256 b92a4121a2c35f7f976160a8517865405f9e38cf86d6e66015ee88131c207e3f

See more details on using hashes here.

File details

Details for the file quantanium-0.1.0-cp312-cp312-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for quantanium-0.1.0-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 673c575361f7dbc1bc89c07d56e977f3b24fb4767a5955cc72000f06ac7df316
MD5 d738706791608dd9c98e8b17cc706714
BLAKE2b-256 d080b71fd0e55b0cff2c380c41a9aa39346a368e60c0dd03f912914d56c417c3

See more details on using hashes here.

File details

Details for the file quantanium-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for quantanium-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 523f2eaa07796001478532cde6662950582949f638387ec4fa4c05614fb09b09
MD5 0e2a0784ce8bb01247f693abe4791ba8
BLAKE2b-256 d4b81f3be15a87d1dd4aa28d8a8baef0f3f6ed54c07649ee432bb774c3ab75e7

See more details on using hashes here.

File details

Details for the file quantanium-0.1.0-cp311-cp311-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for quantanium-0.1.0-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 930f54059aacd206f5a740a2e55c97b2dfa716cc413cf118ab55d11fe6a42ce4
MD5 4b814047e5bf575c10ef3d4c855bf55c
BLAKE2b-256 a6ae49109e9e0076bad9958bc64f71fe92edfc3538b72b7c0615032be9f9c6fc

See more details on using hashes here.

File details

Details for the file quantanium-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for quantanium-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 04b7eccb7d3cad6b328540d6130fa937a7567e6bbece5e9e9402e96fbd181a82
MD5 db96dfbc23e459c8827255a07c04f25a
BLAKE2b-256 79198ad4bc1b63e410721df56125bac01363e786c05dfd000e0cc13dbe4dcfa5

See more details on using hashes here.

File details

Details for the file quantanium-0.1.0-cp310-cp310-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for quantanium-0.1.0-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 fbae33466c6dad0bed7d6245eb5f91b8d9fff1fa58f6bc31222609716f57a869
MD5 e3aa15385fe78c449cde88682d391a9d
BLAKE2b-256 440647243cc70bc5a705633cbef3c69b2e2bd4072135953177160e83a105090d

See more details on using hashes here.

Supported by

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