Skip to content

Commit

Permalink
Merge branch 'develop' into 'main'
Browse files Browse the repository at this point in the history
new Release

See merge request haiqu-ai/qml-transpiler!25
  • Loading branch information
yuriy-haiqu committed Jun 20, 2024
2 parents f9a418e + 47d0abb commit a9b18ae
Show file tree
Hide file tree
Showing 11 changed files with 704 additions and 2,308 deletions.
62 changes: 54 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,75 @@ The package provides a family of functions for efficient transpilation of quantu

## Installation

To install Rivet Transpiler, please clone the repository:
### Step 1: Project Environment Setup (Optional)
Setting up a local Python environment for each project is good practice as it helps manage dependencies and versions more effectively. We recommend using Conda or Python virtual environments. Alternatively, you can install the requirements in your own Python environment and skip this step.

#### Conda Guide

If you do not have Conda installed, follow the [official Conda documentation](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html) to download and install Conda.

Once Conda is installed, create an environment for the rivet project:

```bash
git clone https://github.com/haiqu-ai/rivet.git
conda create -y --name rivet python=3.10
conda activate rivet
```
#### Virtualenv Guide

Go to the repository folder and install a local package using pip:
If you do not have Virtualenv installed, follow the [virtualenv documentation](https://virtualenv.pypa.io/en/latest/installation.html) to download and install the latest version.

Once Virtualenv is installed, create an environment for the rivet project:

```bash
pip install .
virtualenv venv --python=python3.10
source venv/bin/activate
```
### Step 2: Install Rivet package

To install the transpiler with all supported stacks:
To install Rivet Transpiler base version(support only qiskit transpilation stack) run:

```bash
pip install .[stacks]
pip install 'rivet-transpiler @ git+https://github.com/haiqu-ai/rivet.git'
```

To install with all stacks please run:

```bash
pip install 'rivet-transpiler[stacks] @ git+https://github.com/haiqu-ai/rivet.git'
```

To install only BQSKit or only Pytket support:
```bash
pip install 'rivet-transpiler[bqskit] @ git+https://github.com/haiqu-ai/rivet.git'
pip install 'rivet-transpiler[pytket] @ git+https://github.com/haiqu-ai/rivet.git'
```

### Step 3: Running examples (Optional)

To run Rivet Transpiler example notebooks, first clone the full repository and navigate to the rivet folder:

```bash
git clone https://github.com/haiqu-ai/rivet.git
cd rivet
```

Install additional packages needed for examples:

```bash
pip install matplotlib
pip install tqdm
```

If you do not have Jupyter installed, run:

```bash
pip install jupyter
```

Run Jupyter and open [examples notebooks](https://gitlab.com/haiqu-ai/qml-transpiler/-/tree/main/examples?ref_type=heads)

```bash
pip install .[bqskit]
pip install .[pytket]
jupyter notebook
```

## Documentation
Expand Down
2,097 changes: 0 additions & 2,097 deletions docs/source/examples_examples.ipynb

This file was deleted.

105 changes: 0 additions & 105 deletions docs/source/examples_overview.ipynb

This file was deleted.

106 changes: 12 additions & 94 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,117 +1,34 @@
Rivet Transpiler Documentation
==============================
Welcome to Haiqu Rivet Transpiler documentation!

Welcome to Haiqu documentation!
The Rivet Transpiler allows users to design and implement fast automated modular transpilation
routines with the transpilation stack of their choice. The goal is to allow users complete control
over the process, allowing for greater flexibility and large reductions in transpilation time.

This is the right place where you can find more about Haiqu's state-of-the-art
quantum software platform.
Despite its advanced functionality, Rivet Transpiler is easy to use and includes convenience features, such as performance tracking and debugging.

Rivet Transpiler package provides a family of functions for efficient transpilation
of quantum circuits. See `API Reference` section for more details.


Installation
------------

To install Rivet Transpiler, please clone the repository:

.. code-block:: bash
git clone https://github.com/haiqu-ai/rivet.git
To install the transpiler with all supported stacks:

.. code-block:: bash
pip install .[stacks]
To install only BQSKit or only Pytket support:

.. code-block:: bash
pip install .[bqskit]
pip install .[pytket]
Basic example
-------------------
.. image:: ../images/layout.png
:width: 400

Transpilation includes placement of *virtual qubits* of a circuit to *physical qubits*
of the quantum device or simulator. Additionally, SWAP gates can be included to route qubits around the backend topology.

Here is a simple example of the quantum circuit with 3 qubits before and after transpilation. Function `transpile_chain` transpiles a chain of virtual circuits keeping qubits consistent.

BEFORE transpilation:

.. code-block:: python
import qiskit
from qiskit.providers.fake_provider import FakeLimaV2
from rivet_transpiler import transpile_chain
backend = FakeLimaV2()
circuit = qiskit.QuantumCircuit(3)
circuit.cx(0, 1)
circuit.cx(1, 2)
circuit.cx(0, 2)
circuit.barrier()
circuit.draw()
.. code-block:: bash
q_0: ──■─────────■──
┌─┴─┐ │
q_1: ┤ X ├──■────┼──
└───┘┌─┴─┐┌─┴─┐
q_2: ─────┤ X ├┤ X ├
└───┘└───┘
AFTER transpilation:

.. code-block:: python
CHAIN = [circuit] * 3
transpiled_circuit = transpile_chain(
CHAIN,
backend,
seed_transpiler=1234
)
transpiled_circuit.draw(fold=-1)
.. code-block:: bash
┌───┐ ░ ┌───┐ ░ ┌───┐ ┌───┐ ┌───┐ ░
q_1 -> 0 ──■─────────■──┤ X ├──■────────░─┤ X ├─────────────────■────────░───■──┤ X ├──■───────┤ X ├───────────────┤ X ├─░─
┌─┴─┐ ┌─┴─┐└─┬─┘┌─┴─┐ ░ └─┬─┘┌───┐ ┌───┐┌─┴─┐┌───┐ ░ ┌─┴─┐└─┬─┘┌─┴─┐┌───┐└─┬─┘┌───┐ ┌───┐└─┬─┘ ░
q_2 -> 1 ┤ X ├──■──┤ X ├──■──┤ X ├──■───░───■──┤ X ├──■──┤ X ├┤ X ├┤ X ├─░─┤ X ├──■──┤ X ├┤ X ├──■──┤ X ├──■──┤ X ├──■───░─
└───┘┌─┴─┐└───┘ └───┘┌─┴─┐ ░ └─┬─┘┌─┴─┐└─┬─┘└───┘└─┬─┘ ░ └───┘ └───┘└─┬─┘ └─┬─┘┌─┴─┐└─┬─┘ ░
q_0 -> 2 ─────┤ X ├───────────────┤ X ├─░────────■──┤ X ├──■─────────■───░──────────────────■─────────■──┤ X ├──■────────░─
└───┘ └───┘ ░ └───┘ ░ └───┘ ░
ancilla_0 -> 3 ────────────────────────────────────────────────────────────────░───────────────────────────────────────────────░─
░ ░
ancilla_1 -> 4 ────────────────────────────────────────────────────────────────░───────────────────────────────────────────────░─
░ ░
Contacts
-------------------

`GitHub`: haiqu-ai/rivet

Haiqu, info@haiqu.ai



.. toctree::
:maxdepth: 1
:hidden:
:caption: Get Started

examples_overview.ipynb
examples_examples.ipynb
installation.ipynb
intro_transpilation.ipynb
tutorials.ipynb


.. toctree::
Expand All @@ -120,3 +37,4 @@ Haiqu, info@haiqu.ai
:caption: API Reference

api

Loading

0 comments on commit a9b18ae

Please sign in to comment.