cirq_superstaq.ops.qudit_gates

Attributes

BSWAP

BSWAP_INV

CZ3

CZ3_INV

QutritZ0

QutritZ1

QutritZ2

SWAP3

Classes

BSwapPowGate

iSWAP-like qutrit entangling gate swapping the "11" and "22" states of two qutrits.

MovementGate

A gate to represent qubit shuttling.

PermutationGate

Extension of cirq.QubitPermutationGate to support qudits of arbitrary dimension.

QubitSubspaceGate

Embeds an n-qubit (i.e. SU(2^n)) gate into a given subspace of a higher-dimensional gate.

QuditSwapGate

A (non-parametrized) SWAP gate on two qudits of arbitrary dimension.

QutritCZPowGate

Generalized CZ gate for pairs of equal-dimension qudits.

QutritZ0PowGate

Phase rotation on the ground state of a qutrit.

QutritZ1PowGate

Phase rotation on the first excited state of a qutrit.

QutritZ2PowGate

Phase rotation on the second excited state of a qutrit.

VirtualZPowGate

Applies a phase rotation between two successive energy levels of a qudit.

Functions

custom_resolver(→ type[cirq.Gate] | None)

Tells cirq.json how to deserialize cirq_superstaq's custom gates.

movement_op(→ cirq.Operation)

Construct a MovementGate operation implementing the given moves.

qubit_subspace_op(→ cirq.Operation)

Embeds a qubit Operation into a given subspace of a higher-dimensional Operation.

qudit_swap_op(→ cirq.Operation)

Construct a SWAP gate and apply it to the provided qudits.

Module Contents

class cirq_superstaq.ops.qudit_gates.BSwapPowGate(*, exponent: cirq.value.TParamVal = 1.0, global_shift: float = 0.0)

Bases: cirq.EigenGate, cirq.InterchangeableQubitsGate

iSWAP-like qutrit entangling gate swapping the “11” and “22” states of two qutrits.

property dimension: int

Indicates that this gate acts on qutrits.

Returns:

The integer 3, representing the qudit dimension for qutrits.

class cirq_superstaq.ops.qudit_gates.MovementGate(moves: collections.abc.Mapping[int, int], dimension: int = 2)

Bases: PermutationGate

A gate to represent qubit shuttling.

Mostly just a wrapper for a permutation gate, but doesn’t require destinations for empty sites.

property complete_map: dict[int, int]

A complete (one-to-one and onto) initial-to-final map, including “moves” of empty sites.

Note this is not always unique.

property moves: dict[int, int]
class cirq_superstaq.ops.qudit_gates.PermutationGate(permutation: collections.abc.Sequence[int], dimension: int = 2)

Bases: cirq.QubitPermutationGate

Extension of cirq.QubitPermutationGate to support qudits of arbitrary dimension.

property dimension: int
class cirq_superstaq.ops.qudit_gates.QubitSubspaceGate(sub_gate: cirq.Gate, qid_shape: collections.abc.Sequence[int], subspaces: collections.abc.Sequence[tuple[int, int]] | None = None)

Bases: cirq.Gate, cirq.InterchangeableQubitsGate

Embeds an n-qubit (i.e. SU(2^n)) gate into a given subspace of a higher-dimensional gate.

qubit_index_to_equivalence_group_key(index: int) int

Check for interchangeable qubits.

Any interchangeable qubits in sub_gate will remain interchangeable in this gate if they have the same dimension and subspace.

property qid_shape: tuple[int, Ellipsis]

Specifies the qudit dimension for each of the inputs.

Returns:

The dimensions for the input qudits.

property sub_gate: cirq.Gate

The gate that is applied to the specified subspace.

Returns:

The underlying gate used.

property subspaces: list[tuple[int, int]]

A list of subspace indices acted upon.

For instance, a CX on the 0-1 qubit subspace of two qudits would have subspaces of [(0, 1), (0, 1)]. The same gate acting on the 1-2 subspaces of both qudits would correspond to [(1, 2), (1, 2)].

Returns:

A list of dimensions tuples, specified for each subspace.

class cirq_superstaq.ops.qudit_gates.QuditSwapGate(dimension: int)

Bases: cirq.Gate, cirq.InterchangeableQubitsGate

A (non-parametrized) SWAP gate on two qudits of arbitrary dimension.

property dimension: int

The qudit dimension on which this SWAP gate will act.

Returns:

The qudit dimension.

class cirq_superstaq.ops.qudit_gates.QutritCZPowGate(*, exponent: cirq.value.TParamVal = 1.0, global_shift: float = 0.0)

Bases: cirq.EigenGate, cirq.InterchangeableQubitsGate

Generalized CZ gate for pairs of equal-dimension qudits.

It is defined by the following unitary:

U = Σ_(i<d,j<d) ω**ij.|i⟩⟨i|.|j⟩⟨j|,

where d is the dimension of the qudits and ω = exp(2πi/d).

Currently written for qutrits (d = 3), but its implementation should work for any dimension.

property dimension: int

Indicates that this gate acts on qutrits.

Returns:

The integer 3, representing the qudit dimension for qutrits.

class cirq_superstaq.ops.qudit_gates.QutritZ0PowGate(*, exponent: cirq.value.TParamVal = 1.0, global_shift: float = 0.0)

Bases: _QutritZPowGate

Phase rotation on the ground state of a qutrit.

class cirq_superstaq.ops.qudit_gates.QutritZ1PowGate(*, exponent: cirq.value.TParamVal = 1.0, global_shift: float = 0.0)

Bases: _QutritZPowGate

Phase rotation on the first excited state of a qutrit.

class cirq_superstaq.ops.qudit_gates.QutritZ2PowGate(*, exponent: cirq.value.TParamVal = 1.0, global_shift: float = 0.0)

Bases: _QutritZPowGate

Phase rotation on the second excited state of a qutrit.

class cirq_superstaq.ops.qudit_gates.VirtualZPowGate(dimension: int = 2, level: int = 1, exponent: cirq.TParamVal = 1.0, global_shift: float = 0.0)

Bases: cirq.EigenGate

Applies a phase rotation between two successive energy levels of a qudit.

property dimension: int

The qudit dimension on which this gate acts.

Returns:

The gate’s dimension.

property level: int

The lowest energy level onto which this gate applies a phase; for example if level=2 a phase of (-1)**exponent will be applied to energy levels [2, …, dimension - 1]. This is equivalent to phase shifting all subsequent single-qudit gates acting in the (1, 2) subspace (assuming all other gates commute with this one).

Returns:

The lowest energy level onto which this gate applies a phase.

cirq_superstaq.ops.qudit_gates.custom_resolver(cirq_type: str) type[cirq.Gate] | None

Tells cirq.json how to deserialize cirq_superstaq’s custom gates.

Changes to gate names in this file should be reflected in this resolver. See quantumai.google/cirq/dev/serialization for more information about (de)serialization.

Parameters:

cirq_type – The string of the gate type for the serializer to resolve.

Returns:

The resolved Cirq Gate matching the input, or None if no match.

cirq_superstaq.ops.qudit_gates.movement_op(moves: collections.abc.Mapping[cirq.Qid, cirq.Qid]) cirq.Operation

Construct a MovementGate operation implementing the given moves.

Parameters:

moves – A dictionary mapping initial qubit positions to their destinations. For example, moves={q0: q1, q1: q2} indicates a shift of two qubits (initially q0 and q1) by one step (to positions q1 and q2). In this case q2 (absent from moves.keys()) is assumed to be an empty site at the start of the operation, and q0 (absent from moves.values()) will be empty after the move.

Returns:

A MovementGate operation implementing the indicated move.

cirq_superstaq.ops.qudit_gates.qubit_subspace_op(sub_op: cirq.Operation, qid_shape: collections.abc.Sequence[int], subspaces: collections.abc.Sequence[tuple[int, int]] | None = None) cirq.Operation

Embeds a qubit Operation into a given subspace of a higher-dimensional Operation.

Uses QubitSubspaceGate.

Parameters:
  • sub_op – The cirq.Operation to embed.

  • qid_shape – The dimensions of the subspace.

  • subspaces – The list of all subspaces.

Returns:

A cirq.Operation embedding a low-dimensional operation.

Raises:

ValueError – If there is no gate specified for the subspace operation.

cirq_superstaq.ops.qudit_gates.qudit_swap_op(qudit0: cirq.Qid, qudit1: cirq.Qid) cirq.Operation

Construct a SWAP gate and apply it to the provided qudits.

If both qudits have dimension 2, uses cirq.SWAP; otherwise uses QuditSwapGate.

Parameters:
  • qudit0 – The first qudit to swap.

  • qudit1 – The second qudit to swap.

Returns:

A SWAP gate acting on the provided qudits.

Raises:

ValueError – If the input qudits don’t have the same dimension.

cirq_superstaq.ops.qudit_gates.BSWAP
cirq_superstaq.ops.qudit_gates.BSWAP_INV
cirq_superstaq.ops.qudit_gates.CZ3
cirq_superstaq.ops.qudit_gates.CZ3_INV
cirq_superstaq.ops.qudit_gates.QutritZ0
cirq_superstaq.ops.qudit_gates.QutritZ1
cirq_superstaq.ops.qudit_gates.QutritZ2
cirq_superstaq.ops.qudit_gates.SWAP3