DeepQuantum for quantum computing
Project description
DeepQuantum
DeepQuantum is a platform that integrates artificial intelligence (AI) and quantum computing (QC). It is an efficient programming framework designed for quantum machine learning and photonic quantum computing. By leveraging the PyTorch deep learning platform for QC, DeepQuantum provides a powerful and easy-to-use tool for creating and simulating quantum circuits and photonic quantum circuits. This makes it ideal for developers to quickly get started and explore the field in depth. It also serves as a valuable learning platform for quantum computing enthusiasts.
Key Features
- AI-Enhanced Quantum Computing Framework: Seamlessly integrated with PyTorch, it utilizes technologies such as automatic differentiation, vectorized parallelism, and GPU acceleration for efficiency. It facilitates the easy construction of hybrid quantum-classical models, enabling end-to-end training and inference.
- User-Friendly API Design: The API is designed to be simple and intuitive, making it easy to initialize quantum neural networks and providing flexibility in data encoding.
- Photonic Quantum Computing Simulation: The Photonic module includes both Fock and Gaussian backends, catering to different simulation needs in photonic quantum computing. It comes with built-in optimizers to support on-chip training of photonic quantum circuits.
- Large-Scale Quantum Circuit Simulation: Based on tensor networks, it enables the simulation of 100+ qubits on a laptop, leading the industry in both simulation efficiency and scale.
Installation
Before installing DeepQuantum, we recommend first manually installing PyTorch 2. If the latest version of PyTorch is not compatible with your CUDA version, manually install a compatible PyTorch 2 version.
The PyTorch installation instructions currently recommend:
- Install Miniconda or Anaconda.
- Setup conda environment. For example, run
conda create -n <ENV_NAME> python=3.10
andconda activate <ENV_NAME>
. - Install PyTorch following the PyTorch installation instructions.
Currently, this suggests running
conda install pytorch -c pytorch
.
If you want to customize your installation, please follow the PyTorch installation instructions to build from source.
To install DeepQuantum with pip
, run
pip install deepquantum
# or for developers
pip install deepquantum[dev]
# or use tsinghua source
pip install deepquantum -i https://pypi.tuna.tsinghua.edu.cn/simple
Alternatively, to install DeepQuantum from source, run
git clone https://github.com/TuringQ/deepquantum.git
cd deepquantum
pip install -e .
# or use tsinghua source
pip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple
Getting Started
To begin, please start with the tutorial on basics.
Below are some minimal demos to help you get started.
- Quantum circuit
import deepquantum as dq
cir = dq.QubitCircuit(2)
cir.h(0)
cir.cnot(0, 1)
cir.rx(1, 0.2)
cir.observable(0)
print(cir())
print(cir.expectation())
- Quantum circuit based on matrix product state
You can simply set mps=True
in QubitCircuit
and adjust the bond dimension chi
to control the complexity.
cir = dq.QubitCircuit(2, mps=True, chi=4)
cir.h(0)
cir.cnot(0, 1)
cir.rx(1, 0.2)
cir.observable(0)
print(cir())
print(cir.expectation())
- Photonic quantum circuit with the Fock backend, based on Fock basis state
cir = dq.QumodeCircuit(2, [1,1])
cir.dc([0,1])
cir.ps(0, 0.1)
cir.bs([0,1], [0.2,0.3])
print(cir())
print(cir.measure())
- Photonic quantum circuit with the Fock backend, based on Fock state tensor
cir = dq.QumodeCircuit(2, [(1, [1,1])], basis=False)
cir.dc([0,1])
cir.ps(0, 0.1)
cir.bs([0,1], [0.2,0.3])
print(cir())
print(cir.measure())
- Photonic quantum circuit with the Gaussian backend
cir = dq.QumodeCircuit(2, 'vac', cutoff=10, backend='gaussian')
cir.s(0, 0.1)
cir.d(1, 0.1)
cir.bs([0,1], [0.2,0.3])
print(cir())
print(cir.measure())
print(cir.photon_number_mean_var(wires=0))
print(cir.measure_homodyne(wires=1))
License
DeepQuantum is open source, released under the Apache License, Version 2.0.
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
Built Distribution
File details
Details for the file deepquantum-3.3.1.tar.gz
.
File metadata
- Download URL: deepquantum-3.3.1.tar.gz
- Upload date:
- Size: 149.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5934306c61d5bd2d14f6a41d47ed397a2dcedab39454370331b5991663b7765f |
|
MD5 | dcbe725407b37119d8f502e56a7f8bdb |
|
BLAKE2b-256 | 06ee30fbedf749f382d8ba5647de135a8fcac3cf63e10e19d0d8231ccb1f7545 |
File details
Details for the file deepquantum-3.3.1-py3-none-any.whl
.
File metadata
- Download URL: deepquantum-3.3.1-py3-none-any.whl
- Upload date:
- Size: 156.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6efffe8dfd09185e09ac073c205531ee3cdbc26b92c85149469cba680545d45d |
|
MD5 | 3f92883d65d9f196cf7ea0e6dfbc277b |
|
BLAKE2b-256 | df9bc8995da7ea83c01ea5405c544933542e0781fa176099cece507a93af7661 |