Skip to main content

DOI

SQUANDER Logo

Sequential Quantum Gate Decomposer (SQUANDER)

A High-Performance C++/Python Library for Quantum Circuit Decomposition and Optimization

Installation • Documentation • Features • Citation


Overview

The Sequential Quantum Gate Decomposer (SQUANDER) is a state-of-the-art computational library designed for training parametric quantum circuits and performing quantum gate synthesis. SQUANDER provides a comprehensive Python interface that enables researchers and developers to conduct advanced numerical experiments in quantum computing, including quantum gate synthesis, variational quantum eigensolver (VQE) applications, and quantum state preparation.

Key Capabilities

SQUANDER excels in decomposing n-qubit unitaries into sequences of one-qubit rotations and two-qubit controlled gates using advanced synthesis methods. The library leverages a high-performance parallel C/C++ framework with gate fusion and vectorized AVX gate kernels, delivering exceptional computational efficiency for quantum circuit simulations.

Optimization Techniques

Beyond conventional gradient-based optimizers (gradient descent, ADAM, and BFGS), SQUANDER incorporates an innovative gradient-free optimization technique that demonstrates robust numerical behavior and is particularly effective in circumventing barren plateaus—a common challenge in quantum circuit training. The library's handcrafted optimization strategies are specifically designed to accommodate the periodicity inherent in quantum optimization landscapes, ensuring resilient numerical efficiency.


Installation

SQUANDER is available as pre-built Python wheels for Windows, Linux, and macOS, making installation straightforward for most users. The package can be installed directly from the Python Package Index (PyPI):

pip install squander

System Requirements

  • Python: 3.10 or higher (tested with Python 3.10-3.13)
  • Operating Systems: Windows, Linux, macOS

Python Dependencies

The following packages are automatically installed as dependencies:


Development Installation

For developers who wish to build SQUANDER from source or contribute to the project, the following development installation instructions are provided.

Prerequisites

The following dependencies are required to compile and build SQUANDER from source:

Build Tools

Libraries

Optional Tools

  • Doxygen (for generating documentation)
  • Ninja (speeds up compilation)

Development Build on Unix/Linux/macOS

1. Clone the Repository

git clone https://github.com/rakytap/sequential-quantum-gate-decomposer.git
cd sequential-quantum-gate-decomposer

2. Set Up Environment Variables (if needed)

If TBB is installed at a non-standard location or using GNU compiler:

export TBB_LIB_DIR=path/to/TBB/lib(64)
export TBB_INC_DIR=path/to/TBB/include

Note: When TBB is installed via the tbb-devel Python package, these environment variables are not necessary.

3. Build from Source

The SQUANDER package uses a Python build script (setup.py) that automatically detects the CBLAS library used by NumPy and configures CMake accordingly:

python3 setup.py build_ext

This command compiles the SQUANDER C++ library and builds the Python interface extensions in place.

4. Install in Development Mode

After a successful build, install the package in editable (development) mode:

python -m pip install -e .

We recommend using Anaconda/Miniconda for development environments:

1. Create Environment from Configuration File

conda env create -f conda_env_example.yaml

2. Activate Environment

conda activate qgd

3. Build and Install

python3 setup.py build_ext
python -m pip install -e .

Development Build on Windows

Prerequisites

  • CMake must be in the system PATH
  • Microsoft Visual C++ compiler

Build Steps

set PATH=%PATH%;C:\Program Files\cmake\bin

set TBB_LOCATION=<Python_Folder>/LocalCache/local-packages
set TBB_INC_DIR=%TBB_LOCATION%/Library/include
set TBB_LIB_DIR=%TBB_LOCATION%/Library/lib
set LIB=<BLAS_Location>/lib;<LAPACK_Location>/lib

python setup.py build_ext -DTBB_HEADER=<TBB_Location>\Library\include\

Install DLL Files

Copy required DLL files to the package directory:

copy "%TBB_LOCATION%\Library\bin\tbb12.dll" .\squander\decomposition
copy "%TBB_LOCATION%\Library\bin\tbbmalloc.dll" .\squander\decomposition

Verify Installation

python -m pytest

Building Distribution Packages

Binary Wheel Distribution

To build a wheel binary for distribution:

python3 setup.py bdist_wheel

The wheel will be created in the dist/ directory. Note that the created wheel is not portable, as it contains hard-coded links to external libraries (TBB and CBLAS).

Source Distribution

To create a portable source distribution:

python3 setup.py sdist

The source distribution tarball will be created in the dist/ directory.


Features

SQUANDER provides a comprehensive suite of tools for quantum circuit manipulation and optimization:

Core Functionality

  • Unitary Decomposition: Decompose unitaries into quantum circuits using multiple methods:

    • Standard decomposition (N_Qubit_Decomposition)
    • Adaptive decomposition with circuit compression (N_Qubit_Decomposition_adaptive)
    • Custom topology decomposition (N_Qubit_Decomposition_custom)
    • Tree search decomposition (N_Qubit_Decomposition_Tree_Search)
    • Tabu search decomposition (N_Qubit_Decomposition_Tabu_Search)
  • Circuit Optimization: Optimize wide quantum circuits using the Wide_Circuit_Optimization class

  • State Preparation: Prepare quantum states via adaptive state preparation (N_Qubit_State_Preparation_adaptive)

  • Variational Quantum Algorithms:

    • Variational Quantum Eigensolver (VQE) (Variational_Quantum_Eigensolver)
    • Generative Quantum Machine Learning (GQML) (Generative_Quantum_Machine_Learning)
  • Circuit Simulation: High-performance state vector evolution for quantum circuit simulation

  • Circuit Synthesis: SABRE algorithm for qubit routing and mapping

  • Circuit Partitioning: Partition large circuits for efficient decomposition and optimization

  • Qiskit Integration: Seamless integration with Qiskit through the Qiskit_IO module


Python Interface

SQUANDER exposes its C++ functionality through a comprehensive Python interface. The main modules include:

Module Description
squander.decomposition Quantum gate decomposition classes for decomposing unitaries and preparing quantum states
squander.gates Quantum gate implementations and circuit building blocks (CNOT, H, RX, RY, RZ, and custom gates)
squander.VQA Classes for VQE and generative quantum machine learning algorithms
squander.synthesis Circuit synthesis tools including SABRE algorithm for qubit routing and mapping
squander.partitioning Circuit partitioning utilities for breaking down large circuits into manageable sub-circuits
squander.IO_interfaces Input/output interfaces including Qiskit integration (Qiskit_IO)
squander.utils Utility functions for working with quantum circuits and unitaries
squander.nn Experimental neural network interface for quantum machine learning

Example Usage

Comprehensive examples demonstrating SQUANDER's capabilities are available in the examples/ directory:

  • examples/decomposition/: Examples of unitary decomposition with various methods
  • examples/VQE/: Variational quantum eigensolver examples
  • examples/state_preparation/: Quantum state preparation examples
  • examples/simulation/: Quantum circuit simulation benchmarks
  • examples/partitioning/: Circuit partitioning examples

Additional usage patterns and test cases can be found in the tests/ directory.


Documentation

Comprehensive documentation for the SQUANDER package is available at:

CodeDocs[xyz]


Citation

If you use SQUANDER in your research, please cite the following publications:

[1] Péter Rakyta, Zoltán Zimborás, Approaching the theoretical limit in quantum gate decomposition, Quantum 6, 710 (2022).
[2] Péter Rakyta, Zoltán Zimborás, Efficient quantum gate decomposition via adaptive circuit compression, arXiv:2203.04426.
[3] Peter Rakyta, Gregory Morse, Jakab Nádori, Zita Majnay-Takács, Oskar Mencer, Zoltán Zimborás, Highly optimized quantum circuits synthesized via data-flow engines, Journal of Computational Physics 500, 112756 (2024).
[4] Jakab Nádori, Gregory Morse, Barna Fülöp Villám, Zita Majnay-Takács, Zoltán Zimborás, Péter Rakyta, Batched Line Search Strategy for Navigating through Barren Plateaus in Quantum Circuit Training, Quantum 9, 1841 (2025).


Posters and Conference Presentations

  • Conference talk. Péter Rakyta. Efficient quantum gate decomposition via adaptive circuit compression. GPU Day 2022 - Massive parallel computing for science and industrial application. June 21, 2022, 10:10-10:40. https://gpuday.com/gpu-day-2022
  • Conference talk. Péter Rakyta. Simulation of quantum computers on tensor streaming processors. GPU Day 2023. Budapest, Hungary, May 15-16, 2023. https://gpuday.com/gpu-day-2023
  • Conference talk (QCW track). Gregory Morse, Peter Rakyta, Tamás Kozsik. Simulation of quantum computers on tensor streaming processors. ICCS 2023 (International Conference on Computational Science), Quantum Computing Workshop (QCW), Prague, Czech Republic. July 3, 2023, 17:40. Program link: https://easychair.org/smart-program/ICCS2023/2023-07-03.html#talk:223488
  • Workshop talk. Péter Rakyta. SQUANDER: a classical framework to train quantum circuits. Workshop on Methods and Applications of Quantum Computing with Light and Qubits. Faculty of Nuclear Sciences and Physical Engineering, B-111, Brehova 7, Prague. October 17, 2023, 14:45-15:30. https://indico.fjfi.cvut.cz/event/269/contributions/4309/
  • Conference talk. Péter Rakyta. Batched Line Search Strategy for Navigating through Barren Plateaus in Quantum Circuit Training. GPU Day 2025 - Massive parallel computing for science and industrial application. HUN-REN Centre, Budapest. May 22, 2025, 12:00-12:30. https://gpuday.com/gpu-day-2025
  • Poster session. Muhammad Al Farizi, Gregory Morse, Jakab Nádori, László Hajas, Péter Rakyta. Scalable Quantum Circuit Design: Partitioning and Optimization Strategies. Quantum Informatics National Laboratory Workshop 2025. Bosch Budapest Innovation Campus, June 5, 2025, 16:30-18:30. https://qi.nemzetilabor.hu/events/quantum-information-national-laboratory-workshop-2025
  • Invited lecturer. Gregory Morse. Scalable Globally Optimal Partitioning of Quantum Circuits. Lectures on Modern Scientific Programming 2025, HUN-REN Wigner RCP. November 25, 2025, 9:20-10:30 lecture and 14:00-15:30 hands-on session. https://indico.wigner.hu/event/1709/
  • Poster session. Zoltán Kégli, Gregory Morse, Jakab Nádori, Barna Fülöp Villám, Muhammad Al Farizi, Tamás Kozsik, Péter Rakyta. SQUANDER: a classical technique to train quantum circuits. The 13th International Conference on Applied Informatics (ICAI2026). Eszterházy Károly Catholic University, Eger, February 20, 2026, 10:15-11:15. https://icai.uni-eszterhazy.hu/2026/program/

Acknowledgments

This project was supported by:

  • Grant OTKA PD123927
  • The Ministry of Innovation and Technology and the National Research, Development and Innovation Office within the Quantum Information National Laboratory of Hungary

Contact

For questions, support, or collaboration inquiries, please contact:


License

SQUANDER is licensed under the Apache License 2.0. See the LICENSE file for details.

Metadata

Release files for squander 1.9.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for squander 1.9.7
File Actions
squander-1.9.7-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for squander-1.9.7-cp313-cp313-win_amd64.whl
squander-1.9.7-cp313-cp313-macosx_26_0_arm64.whl CPython 3.13 CPython 3.13 macOS 26.0+ ARM64 Details for squander-1.9.7-cp313-cp313-macosx_26_0_arm64.whl
squander-1.9.7-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for squander-1.9.7-cp312-cp312-win_amd64.whl
squander-1.9.7-cp312-cp312-macosx_26_0_arm64.whl CPython 3.12 CPython 3.12 macOS 26.0+ ARM64 Details for squander-1.9.7-cp312-cp312-macosx_26_0_arm64.whl
squander-1.9.7-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for squander-1.9.7-cp311-cp311-win_amd64.whl
squander-1.9.7-cp311-cp311-macosx_26_0_arm64.whl CPython 3.11 CPython 3.11 macOS 26.0+ ARM64 Details for squander-1.9.7-cp311-cp311-macosx_26_0_arm64.whl
squander-1.9.7-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for squander-1.9.7-cp310-cp310-win_amd64.whl
squander-1.9.7-cp310-cp310-macosx_26_0_arm64.whl CPython 3.10 CPython 3.10 macOS 26.0+ ARM64 Details for squander-1.9.7-cp310-cp310-macosx_26_0_arm64.whl

Total release size: 88.9 MB

Release files / squander-1.9.7-cp313-cp313-win_amd64.whl

Download URL squander-1.9.7-cp313-cp313-win_amd64.whl
Size 12.0 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
89bb608d08e285c8f2dfbfecdf7902d242aaf4e6f606b2fbb7841dc3de07f33c
BLAKE2b-256 checksum
How to use checksums
b26d07a578e69115c7de8feb339fb7f9c61cb7407ad6ab1b9807e02a6489ffe6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / squander-1.9.7-cp313-cp313-macosx_26_0_arm64.whl

Download URL squander-1.9.7-cp313-cp313-macosx_26_0_arm64.whl
Size 10.2 MB
Tags CPython 3.13 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
25580c27d41c7a36757e9f5f9e9adfb64000b051048b1b03cebdfece32080f7c
BLAKE2b-256 checksum
How to use checksums
37cfa60437151068fd98109bf6c913642cac0ba21489cc72f5339aa12f896ac8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / squander-1.9.7-cp312-cp312-win_amd64.whl

Download URL squander-1.9.7-cp312-cp312-win_amd64.whl
Size 12.0 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
2b7a9eeb4bea75ebbea3b9222c62bfbc328985ae5dd0c9f200606ca49ae0fd87
BLAKE2b-256 checksum
How to use checksums
7e2bbf2a45b1fd928e0e5422dfdcc0a8da9162a258bcd65fa23de5131722addc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / squander-1.9.7-cp312-cp312-macosx_26_0_arm64.whl

Download URL squander-1.9.7-cp312-cp312-macosx_26_0_arm64.whl
Size 10.2 MB
Tags CPython 3.12 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
252ea7b2451a9438a069fd97bd819bdc3a09895f6173e26b9a63f4e99c8bf466
BLAKE2b-256 checksum
How to use checksums
6a111d81f81673e6044d6802e18fbdac117b89460c97dc32da10f79cd0cb8cc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / squander-1.9.7-cp311-cp311-win_amd64.whl

Download URL squander-1.9.7-cp311-cp311-win_amd64.whl
Size 12.0 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
e7839e174841b2918bb3ee084dc8b071019473ae5b8979affdfa9d0f0852b4c9
BLAKE2b-256 checksum
How to use checksums
f87e256de99d762dee0d2dd5587f8e5bc652cebde1a3d990ef31be67b111cf97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / squander-1.9.7-cp311-cp311-macosx_26_0_arm64.whl

Download URL squander-1.9.7-cp311-cp311-macosx_26_0_arm64.whl
Size 10.2 MB
Tags CPython 3.11 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
31eaeba0e487380f4d813bd549d60676288428f95a0bfc78932fd13e15a1eda0
BLAKE2b-256 checksum
How to use checksums
2f809b96241c7ef0ba2da57dcf094ca5448a090ed8734e8ff3f2a78132425416
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / squander-1.9.7-cp310-cp310-win_amd64.whl

Download URL squander-1.9.7-cp310-cp310-win_amd64.whl
Size 12.0 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
43c46da0019a714943f746176e0cc530c1f9d829f3011f6e678a9ee6d3ed1782
BLAKE2b-256 checksum
How to use checksums
c74d01cbd0be188bc2bd667e6a7dbdc06602cf35e30c4b389c1391236165ffe7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / squander-1.9.7-cp310-cp310-macosx_26_0_arm64.whl

Download URL squander-1.9.7-cp310-cp310-macosx_26_0_arm64.whl
Size 10.2 MB
Tags CPython 3.10 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
6071dd457984612e985c5d87faa1204b62a8cabf55198900772a079daa185191
BLAKE2b-256 checksum
How to use checksums
c162bf3327fcd88a2fa478d64e0e8b68bbf309f6a3e34f1751ff28218102c3f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Security for squander 1.9.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page