Skip to main content

Double-Bracket Algorithmic Cooling (dbac) package

Code accompanying the paper Double-Bracket Algorithmic Cooling (M. Alghadeer, K. U. Giang, S. Cao, S. D. Fasciati, M. Piscitelli, N. Ng, P. J. Leek, M. Gluza, M. Bakr).

Background

Algorithmic cooling lowers the entropy of a qubit using only local operations and a "colder" ancilla, and is the basis of established techniques like heat-bath algorithmic cooling (HBAC). This paper introduces double-bracket algorithmic cooling (DBAC), which instead removes coherence from an already-pure qubit state, extending algorithmic cooling from a thermodynamic (entropy) notion of cooling to a genuinely quantum one.

DBAC simulates quantum imaginary-time evolution (QITE) by recursively synthesizing unitaries that implement Riemannian steepest-descent ("double-bracket") flows towards the ground state, one small step at a time. Each step needs an extra copy of the current state to act as a quantum instruction: that copy is consumed via density matrix exponentiation (DME), a protocol that uses repeated partial SWAPs to approximate the unitary $e^{-it\rho}$ generated by a state $\rho$, without ever synthesizing $\rho$ as a gate. Because the resulting circuit does not depend on the input state and needs no measurements or feedback, cooling performance is governed entirely by how many quantum instructions (copies of the state) are available -- a trade-off the paper relates to the Nernst principle ("cooling to absolute zero costs infinite resources").

Repository layout

src/dbac/          Physics and numerics: DME, DB-QITE/GCI recursion, HBAC, state utilities.
src/dbac/plotting/ All plotting code, factored out of the physics and shared across scripts/notebooks.
scripts/           The three DBAC scripts (computation + plotting), runnable standalone.
notebooks/ Narrated walkthroughs that call scripts/ and dbac.plotting and explain the physics.
figures/           All generated figures (PDF).
docs/              Sphinx documentation (`pip install -e ".[docs]" && make -C docs html`).

src/dbac/ -- physics and numerics (no plotting)

File Contents
dme.py Density matrix exponentiation: exact (dme_expm), SWAP+numpy (dme_channel), analytical equivalent (dme_channel_equivalent), and qibo-circuit (dme_qibo) implementations.
dbqite.py A single-qubit DB-QITE step built on top of Trotterized DME (QITE_GCI_dme) or on the exact unitary (ideal_DME).
gci.py GCI: runs and tracks a DB-QITE/"group commutator iteration" recursion (energy, fidelity, states) for a fixed number of steps or by greedily picking the best step size at each round.
hbac.py Heat-bath algorithmic cooling (reset + compress), the classical baseline DBAC is compared against.
utils.py Shared helpers: fidelity with the ground state, depolarizing noise, thermal states, the $R_X(\theta)$ initial-state sweep used throughout.

src/dbac/plotting/ -- all plotting

File Contents
style.py Shared journal figure sizes and matplotlib rcParams.
bloch.py Bloch-sphere rendering of single-qubit states and DB-QITE recursion trajectories.
ptm.py Pauli-transfer-matrix heatmaps and a hue/size process-matrix plot.
gci.py Energy/fidelity vs. evolution-duration plots for GCI.execute_gci output.
cooling.py The cooling-performance figures: fidelity-fidelity plots, energy-vs-$\theta$ plots, grid layouts, and the ideal-DME summary figure.
dme.py DME-channel-implementation benchmark plots.

scripts/ -- one script per result, runnable from the command line

The three DBAC scripts do the computation (calling into dbac), calls dbac.plotting to plot it, and saves the resulting figures to figures/:

pip install -e .
python scripts/sup_figure_S2.py      # DME channel implementation benchmark
python scripts/sup_figure_S4.py       # DBAC with ideal (M -> infinity) DME, sweep over k
python scripts/figure_4.py           # Main result: cooling vs. number of quantum instructions (Fig. 4)
python scripts/sup_figure_S5.py       # Bloch-sphere illustration of the DBAC recursion

notebooks/ -- narrated walkthroughs

Notebook Figure(s) What it shows
dme_ptm_plot.ipynb ptm_*.pdf Pauli-transfer-matrix view of the ideal $ZZ$ interaction, the DME unitary, and the two hardware circuits (A, B).
hbac.ipynb hbac_3_qubits.pdf Heat-bath algorithmic cooling baseline on a 3-qubit chain, pure vs. depolarized input.
sup_figure_S4.ipynb S4_QITE_ideal_DME_merged.pdf (Fig. 7) DBAC in the ideal-DME limit, sweeping the recursion depth $k$.
docs/index.ipynb F4_*.pdf (Fig. 4) Main result (also the front page of the docs): Trotterized-DME DBAC cooling performance vs. number of quantum instructions, compared to hardware experiment data.

notebooks/not_in_use/ holds earlier exploratory notebooks kept for reference; they are not part of the maintained code path.

Setup

python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[notebooks]"
jupyter notebook notebooks/

Figures that use LaTeX-rendered labels require a local LaTeX installation (matplotlib's text.usetex); without one, either install texlive or disable it via dbac.plotting.use_paper_style(use_tex=False).

Citation

If you use this code, please cite:

@article{alghadeer2025dbac,
  title   = {Double-Bracket Algorithmic Cooling},
  author  = {Alghadeer, Mohammed and Giang, Khanh Uyen and Cao, Shuxiang and
             Fasciati, Simone D. and Piscitelli, Michele and Ng, Nelly and
             Leek, Peter J. and Gluza, Marek and Bakr, Mustafa},
  journal = {arXiv preprint arXiv:2510.00302},
  year    = {2025}
}

Notebooks only save their plots when SAVE_PLOTS = True in notebooks/config.py (off by default); PDFs then go to figures/.

Metadata

Release files for dbac 0.1.0

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

Source distribution (sdist)

Source distribution for dbac 0.1.0
File Size Uploaded Provenance
dbac-0.1.0.tar.gz 1.5 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dbac 0.1.0
File Interpreter ABI Platform
dbac-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / dbac-0.1.0.tar.gz

Download URL dbac-0.1.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
af04949f515449d9aece37b90740d48867ad11df99800ce2a347919162a74804
BLAKE2b-256 checksum
How to use checksums
a76ee03e0a79434184265eb0b507bcf653e541ff2076e303008d7bc85b60353c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / dbac-0.1.0-py3-none-any.whl

Download URL dbac-0.1.0-py3-none-any.whl
Size 31.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7363f46e2865425def6982d1bce74bf1f785d491865ab403a591975332217c45
BLAKE2b-256 checksum
How to use checksums
64bdb7432069329cdd767c67528a9bc8134ae18277171879e38709228d0f0396
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for dbac 0.1.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dbac-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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