Skip to main content

clifft-cirq

clifft-cirq converts parameter-resolved qubit cirq.Circuit instances into Clifft circuit text and provides a small Cirq-style sampler facade on top of Clifft. Parameter-resolved means the circuit has no symbolic parameters left, for example after cirq.resolve_parameters.

See Clifft's front-end integrations guide for how this adapter fits with other Clifft front ends.

import cirq
import clifft_cirq

q0, q1 = cirq.LineQubit.range(2)
circuit = cirq.Circuit(
    cirq.H(q0),
    cirq.CNOT(q0, q1),
    cirq.measure(q0, q1, key="m"),
)

converted = clifft_cirq.to_clifft_text(circuit)
print(converted.clifft_text)

sampler = clifft_cirq.ClifftSampler(seed=123)
result = sampler.run(circuit, repetitions=1000)

The converter returns:

  • clifft_text: text accepted by Clifft's parser.
  • qubit_map: the deterministic mapping from Cirq qubits to Clifft integer qubits.
  • measurement_map: measurement-key metadata used to rebuild a cirq.Result.

Supported

  • Qubit circuits with parameter-resolved operations.
  • Sampling behavior and measurement distributions up to unconditional global phase.
  • Mid-circuit measurements and resets.
  • Measurement keys that appear once each.
  • Common one-, two-, and three-qubit gates, including H, Pauli gates, special-angle axis powers, CX, CZ, SWAP, ISWAP, CH, CCX, CCZ, and Clifft half-turn rotations such as R_X and R_ZZ.
  • Operations that Cirq can decompose into supported operations.

The converter uses rotations instead of same-named Clifft sqrt gates when Clifft and Cirq conventions differ. Unsupported operations raise UnsupportedCirqOperationError with the failing operation.

Unsupported

  • Qudits.
  • Unresolved symbolic parameters at the to_clifft_text boundary.
  • Repeated measurement keys, such as cirq.measure(q0, key="m") followed by cirq.measure(q1, key="m").
  • Arbitrary classical control.
  • Measurement confusion maps.
  • Cirq noise channels.
  • Device, timing, calibration, duration, and tag semantics.
  • Stochastic noise, leakage, loss, and other noncomputational models.

Development

uv sync --group dev
uv run pytest
uv run ruff check .
uv run ruff format --check .

The package depends on clifft>=0.8 and uses its symbolic compiler and sampler APIs. CI should keep testing both the Cirq floor and the latest allowed cirq-core<2 range.

Download files

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

Source Distribution

clifft_cirq-0.1.2.tar.gz (88.5 kB view details)

Uploaded Source

Built Distribution

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

clifft_cirq-0.1.2-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file clifft_cirq-0.1.2.tar.gz.

File metadata

  • Download URL: clifft_cirq-0.1.2.tar.gz
  • Upload date:
  • Size: 88.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for clifft_cirq-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d888c3ed4af6943b1ea9f9fb82cf757a7227753acd9ad244921d1d1df3611ab6
MD5 97e51c97449b4bfda49454d282e6692d
BLAKE2b-256 5f731b1d12b1fa97aeeefcf0dec92eacb04e9e5648547e8d810bf8bfb703b992

See more details on using hashes here.

Provenance

The following attestation bundles were made for clifft_cirq-0.1.2.tar.gz:

Publisher: release.yml on unitaryfoundation/clifft-cirq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file clifft_cirq-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: clifft_cirq-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for clifft_cirq-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 919f7ada1e73a92ed4a163bad3b3ea675ba99e70b51daa6f4150060feb576bfa
MD5 995d08b9dbe0509c33c264d19df5d7bf
BLAKE2b-256 6a33a4c769c3042902d1519c866303c839c3b896fad9ae23da133cc56cad6a8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for clifft_cirq-0.1.2-py3-none-any.whl:

Publisher: release.yml on unitaryfoundation/clifft-cirq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

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