QuForge is a Python-based quantum simulator designed for qudits, extending quantum computing capabilities beyond traditional qubits. It facilitates the simulation of quantum circuits with customizable qudit dimensions, supporting both dense and sparse operations for efficient computation. Built on the differentiable framework PyTorch, QuForge enables execution on accelerating devices such as GPUs and TPUs, enhancing simulation speed.
For detailed documentation, visit quforge.readthedocs.io.
Good news 🎉 Our paper was accepted in the Computer Physics Communications journal QuForge
Install QuForge using pip:
pip install quforgeTo install the latest version directly from the source:
# Clone the repository
git clone https://github.com/tiago939/QuForge.git
# Navigate to the project directory
cd QuForge
# Install the package
pip install .Ensure that your environment meets the necessary dependencies listed in requirements.txt.
Here's an example of how to create and execute a simple quantum circuit using QuForge:
import quforge.quforge as qf
# Initialize a 2-level (qubit) circuit with 2 wires
circuit = qf.Circuit(dim=2, wires=2)
# Add gates to the circuit
circuit.H(index=[0]) # Hadamard gate on wire 0
circuit.CNOT(index=[0, 1]) # CNOT gate with control wire 0 and target wire 1
# Initialize the state
state = qf.State('0-0', dim=2)
# Execute the circuit
result = circuit(state)
print(result)This script sets up a quantum circuit with a Hadamard gate and a CNOT gate, then executes it on an initial state.
The QuForge repository is organized as follows:
QuForge/
├── docs/ # Documentation files
├── examples/ # Example scripts demonstrating QuForge usage
├── quforge/ # Main source code for the QuForge library
│ ├── __init__.py # Initializes the quforge package
│ └── ... # Other source files
├── .gitignore # Specifies files and directories to ignore in Git
├── .readthedocs.yaml # Configuration for Read the Docs documentation hosting
├── LICENSE # License information (Apache-2.0)
├── README.md # Overview and instructions for the project
├── logo.png # QuForge logo image
├── requirements.txt # List of Python dependencies
└── setup.py # Installation script for the QuForge package- [] Improvements of statevector computation
- [] Add noise channels
- [] Improvements on sparsity support
- [] Add support for cuQuantum backend
We are continuously working on optimizing the library. Please reach out if you have any suggestions or questions!
If you use QuForge in your research, please cite our work:
@misc{2024quforge,
title = {QuForge: A library for qudits simulation},
journal = {Computer Physics Communications},
volume = {314},
pages = {109687},
year = {2025},
issn = {0010-4655},
doi = {https://doi.org/10.1016/j.cpc.2025.109687},
url = {https://www.sciencedirect.com/science/article/pii/S0010465525001894},
author = {Tiago {de Souza Farias} and Lucas Friedrich and Jonas Maziero}
}
