Code
qcr:2606.10938.1

Two-Qubit Gate Compilation

Compiling an arbitrary two-qubit gate into the limited native gate set of real hardware is a fundamental problem in quantum circuit compilation, since most devices provide only one fixed entangling interaction plus arbitrary single-qubit rotations. This Cirq example demonstrates an algorithm that solves it using the GateTabulation class, which approximates any desired two-qubit unitary as a short product of the form k3 A k2 A k1 A k0, where A is a fixed base two-qubit gate (here a square-root-of-iSWAP combined with a controlled phase) and the k_j are arbitrary single-qubit gates. The approach precomputes a tabulation, a dense sampling of the two-qubit gates reachable with a small number of applications of the base gate, so that compiling a new target gate reduces to looking up a nearby tabulated point and solving for the surrounding single-qubit rotations. The script builds the GateTabulation for the chosen base gate, generates a collection of one thousand random two-qubit gates, and compiles each of them, reporting how accurately the tabulation-based decomposition reproduces the targets. It is a practical demonstration of how a hardware-native entangling gate, interleaved with single-qubit rotations, can synthesize the full continuum of two-qubit operations, a core capability for any quantum compiler.
Compilation
Qubit
Circuit-based
Uploaded 3 days ago
9
Views
GitHub4990
Citing this entry? Use this QCR ID
Uploaded by
QL
QCR Librarian

Overview

quantumlib/Cirq
49901228
README.md

Two-Qubit Gate Compilation

Compiling an arbitrary two-qubit gate into the limited native gate set of real hardware is a fundamental problem in quantum circuit compilation, since most devices provide only one fixed entangling interaction plus arbitrary single-qubit rotations. This Cirq example demonstrates an algorithm that solves it using the GateTabulation class, which approximates any desired two-qubit unitary as a short product of the form k3 A k2 A k1 A k0, where A is a fixed base two-qubit gate (here a square-root-of-iSWAP combined with a controlled phase) and the k_j are arbitrary single-qubit gates. The approach precomputes a tabulation, a dense sampling of the two-qubit gates reachable with a small number of applications of the base gate, so that compiling a new target gate reduces to looking up a nearby tabulated point and solving for the surrounding single-qubit rotations. The script builds the GateTabulation for the chosen base gate, generates a collection of one thousand random two-qubit gates, and compiles each of them, reporting how accurately the tabulation-based decomposition reproduces the targets. It is a practical demonstration of how a hardware-native entangling gate, interleaved with single-qubit rotations, can synthesize the full continuum of two-qubit operations, a core capability for any quantum compiler.

Run it

pip install -r requirements.txt
python two_qubit_gate_compilation.py

Source and license

Imported from examples/two_qubit_gate_compilation.py in quantumlib/Cirq at v1.6.1, under the Apache License 2.0. Original authors: The Cirq Developers. The upstream LICENSE is included alongside this example.

Join the Discussion

Comments (0)

No comments yet. Be the first to share your thoughts!

Indexed by QCR Librarian

This entry was created automatically from publicly available records. QCR links to public sources and only stores repository content where the license permits redistribution.

Versions

v1 Latest
Jun 16, 2026
qcr:2606.10938.1

Cite all versions? Use the base QCR ID to always reference the latest version of this entry.

Tools used

Cirq

Keywords

gate-compilation
two-qubit-gates
synthesis
iswap
tabulation

You may also like5