QuAIRKit Framework

A Python research framework for quantum computing, quantum information, and quantum machine learning algorithm development

Installation

Get started with QuAIRKit in minutes

# Create conda environment

conda create -n quair python=3.10
conda activate quair
conda install jupyter notebook

# Install via pip

pip install quairkit

# Or install from source

git clone https://github.com/QuAIR/QuAIRKit
cd QuAIRKit
pip install -e .

Key Features

Batch Computation

Supports batch computations for quantum circuit simulations, state measurement and quantum information processing

Qudit Computation

Full support for qudit quantum computing with batch computation capabilities

Fast Construction

Flexible quantum circuit construction with self-managing parameters and built-in layer ansatzes

Code Examples

See QuAIRKit in action with these examples

Batch Computation Example

import quairkit as qkit
from quairkit.database import *
from quairkit.qinfo import *

target_state = zero_state(1)
unitary_data = pauli_group(1)

cir = qkit.Circuit(1)
cir.oracle(unitary_data, 0)
cir.ry(param=[0, 1, 2, 3])

print(state_fidelity(cir(), target_state)) # zero-state input by default
# tensor([1.0000, 0.4794, 0.8415, 0.0707])

Qudit Computation Example

# claim three systems, with 1 qubit and 1 qutrit
cir = qkit.Circuit(2, system_dim=[2, 3])

# apply the Heisenberg-Weyl operators on all systems
cir.oracle(heisenberg_weyl(6), [0, 1])

# apply the H gate on the first system, controlled by the second system
cir.control_oracle(h(), [1, 0])

# trace out the qutrit system and get the qubit state
traced_state = cir().trace(1)

print('The 6th and 7th state for the batched qubit state is', traced_state[5:7])

Features

Comprehensive quantum computing capabilities

Fast Construction

QuAIRKit provides a fast and flexible way to construct quantum circuits, by self-managing the parameters. All parameters would be created randomly if not specified.

cir = qkit.Circuit(3)

cir.h() # apply Hadamard gate on all qubits
cir.complex_entangled_layer(depth=3) # apply complex entangled layers
cir.universal_three_qubits() # apply universal three-qubit gate

Implicit Transition

If you want to perform noise simulation or mixed-state-related tools, there is no need to specify the backend, or import other libraries.

cir = qkit.Circuit(3)

cir.complex_entangled_layer(depth=3)
print(cir().backend) # state_vector

# partial transpose on the first two qubits
print(cir().transpose([0, 1]).backend) # density_matrix

cir.depolarizing(prob=0.1)
print(cir().backend) # density_matrix