qldpc.circuits.transversal

Tools for identifying the transversal logical Clifford gates.

Functions

get_transversal_automorphism_group(, *, deform_code, ...)

Construct the transversal Clifford automorphism group of a QuditCode.

get_transversal_circuit(, *, deform_code, with_magma)

Find a transversal physical circuit (if any) that implements a logical Clifford operation.

get_transversal_circuits(, *, deform_code, with_magma)

Find transversal physical circuits (if any) that implement logical Clifford operations.

get_transversal_ops(, *, deform_code, ...)

Logical tableaus and physical circuits for transversal logical Clifford gates of a code.

get_transversal_s(→ stim.Circuit)

Get a physical circuit for a transversal logical S = diag(1, i) gate of the code.

Module Contents

qldpc.circuits.transversal.get_transversal_automorphism_group(code: qldpc.codes.QuditCode, local_gates: collections.abc.Collection[str] = ('S', 'H', 'SWAP'), *, deform_code: bool = False, with_magma: bool = False) → qldpc.abstract.Group[source]

Construct the transversal Clifford automorphism group of a QuditCode.

The transversal automorphism group of a QuditCode is the group of logical Clifford operations that can be implemented transversally with a given local gate set.

Here local_gates must be a subset of {“S”, “H”, “SQRT_X”, “SWAP”}.

If deform_code is True, then each member of the automorphism group constructed by this method corresponds to a physical_circuit that has two effects, namely (a) transforming a logical state of the QuditCode by a corresponding logical Clifford gate, and (b) changing the code that encodes the logical state to code.deformed(physical_circuit, preserve_logicals=True).

Uses the methods of https://arxiv.org/abs/2409.18175.

qldpc.circuits.transversal.get_transversal_circuit(code: qldpc.codes.QuditCode, logical_circuit_or_tableau: stim.Circuit | stim.Tableau, local_gates: collections.abc.Collection[str] = ('S', 'H', 'SWAP'), *, deform_code: bool = False, with_magma: bool = False) → stim.Circuit | None[source]

Find a transversal physical circuit (if any) that implements a logical Clifford operation.

Here local_gates must be a subset of {“S”, “H”, “SQRT_X”, “SWAP”}.

If deform_code is True, then a physical_circuit returned by this method has two effects, namely (a) transforming a logical state of the QuditCode by a corresponding logical Clifford gate, and (b) changing the code that encodes the logical state to code.deformed(physical_circuit, preserve_logicals=True).

Warning: this method performs a brute-force search over the Clifford automorphisms of a code, and thereby generally has exponential runtime.

qldpc.circuits.transversal.get_transversal_circuits(code: qldpc.codes.QuditCode, logical_circuits_or_tableaus: collections.abc.Sequence[stim.Circuit | stim.Tableau], local_gates: collections.abc.Collection[str] = ('S', 'H', 'SWAP'), *, deform_code: bool = False, with_magma: bool = False) → list[stim.Circuit | None][source]

Find transversal physical circuits (if any) that implement logical Clifford operations.

Here local_gates must be a subset of {“S”, “H”, “SQRT_X”, “SWAP”}.

If deform_code is True, then a physical_circuit returned by this method has two effects, namely (a) transforming a logical state of the QuditCode by a corresponding logical Clifford gate, and (b) changing the code that encodes the logical state to code.deformed(physical_circuit, preserve_logicals=True).

Warning: this method performs a brute-force search over the Clifford automorphisms of a code, and thereby generally has exponential runtime.

When remove_redundancies is True, generator images that differ only by logical Pauli corrections are treated as equivalent; an empty result is therefore possible for a nontrivial automorphism group.

qldpc.circuits.transversal.get_transversal_ops(code: qldpc.codes.QuditCode, local_gates: collections.abc.Collection[str] = ('S', 'H', 'SWAP'), *, deform_code: bool = False, remove_redundancies: bool = True, with_magma: bool = False) → list[tuple[stim.Tableau, stim.Circuit]][source]

Logical tableaus and physical circuits for transversal logical Clifford gates of a code.

Here local_gates must be a subset of {“S”, “H”, “SQRT_X”, “SWAP”}. The set describes the allowed local Pauli permutations; equivalent Stim C_XYZ/C_ZYX decompositions may appear in returned circuits when multiple local gates are allowed.

If deform_code is True, then a physical_circuit returned by this method has two effects, namely (a) transforming a logical state of the QuditCode by a corresponding logical Clifford gate, and (b) changing the code that encodes the logical state to code.deformed(physical_circuit, preserve_logicals=True).

Uses the methods of https://arxiv.org/abs/2409.18175.

qldpc.circuits.transversal.get_transversal_s(code: qldpc.codes.CSSCode, *, validate: bool = True) → stim.Circuit[source]

Get a physical circuit for a transversal logical S = diag(1, i) gate of the code.

The returned circuit applies one physical S or S_DAG gate to each qubit, and thereby enacts a logical S gate on every logical qubit of the code.

This construction only supports self-dual codes with equivalent logicals (SWEL):

  1. Self dual = CSS code with identical X and Z stabilizers.

  2. Equivalent logicals = applying a Hadamard to every physical qubit enacts a logical Hadamard

    on every logical qubit. This property depends on the choice of logical operator basis.

Parameters:
  • code – The CSS code on which to apply the transversal gate.

  • validate – If True (the default), reject codes that are not SWEL stabilizer codes. If False, return the unchecked physical S/S_DAG circuit and leave correctness to the caller.