cirq_superstaq.ops.qudit_gates
Attributes
Classes
iSWAP-like qutrit entangling gate swapping the "11" and "22" states of two qutrits. |
|
Embeds an n-qubit (i.e. SU(2^n)) gate into a given subspace of a higher-dimensional gate. |
|
A (non-parametrized) SWAP gate on two qudits of arbitrary dimension. |
|
Generalized CZ gate for pairs of equal-dimension qudits. |
|
Phase rotation on the ground state of a qutrit. |
|
Phase rotation on the first excited state of a qutrit. |
|
Phase rotation on the second excited state of a qutrit. |
|
Applies a phase rotation between two successive energy levels of a qudit. |
Functions
|
Tells cirq.json how to deserialize cirq_superstaq's custom gates. |
|
Embeds a qubit Operation into a given subspace of a higher-dimensional 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.InterchangeableQubitsGateiSWAP-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.QubitSubspaceGate(sub_gate: cirq.Gate, qid_shape: collections.abc.Sequence[int], subspaces: collections.abc.Sequence[tuple[int, int]] | None = None)
Bases:
cirq.Gate,cirq.InterchangeableQubitsGateEmbeds 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.InterchangeableQubitsGateA (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.InterchangeableQubitsGateGeneralized 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:
_QutritZPowGatePhase 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:
_QutritZPowGatePhase 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:
_QutritZPowGatePhase 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.EigenGateApplies 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.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