rydopt.simulation

evolve(gate, pulse, params, tol=1e-07)[source]

The function performs the time evolution of all initial states \(|\psi_i(0)\rangle\) (specified in the gate object), under the pulse Hamiltonian \(H\).

\[|\psi_i(T)\rangle = U(T)|\psi_i(0)\rangle = \mathcal{T} e^{-\frac{i}{\hbar} \int_0^T H(t)dt} |\psi_i(0)\rangle\]

Example

>>> import rydopt as ro
>>> import numpy as np
>>> gate = ro.gates.TwoQubitGate(
...     phi=None,
...     theta=np.pi,
...     Vnn=float("inf"),
...     decay=0,
... )
>>> pulse = ro.pulses.PulseAnsatz(
...     detuning_ansatz=ro.pulses.Const(),
...     phase_ansatz=ro.pulses.SinCrab(2),
... )
>>> params = ro.pulses.PulseParams(7.61140652, [0.07842706], [1.80300902, -0.61792703], [])
>>> time_evolved_basis_states = ro.simulation.evolve(gate, pulse, params)
Parameters:
  • gate (Evolvable) – RydOpt Gate object.

  • pulse (PulseAnsatzLike) – RydOpt PulseAnsatz object.

  • params (ParamsFloatLike) – Pulse parameters.

  • tol (float) – Precision of the ODE solver, default is 1e-7.

Returns:

Time-evolved basis states \(\{|\psi_i(T)\rangle\}\).

Return type:

tuple[Array, …]

process_fidelity(gate, pulse, params, tol=1e-07)[source]

The function provides the process fidelity of the unitary resulting from a gate pulse \(U(T)\) w.r.t. the target unitary \(U_{\mathrm{targ}}\):

\[F_{pro} = \frac{| \mathrm{tr}(U_{\mathrm{targ}}^{\dagger} U(T)) |^2}{d^2},\]

where \(d\) is the dimension of the Hilbert space.

Note that if both \(U(T)\) and \(U_{\mathrm{targ}}\) are diagonal, the process fidelity is equivalent to the generalized N-qubit Bell state fidelity \(F_{+} = |\! \langle +|^{\otimes N} U_{\mathrm{targ}}^{\dagger} U(T) |+\rangle^{\otimes N}\!|^2\). For the Rydberg gates that are currently implemented in RydOpt, this is the case.

Example

>>> import rydopt as ro
>>> import numpy as np
>>> gate = ro.gates.TwoQubitGate(
...     phi=None,
...     theta=np.pi,
...     Vnn=float("inf"),
...     decay=0,
... )
>>> pulse = ro.pulses.PulseAnsatz(
...     detuning_ansatz=ro.pulses.Const(),
...     phase_ansatz=ro.pulses.SinCrab(2),
... )
>>> params = ro.pulses.PulseParams(7.61140652, [0.07842706], [1.80300902, -0.61792703], [])
>>> fidelity = ro.simulation.process_fidelity(gate, pulse, params)
Parameters:
  • gate (GateSystem) – RydOpt Gate object.

  • pulse (PulseAnsatzLike) – RydOpt PulseAnsatz object.

  • params (ParamsFloatLike) – Pulse parameters.

  • tol (float) – Precision of the ODE solver, default is 1e-7.

Returns:

State fidelity \(F_{pro}\).

Return type:

Array

average_gate_fidelity(gate, pulse, params, tol=1e-07)[source]

The function provides the average gate fidelity calculated from the process fidelity:

\[F_{avg} = \frac{d \cdot F_{pro} + 1}{d+1},\]

where \(d\) is the dimension of the Hilbert space.

Example

>>> import rydopt as ro
>>> import numpy as np
>>> gate = ro.gates.TwoQubitGate(
...     phi=None,
...     theta=np.pi,
...     Vnn=float("inf"),
...     decay=0,
... )
>>> pulse = ro.pulses.PulseAnsatz(
...     detuning_ansatz=ro.pulses.Const(),
...     phase_ansatz=ro.pulses.SinCrab(2),
... )
>>> params = ro.pulses.PulseParams(7.61140652, [0.07842706], [1.80300902, -0.61792703], [])
>>> fidelity = ro.simulation.average_gate_fidelity(gate, pulse, params)
Parameters:
  • gate (GateSystem) – RydOpt Gate object.

  • pulse (PulseAnsatzLike) – RydOpt PulseAnsatz object.

  • params (ParamsFloatLike) – Pulse parameters.

  • tol (float) – Precision of the ODE solver, default is 1e-7.

Returns:

Fidelity \(F_{avg}\).

Return type:

Array

rydberg_time(gate, pulse, params, tol=1e-07)[source]

The function determines the total time spent in Rydberg states during a gate pulse:

\[\Omega_0 T_R = \Omega_0 \int_0^T \sum_{i=1}^{N} \bra{+}^{\otimes N}U(t)^{\dagger} |r_i\rangle\!\langle r_i| U(t)\ket{+}^{\otimes N} dt .\]

Example

>>> import rydopt as ro
>>> import numpy as np
>>> gate = ro.gates.TwoQubitGate(
...     phi=None,
...     theta=np.pi,
...     Vnn=float("inf"),
...     decay=0,
... )
>>> pulse = ro.pulses.PulseAnsatz(
...     detuning_ansatz=ro.pulses.Const(),
...     phase_ansatz=ro.pulses.SinCrab(2),
... )
>>> params = ro.pulses.PulseParams(7.61140652, [0.07842706], [1.80300902, -0.61792703], [])
>>> time_in_rydberg_state = ro.simulation.rydberg_time(gate, pulse, params)
Parameters:
Returns:

Total Rydberg time \(\Omega_0 T_R\).

Return type:

Array