QANDLE is a fast and simple quantum state-vector simulator for hybrid machine learning using the PyTorch library.
Project description
QANDLE
QANDLE is a fast and simple quantum state-vector simulator for hybrid machine learning using the PyTorch library. Documentation and examples can be found in the QANDLE documentation.
Installation
pip install qandle
Usage
import torch
import qandle
# Create a quantum circuit
circuit = qandle.Circuit(
layers=[
# embedding layer
qandle.AngleEmbedding(num_qubits=2),
# trainable layer, with random initialization
qandle.RX(qubit=1),
# trainable layer, with fixed initialization
qandle.RY(qubit=0, theta=torch.tensor(0.2)),
# data reuploading
qandle.RX(qubit=0, name="data_reuploading"),
# disable quantum weight remapping
qandle.RY(qubit=1, remapping=None),
qandle.CNOT(control=0, target=1),
qandle.MeasureProbability(),
]
)
input_state = torch.rand(circuit.num_qubits, dtype=torch.float) # random input
data_reuploading = torch.rand(1, dtype=torch.float) # random data reuploading input
# Run the circuit
circuit(input_state, data_reuploading=data_reuploading)
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
qandle-0.0.2.tar.gz
(23.0 kB
view hashes)
Built Distribution
qandle-0.0.2-py3-none-any.whl
(31.5 kB
view hashes)