A quantum computing library
Project description
Quanthon
A minimal Python library for quantum computing, for physicists!
Installation
Using PIP:
pip3 install Quanthon
Get Started
Importing the Module
import Quanthon as qt
Initializing a Single Qubit
Initialize a single qubit by creating an instance of the Qubits
class.
qubit = qt.Qubits(1)
Applying Quantum Gates
Quanthon
supports various quantum gates like the Hadamard (H), Pauli-X (X), Pauli-Y (Y), and Pauli-Z (Z) gates.
# Apply a Hadamard gate on the first qubit
qubit.H(0)
# Apply a Pauli-X gate on the first qubit
qubit.X(0)
# Apply a Pauli-Y gate on the first qubit
qubit.Y(0)
# Apply a Pauli-Z gate on the first qubit
qubit.Z(0)
Performing Quantum Measurements
You can perform quantum measurements on your qubit system with a specific number of shots.
result = qubit.measure(n_shots=10)
Working with Multiple Qubits
Use the Qubits
class for all states.
from Quanthon import Qubits
# Initialize a 2-qubit system
two_qubits = Qubits(2)
# Initialize an n-qubit system
n = 4
n_qubits = Qubits(n)
CNOT and SWAP Operations for Multiple Qubits
Quanthon
allows you to perform CNOT and SWAP operations on multi-qubit systems.
# Perform a CNOT operation between the first and second qubit
two_qubits.CONT(0, 1)
two_qubits.SWAP(0, 1)
New in 0.3.6:
Added pauli_decomposition for matrices of size $2^n \times 2^n$.
from Quanthon import pauli_decomposition
Previous Version Releases
0.3.5:
- VQE now supports non-Hermitian 'Hamiltonians', but why would you ever need it?
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
quanthon-0.3.7.20.tar.gz
(26.1 kB
view hashes)
Built Distribution
Close
Hashes for Quanthon-0.3.7.20-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8862307961487f9914f7647f5abeeea12a4a66ca8392eda9b3f8db5fcc9f211 |
|
MD5 | 0e4d1e06d1d802a4a69b731290251e1d |
|
BLAKE2b-256 | 968a49296325c6661d5061d123d25b93fe98f3da40a07247bde4f9ce96b4eba0 |