Skip to main content

Qiskit Spacetime Bridge

Outcome-code and spacetime-code construction for Qiskit Clifford circuits, implementing Algorithm 1 and the back-cumulant construction (Section 5.1) from Delfosse & Paetznick, "Spacetime codes of Clifford circuits" (arXiv:2304.05943).

Install

pip install -e .

Depends on qiskit>=2.0,<3 and numpy. Confirmed installing and running correctly from a built wheel in a clean virtualenv (not just from source).

Usage

from qiskit import QuantumCircuit
from spacetime_bridge import Circuit, analyze

qc = QuantumCircuit(2, 2)
qc.measure(0, 0)
qc.measure(1, 1)
qc.cx(0, 1)
qc.measure(1, 1)   # redundant: forced to equal the XOR of the first two

circuit = Circuit.from_qiskit_circuit(qc)
checks, depth = circuit.finalize()
generators = [circuit.build_spacetime_generator(tag) for (_, tag) in checks]
analyze(generators)

Supported instructions: h, s, sdg, cx, measure (Z-basis, as standard for Qiskit). Anything else raises NotImplementedError rather than silently mishandling it.

What's implemented and validated

  • algorithm1.py — Algorithm 1 (outcome code), augmented stabilizer tableau with sign-only phase tracking (justified in-module). 7 tests including two specifically stressing sign correctness.
  • spacetime.py — back-cumulant construction (Section 5.1) turning each outcome-code check into a spacetime stabilizer generator. One test case independently hand-verified against the paper's closed-form formula (Proposition 2), separately from the iterative code.
  • Circuit.from_qiskit_circuit — real integration with qiskit.QuantumCircuit (not a standalone reimplementation with a Qiskit-flavored API). Validated against a real Qiskit circuit reproducing the hand-verified CNOT case.
  • analysis.py — symplectic matrix conversion, [[N,K]] parameters (Theorem 2), pairwise-commutativity sanity check.
  • Full test suite re-verified against the actual built wheel installed in a clean virtualenv, not just against local source files.

What's explicitly NOT implemented (honest scope limits)

  • No CZ or SWAP gate rules — same pattern as H/S/CNOT to add.
  • No Algorithm 3 (LDPC sparsification) or logical operators (Proposition 10) — the harder phase-2 work; not started.
  • No code distance or distance bound anywhere — distance requires logical operators; a generator's weight is not a valid stand-in, and analyze() explicitly does not report one.
  • One level per instruction, not true parallel scheduling — always correct, but produces larger/non-minimal spacetime codes than an optimally-scheduled circuit would. Improving this is a performance concern, not correctness.
  • analysis.py is a generic, package-agnostic implementation — not wired into qiskit-cayley-codes' actual CDZ analysis code (that source wasn't available in the session this was built in). to_symplectic_matrix()'s output is the standard stabilizer-matrix format and should drop in directly once that wiring happens.

Running the tests

pip install -e ".[test]"
pytest tests/

All currently pass.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qiskit_spacetime_bridge-0.1.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qiskit_spacetime_bridge-0.1.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file qiskit_spacetime_bridge-0.1.0.tar.gz.

File metadata

  • Download URL: qiskit_spacetime_bridge-0.1.0.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.1

File hashes

Hashes for qiskit_spacetime_bridge-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b98b06d5957110bb2edacf16d4203b8babe6a8cb65f38a8bd9a3c892d6e08982
MD5 96f52571a85bd3fbccc758465160d7a1
BLAKE2b-256 b357e28aafee1577d0765c8a50d9a88936f1f854f61e9fb1979cd1a6cd5c0919

See more details on using hashes here.

File details

Details for the file qiskit_spacetime_bridge-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for qiskit_spacetime_bridge-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35a94efcd8c83b7e8ef6eea2de0f15f60784c8d8fa58c4228e685cc601559536
MD5 ced71cee44e17600ed43f0a055cd9a19
BLAKE2b-256 847ddbd544ade04d28fa668ac13ef62965d6f7c09eb49ccced6f37580370b4ec

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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