rydopt.gates

A class representing a gate system specifies (i) the physical system for implementing a gate and (ii) the target gate unitary which should be executed. The class implements all methods from the GateSystem protocol as defined in the Reference of Internal Functions. This allows RydOpt’s optimizer to calculate the time evolution of the physical system for a given SinglePhotonPulseAnsatz and to adapt the pulse parameters so that the infidelity with respect to the target gate is minimized.

Rydberg Gate Systems

Rydberg gate systems describe gates that make use of the Rydberg interaction. In addition to the methods from the GateSystem protocol, they implement the methods from the RydbergSystem protocol. This allows one to determine the time spent in Rydberg states.

The different classes below differ by the number of atoms and the conceptual atomic arrangement. An object is constructed by specifying:

  1. the specific physical setting, i.e., the Rydberg-interaction strengths between the atoms, and the Rydberg-state decay rate.

  2. the specific target gate angles.

Symmetric

The following classes implement gate systems corresponding to specific symmetric atom arrangements. Each atoms is driven with the same Rabi frequency.

class TwoQubitGate(phi, theta, Vnn, decay=0.0, fidelity_type='process')[source]

Class that describes a gate on two atoms. The physical setting is described by the interaction strength between the atoms, \(V_{\mathrm{nn}}\), and the decay strength from Rydberg states, \(\gamma\). The target gate is specified by the phases \(\phi, \theta\). Some phases can remain unspecified if they may take on arbitrary values. In the figure, we use the notation \(\mathrm{C}_1\mathrm{Z}(\alpha) = \mathrm{diag}(1, 1, 1, e^{i\alpha})\), and \(\mathrm{Z}(\alpha) = \mathrm{diag}(1, e^{i\alpha})\).

../_images/TwoQubitGate.png

Example

>>> import rydopt as ro
>>> import numpy as np
>>> gate = ro.gates.TwoQubitGate(
...     phi=None,
...     theta=np.pi,
...     Vnn=float("inf"),
...     decay=0.0001,
... )
Parameters:
  • phi (float | None) – target phase \(\phi\) of single-qubit gate contribution.

  • theta (float | None) – target phase \(\theta\) of two-qubit gate contribution.

  • Vnn (float) – interaction strength \(V_{\mathrm{nn}}/(\hbar\Omega_0)\).

  • decay (float) – Rydberg decay strength \(\gamma/\Omega_0\), default is 0.

  • fidelity_type (FidelityType) – which fidelity to use (either “process” or “average_gate”)

class ThreeQubitGateIsosceles(phi, theta, theta_prime, lamb, Vnn, Vnnn, decay=0.0, fidelity_type='process')[source]

Class that describes a gate on three atoms arranged in an isosceles triangle. The physical setting is described by the interaction strengths between atoms, \(V_{\mathrm{nn}}\) and \(V_{\mathrm{nnn}}\), and the decay strength from Rydberg states, \(\gamma\). The target gate is specified by the phases \(\phi, \theta, \theta', \lambda\). Some phases can remain unspecified if they may take on arbitrary values. In the figure, we use the notation \(\mathrm{C}_n\mathrm{Z}(\alpha) = \mathrm{diag}(1, ..., 1, e^{i\alpha})\) on \(n+1\) qubits, and \(\mathrm{Z}(\alpha) = \mathrm{C}_0\mathrm{Z}(\alpha) = \mathrm{diag}(1, e^{i\alpha})\).

../_images/ThreeQubitGateIsosceles.png

Example

>>> import rydopt as ro
>>> import numpy as np
>>> gate = ro.gates.ThreeQubitGateIsosceles(
...     phi=None,
...     theta=np.pi,
...     theta_prime=None,
...     lamb=0.0,
...     Vnn=float("inf"),
...     Vnnn=1.0,
...     decay=0.0001,
... )
Parameters:
  • phi (float | None) – target phase \(\phi\) of single-qubit gate contribution.

  • theta (float | None) – target phase \(\theta\) of nearest-neighbour two-qubit gate contribution.

  • theta_prime (float | None) – target phase \(\theta'\) of next-nearest-neighbour two-qubit gate contribution.

  • lamb (float | None) – target phase \(\lambda\) of three-qubit gate contribution.

  • Vnn (float) – nearest-neighbour interaction strength \(V_{\mathrm{nn}}/(\hbar\Omega_0)\).

  • Vnnn (float) – next-nearest-neighbour interaction strength \(V_{\mathrm{nnn}}/(\hbar\Omega_0)\).

  • decay (float) – Rydberg decay strength \(\gamma/\Omega_0\), default is 0.

  • fidelity_type (FidelityType) – which fidelity to use (either “process” or “average_gate”)

class FourQubitGatePyramidal(phi, theta, theta_prime, lamb, lamb_prime, kappa, Vnn, Vnnn, decay=0.0, fidelity_type='process')[source]

Class that describes a gate on four atoms arranged in a pyramid. The physical setting is described by the interaction strengths between atoms, \(V_{\mathrm{nn}}\) and \(V_{\mathrm{nnn}}\), and the decay strength from Rydberg states, \(\gamma\). The target gate is specified by the phases \(\phi, \theta, \theta', \lambda, \lambda', \kappa\). Some phases can remain unspecified if they may take on arbitrary values. In the figure, we use the notation \(\mathrm{C}_n\mathrm{Z}(\alpha) = \mathrm{diag}(1, ..., 1, e^{i\alpha})\) on \(n+1\) qubits, and \(\mathrm{Z}(\alpha) = \mathrm{C}_0\mathrm{Z}(\alpha) = \mathrm{diag}(1, e^{i\alpha})\).

../_images/FourQubitGatePyramidal.png

Example

>>> import rydopt as ro
>>> import numpy as np
>>> gate = ro.gates.FourQubitGatePyramidal(
...     phi=None,
...     theta=np.pi,
...     theta_prime=None,
...     lamb=0.0,
...     lamb_prime=None,
...     kappa=np.pi,
...     Vnn=float("inf"),
...     Vnnn=1.0,
...     decay=0.0001,
... )
Parameters:
  • phi (float | None) – target phase \(\phi\) of single-qubit gate contribution.

  • theta (float | None) – target phase \(\theta\) of nearest-neighbour two-qubit gate contribution.

  • theta_prime (float | None) – target phase \(\theta'\) of next-nearest-neighbour two-qubit gate contribution.

  • lamb (float | None) – target phase \(\lambda\) of asymmetric three-qubit gate contribution.

  • lamb_prime (float | None) – target phase \(\lambda'\) of symmetric three-qubit gate contribution.

  • kappa (float | None) – target phase \(\kappa\) of four-qubit gate contribution.

  • Vnn (float) – nearest-neighbour interaction strength \(V_{\mathrm{nn}}/(\hbar\Omega_0)\).

  • Vnnn (float) – next-nearest-neighbour interaction strength \(V_{\mathrm{nnn}}/(\hbar\Omega_0)\).

  • decay (float) – Rydberg decay strength \(\gamma/\Omega_0\), default is 0.

  • fidelity_type (FidelityType) – which fidelity to use (either “process” or “average_gate”)

Asymmetric

The following classes work for arbitrary atom arrangements. Optionally, each atom can be driven with an individually scaled Rabi frequency, specified by the per-atom scaling factors s1, s2, … .

class TwoQubitGateAsym(phi1, phi2, theta12, V12, decay=0.0, s1=1.0, s2=1.0, fidelity_type='process')[source]

Class that describes a gate on two atoms in an asymmetric setup.

The physical setting is described by the interaction strength between atoms, \(V_{12}\), and the decay strength from Rydberg states, \(\gamma\). In addition, each atom can optionally have a different Rabi frequency scaling factor.

The target gate is specified by the phases \(\phi_1, \phi_2, \theta_{12}\). Some phases can remain unspecified if they may take on arbitrary values.

Parameters:
  • phi1 (float | None) – target phase of the single-qubit gate contribution on atom 1.

  • phi2 (float | None) – target phase of the single-qubit gate contribution on atom 2.

  • theta12 (float | None) – target phase of the two-qubit gate contribution.

  • V12 (float) – interaction strength between atoms 1 and 2, \(V_{12}/(\hbar\Omega_0)\).

  • decay (float) – Rydberg decay strength \(\gamma/\Omega_0\), default is 0.

  • s1 (float) – Rabi frequency scaling factor for atom 1, default is 1.

  • s2 (float) – Rabi frequency scaling factor for atom 2, default is 1.

  • fidelity_type (FidelityType) – which fidelity to use (either “process” or “average_gate”)

class ThreeQubitGateAsym(phi1, phi2, phi3, theta12, theta13, theta23, lamb, V12, V13, V23, decay=0.0, s1=1.0, s2=1.0, s3=1.0, fidelity_type='process')[source]

Class that describes a gate on three atoms in an asymmetric setup.

The physical setting is described by the interaction strengths between atoms, \(V_{12}\), \(V_{13}\), and \(V_{23}\), and the decay strength from Rydberg states, \(\gamma\). In addition, each atom can optionally have a different Rabi frequency scaling factor. The target gate is specified by the phases \(\phi_1, \phi_2, \phi_3, \theta_{12}, \theta_{13}, \theta_{23}, \lambda\). Some phases can remain unspecified if they may take on arbitrary values.

Parameters:
  • phi1 (float | None) – target phase of the single-qubit gate contribution on atom 1.

  • phi2 (float | None) – target phase of the single-qubit gate contribution on atom 2.

  • phi3 (float | None) – target phase of the single-qubit gate contribution on atom 3.

  • theta12 (float | None) – target phase of the two-qubit gate contribution on atoms 1, 2.

  • theta13 (float | None) – target phase of the two-qubit gate contribution on atoms 1, 3.

  • theta23 (float | None) – target phase of the two-qubit gate contribution on atoms 2, 3.

  • lamb (float | None) – target phase of the three-qubit gate contribution.

  • V12 (float) – interaction strength between atoms 1 and 2, \(V_{12}/(\hbar\Omega_0)\).

  • V13 (float) – interaction strength between atoms 1 and 3, \(V_{13}/(\hbar\Omega_0)\).

  • V23 (float) – interaction strength between atoms 2 and 3, \(V_{23}/(\hbar\Omega_0)\).

  • decay (float) – Rydberg decay strength \(\gamma/\Omega_0\), default is 0.

  • s1 (float) – Rabi frequency scaling factor for atom 1, default is 1.

  • s2 (float) – Rabi frequency scaling factor for atom 2, default is 1.

  • s3 (float) – Rabi frequency scaling factor for atom 3, default is 1.

  • fidelity_type (FidelityType) – which fidelity to use (either “process” or “average_gate”)

class FourQubitGateAsym(phi1, phi2, phi3, phi4, theta12, theta13, theta14, theta23, theta24, theta34, lamb123, lamb124, lamb134, lamb234, mu, V12, V13, V14, V23, V24, V34, decay=0.0, s1=1.0, s2=1.0, s3=1.0, s4=1.0, fidelity_type='process')[source]

Class that describes a gate on four atoms in an asymmetric setup.

The physical setting is described by the interaction strengths between atoms, \(V_{12}, V_{13}, V_{14}, V_{23}, V_{24}, V_{34}\), and the decay strength from Rydberg states, \(\gamma\). In addition, each atom can optionally have a different Rabi frequency scaling factor. The target gate is specified by phases \(\phi_1, \phi_2, \phi_3, \phi_4\), \(\theta_{12}, \theta_{13}, \theta_{14}, \theta_{23}, \theta_{24}, \theta_{34}\), \(\lambda_{123}, \lambda_{124}, \lambda_{134}, \lambda_{234}\), and \(\mu\). Some phases can remain unspecified if they may take on arbitrary values.

Parameters:
  • phi1 (float | None) – target phase of the single-qubit gate contribution on atom 1.

  • phi2 (float | None) – target phase of the single-qubit gate contribution on atom 2.

  • phi3 (float | None) – target phase of the single-qubit gate contribution on atom 3.

  • phi4 (float | None) – target phase of the single-qubit gate contribution on atom 4.

  • theta12 (float | None) – target phase of the two-qubit gate contribution on atoms 1, 2.

  • theta13 (float | None) – target phase of the two-qubit gate contribution on atoms 1, 3.

  • theta14 (float | None) – target phase of the two-qubit gate contribution on atoms 1, 4.

  • theta23 (float | None) – target phase of the two-qubit gate contribution on atoms 2, 3.

  • theta24 (float | None) – target phase of the two-qubit gate contribution on atoms 2, 4.

  • theta34 (float | None) – target phase of the two-qubit gate contribution on atoms 3, 4.

  • lamb123 (float | None) – target phase of the three-qubit gate contribution on atoms 1, 2, 3.

  • lamb124 (float | None) – target phase of the three-qubit gate contribution on atoms 1, 2, 4.

  • lamb134 (float | None) – target phase of the three-qubit gate contribution on atoms 1, 3, 4.

  • lamb234 (float | None) – target phase of the three-qubit gate contribution on atoms 2, 3, 4.

  • mu (float | None) – target phase of the four-qubit gate contribution.

  • V12 (float) – interaction strength between atoms 1 and 2, \(V_{12}/(\hbar\Omega_0)\).

  • V13 (float) – interaction strength between atoms 1 and 3, \(V_{13}/(\hbar\Omega_0)\).

  • V14 (float) – interaction strength between atoms 1 and 4, \(V_{14}/(\hbar\Omega_0)\).

  • V23 (float) – interaction strength between atoms 2 and 3, \(V_{23}/(\hbar\Omega_0)\).

  • V24 (float) – interaction strength between atoms 2 and 4, \(V_{24}/(\hbar\Omega_0)\).

  • V34 (float) – interaction strength between atoms 3 and 4, \(V_{34}/(\hbar\Omega_0)\).

  • decay (float) – Rydberg decay strength \(\gamma/\Omega_0\), default is 0.

  • s1 (float) – Rabi frequency scaling factor for atom 1, default is 1.

  • s2 (float) – Rabi frequency scaling factor for atom 2, default is 1.

  • s3 (float) – Rabi frequency scaling factor for atom 3, default is 1.

  • s4 (float) – Rabi frequency scaling factor for atom 4, default is 1.

  • fidelity_type (FidelityType) – which fidelity to use (either “process” or “average_gate”)

Gate Families

A GateFamily combines several gate systems into a single optimization objective. Each gate is associated with a scalar argument. A shared PulseFamilyAnsatz is used to generate a pulse for each argument.

The class implements the protocol Optimizable. During optimization, the pulse-family parameters are converted into pulse parameters for each argument. The infidelity is evaluated independently for every gate system and then combined using a reduction operation ("mean" or "max").

This allows optimizing a single pulse family that performs well across a continuous family of target gates rather than optimizing a separate pulse for each individual gate argument.

class GateFamily(fixed_argument_gates, argument_values, reduction='mean', softmax_scale=None)[source]

Collection of gates evaluated under a shared pulse ansatz with interpolation.

The infidelity is evaluated independently for each gate and then combined according to the specified reduction operation.

Example

>>> import rydopt as ro
>>> import numpy as np
>>> target_phases = np.linspace(0.25, 1.0, 4) * np.pi
>>> sampled_gates = [
...     ro.gates.TwoQubitGate(
...         phi=None,
...         theta=np.pi,
...         Vnn=float("inf"),
...         decay=0.0001,
...     )
...     for phase in target_phases
... ]
>>> parametrized_gate = ro.gates.GateFamily(
...     fixed_argument_gates=sampled_gates,
...     argument_values=target_phases,
...     reduction="mean",
... )
Parameters:
  • fixed_argument_gates (Sequence[GateSystem]) – Sequence of gate instances defining the physical systems.

  • argument_values (float | Sequence[float] | Array | NDArray[float64]) – Sequence of scalar arguments (same length as fixed_argument_gates) that controls the pulse family parametrization.

  • reduction (Literal['mean', 'max', 'softmax']) – Reduction operation applied to the per-gate infidelities. One of {“mean”, “max”, “softmax”}.

  • softmax_scale (float | None) – Non-negative scale parameter used only when reduction=”softmax”. A value of zero corresponds to the max, and infinity corresponds to the mean. Finite values set the scale of per-gate infidelity differences that the optimizer should care about.