cirq_superstaq.ops.qubit_gates ============================== .. py:module:: cirq_superstaq.ops.qubit_gates .. autoapi-nested-parse:: Miscellaneous custom gates that we encounter and want to explicitly define. Attributes ---------- .. autoapisummary:: cirq_superstaq.ops.qubit_gates.AQTICCX cirq_superstaq.ops.qubit_gates.AQTITOFFOLI cirq_superstaq.ops.qubit_gates.AceCRMinusPlus cirq_superstaq.ops.qubit_gates.AceCRPlusMinus cirq_superstaq.ops.qubit_gates.CR cirq_superstaq.ops.qubit_gates.DD cirq_superstaq.ops.qubit_gates.ICCX cirq_superstaq.ops.qubit_gates.IX cirq_superstaq.ops.qubit_gates.ZX Classes ------- .. autoapisummary:: cirq_superstaq.ops.qubit_gates.AceCR cirq_superstaq.ops.qubit_gates.Barrier cirq_superstaq.ops.qubit_gates.DDPowGate cirq_superstaq.ops.qubit_gates.IXGate cirq_superstaq.ops.qubit_gates.ParallelGates cirq_superstaq.ops.qubit_gates.ParallelRGate cirq_superstaq.ops.qubit_gates.RGate cirq_superstaq.ops.qubit_gates.StrippedCZGate cirq_superstaq.ops.qubit_gates.ZXPowGate cirq_superstaq.ops.qubit_gates.ZZSwapGate Functions --------- .. autoapisummary:: cirq_superstaq.ops.qubit_gates.approx_eq_mod cirq_superstaq.ops.qubit_gates.barrier cirq_superstaq.ops.qubit_gates.custom_resolver cirq_superstaq.ops.qubit_gates.parallel_gates_operation Module Contents --------------- .. py:class:: AceCR(rads: str | cirq.TParamVal = np.pi / 2, sandwich_rx_rads: cirq.TParamVal = 0) Bases: :py:obj:`cirq.Gate` Active Cancellation Echoed Cross Resonance (AceCR) gate, parametrized (e.g., supporting polarity switches) and supporting sandwiches. The typical AceCR in literature is a positive half-CR, then X on "Z side", then negative half-CR ("Z side" and "X side" refer to the two sides of the underlying ZX interactions). .. py:attribute:: rads .. py:attribute:: sandwich_rx_rads .. py:class:: Barrier(num_qubits: Optional[int] = None, qid_shape: Optional[Tuple[int, Ellipsis]] = None) Bases: :py:obj:`cirq.ops.IdentityGate`, :py:obj:`cirq.InterchangeableQubitsGate` A temporal boundary restricting circuit compilation and pulse scheduling. Otherwise equivalent to the identity gate. .. py:class:: DDPowGate(*, exponent: cirq.value.TParamVal = 1.0, global_shift: float = 0.0) Bases: :py:obj:`cirq.EigenGate` The Dipole-Dipole gate for EeroQ hardware .. py:class:: IXGate Bases: :py:obj:`cirq.XPowGate` Thin wrapper of :math:`RX(-\pi)` to improve iToffoli circuit diagrams .. py:class:: ParallelGates(*component_gates: cirq.Gate) Bases: :py:obj:`cirq.Gate`, :py:obj:`cirq.InterchangeableQubitsGate` A single gate combining a collection of concurrent gate(s) acting on different qubits. .. py:method:: qubit_index_to_equivalence_group_key(index: int) -> int Returns a key that differs between qubits. Does it by different component gates and non-interchangeable qubits in the same component gate. :param index: The qubit index. :returns: Equivalence group key. .. py:method:: qubit_index_to_gate_and_index(index: int) -> tuple[cirq.Gate, int] Gets gate (and index) for the corresponding index. :param index: The index into a particular member of the `ParallelGates` operation. :returns: A tuple of the gate at the given index and the index itself. :raises ValueError: If index is outside bounds of gate index range. .. py:attribute:: component_gates :type: tuple[cirq.Gate, Ellipsis] :value: () .. py:class:: ParallelRGate(theta: cirq.TParamVal, phi: cirq.TParamVal, num_copies: int) Bases: :py:obj:`cirq.ParallelGate`, :py:obj:`cirq.InterchangeableQubitsGate` Wrapper class to define a ParallelGate of identical RGate gates. .. py:property:: exponent :type: cirq.TParamVal The `exponent` property of `ParallelRGate`. :returns: The sub gate exponent. .. py:property:: phase_exponent :type: cirq.TParamVal The `phase_exponent` property of each `RGate`. :returns: The phase exponent. .. py:property:: phi :type: cirq.TParamVal The `phi` property of `ParallelRGate`, defining orientation (i.e., axis of rotation). :returns: The rotation-axis angle phi. .. py:property:: sub_gate :type: RGate The gate that is applied to the specified subspace. :returns: The underlying gate used. .. py:property:: theta :type: cirq.TParamVal The `theta` property of `ParallelRGate`, angle to rotate about the phi-determined axis. :returns: The rotation angle theta. .. py:class:: RGate(theta: cirq.TParamVal, phi: cirq.TParamVal) Bases: :py:obj:`cirq.PhasedXPowGate` A single-qubit gate that rotates about an axis in the `X`-`Y` plane. .. py:property:: phi :type: cirq.TParamVal Angle (in radians) defining the axis of rotation in the `X`-`Y` plane. :returns: The phi rotation angle. .. py:property:: theta :type: cirq.TParamVal Angle (in radians) by which to rotate about the axis given by `self.phi`. :returns: The theta rotation angle. .. py:class:: StrippedCZGate(rz_rads: cirq.TParamVal = 0) Bases: :py:obj:`cirq.Gate` The Stripped CZ gate is a regular CZ gate when the rz angle = 0. It is the gate that is actually being performed by Sqorpius, and it is corrected into a CZ gate by RZ gates afterwards if the rz angle is nonzero. .. py:property:: rz_rads :type: cirq.TParamVal The RZ-rotation angle in radians for the gate. :returns: The angle for the RZ rotation. .. py:class:: ZXPowGate(*, exponent: cirq.value.TParamVal = 1.0, global_shift: float = 0.0) Bases: :py:obj:`cirq.EigenGate` The ZX-parity gate, possibly raised to a power. Per arxiv.org/pdf/1904.06560v3 eq. 135, the ZX**t gate implements the following unitary: .. math:: e^{-\frac{i\pi}{2} t Z \otimes X} = \begin{bmatrix} c & -s & . & . \\ -s & c & . & . \\ . & . & c & s \\ . & . & s & c \\ \end{bmatrix} where '.' means '0' and :math:`c = \cos(\frac{\pi t}{2})` and :math:`s = i \sin(\frac{\pi t}{2})`. .. py:class:: ZZSwapGate(theta: cirq.TParamVal) Bases: :py:obj:`cirq.Gate`, :py:obj:`cirq.ops.gate_features.InterchangeableQubitsGate` The ZZ-SWAP gate, which performs the ZZ-interaction followed by a SWAP. ZZ-SWAPs are useful for applications like QAOA or Hamiltonian Simulation, particularly on linear- or low- connectivity devices. See https://arxiv.org/pdf/2004.14970.pdf for an application of ZZ SWAP networks. The unitary for a ZZ-SWAP gate parametrized by ZZ-interaction angle :math:`\theta` is: .. math:: \begin{bmatrix} 1 & . & . & . \\ . & . & e^{i \theta} & . \\ . & e^{i \theta} & . & . \\ . & . & . & 1 \\ \end{bmatrix} where '.' means '0'. For :math:`\theta = 0`, the ZZ-SWAP gate is just an ordinary SWAP. .. py:attribute:: theta .. py:function:: approx_eq_mod(a: cirq.TParamVal, b: cirq.TParamVal, period: float, atol: float = 1e-08) -> bool Check if a ~= b (mod period). If either input is an unresolved parameter, returns a == b. :param a: A Cirq parameter value. :param b: A Cirq parameter value. :param period: The parameter period (i.e., cycle time). :param atol: The absolute tolerance for equality checking. :returns: A boolean indicating whether input parameters are approximately equal. .. py:function:: barrier(*qubits: cirq.Qid) -> cirq.Operation Equivalent to https://qiskit.org/documentation/stubs/qiskit.circuit.library.Barrier.html. :param qubits: The qubits that the barrier will cover. :returns: A barrier `cirq.Operation` on the provided qubits. .. py:function:: custom_resolver(cirq_type: str) -> type[cirq.Gate] | None Tells `cirq.read_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. :param 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. .. py:function:: parallel_gates_operation(*ops: cirq.Operation) -> cirq.Operation Constructs a parallel gates operation. Given operations acting on disjoint qubits, constructs a single `cirq_superstaq.ParallelGates` instance and applies it such that each operation's `.gate` is applied to its `.qubits`. :param ops: Operations to pack into a single `ParallelGates` operation. :returns: `ParallelGates(op.gate, op2.gate, ...).on(*op.qubits, *op2.qubits, ...)` :raises ValueError: If the operation has no `.gate` attribute. :raises ValueError: If the operation has tags. .. py:data:: AQTICCX .. py:data:: AQTITOFFOLI .. py:data:: AceCRMinusPlus .. py:data:: AceCRPlusMinus .. py:data:: CR .. py:data:: DD .. py:data:: ICCX .. py:data:: IX .. py:data:: ZX