A powerful and intuitive Python library for simulating quantum computing, designed for education, research, and experimentation in the field of quantum technology.
Project description
AriQuantum: Python Library for Quantum Computing Simulation
AriQuantum is a powerful and intuitive Python library for quantum computing simulation, designed for education, research, and experimentation in quantum technologies.
๐ Key Features
- Complete qubit and multi-qubit system simulation
- Rich set of quantum gates: Pauli, Hadamard, phase, controlled operations, and more
- Circuit visualization in text and graphical formats
- Bloch sphere representation of quantum states
- Flexible measurements with support for deferred measurement
- Statistical analysis of measurement results
๐ Quick Start
Installation
pip install ariquantum
Basic Examples
Working with Single Qubits
from src.ariquantum import Qubit
# Creating qubits in various states
q0 = Qubit('0') # Basis state |0โฉ
q1 = Qubit('1') # Basis state |1โฉ
q_plus = Qubit('+') # Superposition (|0โฉ + |1โฉ)/โ2
q_minus = Qubit('-') # Superposition (|0โฉ - |1โฉ)/โ2
# Applying gates
q0.h() # Hadamard gate
q0.x(0.5) # Half rotation around X-axis
# Measurement
result = q0.measure()
print(f"Measurement result: {result}")
# State visualization
print(q0.as_bracket_string())
print(q0.draw_circuit())
Multi-Qubit Systems and Entanglement
from src.ariquantum import QuantumRegister
# Creating a 2-qubit system
qr = QuantumRegister(2, '0')
# Creating Bell state (entangled state)
qr.h(0) # Apply Hadamard to first qubit
qr.cx(0, 1) # Apply CNOT
# Circuit visualization
print(qr.draw_circuit(show_initial=True))
# Getting measurement statistics
counts = qr.get_counts(shots=1000)
print(f"Measurement statistics: {counts}")
๐ Key Classes and Methods
Qubit Class
Working with single qubits:
from math import pi
from src.ariquantum import Qubit
# Creating qubits
qubit0 = Qubit('0') # From string representation
qubit1 = Qubit([0.6, 0.8]) # From state vector
# Basic operations
qubit0.h() # Hadamard gate
qubit0.x() # Pauli-X gate
qubit0.ry(pi / 4) # Rotation around Y-axis
# State analysis
probs = qubit0.measure_probabilities() # Measurement probabilities
x, y, z = qubit0.bloch_coordinates() # Bloch sphere coordinates
phi, theta = qubit0.bloch_sphere_angles(degree=True) # Bloch sphere angles
QuantumRegister Class
Working with multi-qubit systems:
from src.ariquantum import QuantumRegister
# Creating quantum register
qr0 = QuantumRegister(3, '0') # 3 qubits in |000โฉ state
qr1 = QuantumRegister(2, ['+', '-']) # Different states for each qubit
# Applying gates
qr0.h(0) # Single-qubit operations
qr0.cx(0, 1) # Controlled operations
qr0.ccx(0, 1, 2) # Toffoli gate
qr0.swap(0, 1) # State swap
# Measurements and analysis
result = qr.measure([0, 2]) # Measuring selected qubits
counts = qr.get_counts(shots=5000) # Measurement statistics
๐ฏ Implementation Features
- Deferred measurement: Ability to continue operations with unmeasured qubits
- Flexible initialization: Support for various initial state formats
- Visualization: Text representation of circuits and states
- Complete documentation: Detailed descriptions of all methods and parameters
- Optimization: Efficient computations for multi-qubit systems
๐ Example Output
Circuit Visualization
โโโโโ โโโโโโโโโโโ โโโโโโโโโ โโโโโ
q0 : โโ H โโโโโฏโโโโ X^-0.25 โโโ X^0.5 โโโ โ โโโโโโโโโโโโโโ :
โโโโโ โ โโโโโโโโโโโ โโโโโฅโโโโ โโโโโ โ
โ โโโโโ โโโโโ โ โ
q1 : โโโโโโโโโโผโโโโ H โโโ โ โโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโ :
โ โโโโโ โโโโโ โ โ
โ โโโจโโ โโโจโโ โโโโโ
q2 : โโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโ X โโโ X โโโ X โโ :
โ โโโฅโโ โโโโโ โโโฅโโ
โ โโโโโ โโโโโ โ โ
q3 : โโโโโโโโโโผโโโโ H โโโ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโ :
โ โโโโโ โโโโโ โ โ
โโโดโโ โโโโโจโโโโ โโโโโ โ
q4 : โโโโโโโโ X โโโโโโโโโโโโโโโ X^0.5 โโโ โ โโโโโโโโโโโโโโ :
โโโโโ โโโโโโโโโ โโโโโ
State Representation
0.7071|00โฉ + 0.7071|11โฉ
Bloch Sphere Coordinates
Coordinates: (0.8660, 0.0000, 0.5000)
Angles: ฯ = 0.00ยฐ, ฮธ = 60.00ยฐ
๐ License
This project is distributed under the MIT License. See the LICENSE file for details.
๐ฌ Feedback
If you have questions or suggestions, email us at: arimshcherbakov@gmail.com
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ariquantum-0.1.0.tar.gz.
File metadata
- Download URL: ariquantum-0.1.0.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
289aafda4494d84bf2aa81b474cf41cb93a0d744ef5624556f5a18cd13b998a7
|
|
| MD5 |
7bf496afd234c61111b22cdb7aa29839
|
|
| BLAKE2b-256 |
2678c29bdafa8319a909e215756ac2baa61af3aa81747d74036bb59f6104ffe1
|
File details
Details for the file ariquantum-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ariquantum-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc5279f6b450bc6e1b8a130d59788f0ac95a84b1672c12cc2cbc977032741f17
|
|
| MD5 |
cd5dee43c6450969a46d725ba24b2ba7
|
|
| BLAKE2b-256 |
b3d699e22b9d4f4507a5c85749f65998069fc6a52de7043b8c32f9b3199bb652
|