Protocols
The protocols described here specify which methods a class must implement such that it can be used for a specific purpose.
The hierarchy of the protocols for quantum systems is shown in the following diagram.
- class Evolvable(*args, **kwargs)[source]
Minimal interface for a system that can be time evolved.
Used by
rydopt.simulation.evolve().- initial_basis_states()[source]
The initial basis states \((1, 0, ...)\) of appropriate dimension.
- Returns:
Tuple of initial basis states.
- Return type:
tuple[Array, …]
- hamiltonian_functions_for_basis_states()[source]
The Hamiltonian under which the initial basis states evolve.
A separate Hamiltonian function is returned for each initial basis state. In the case of a block-diagonal Hamiltonian, this allows for returning only the block that is of relevance for a particular basis state.
- Returns:
Tuple of Hamiltonian functions.
- Return type:
tuple[TypeAliasForwardRef(‘HamiltonianFunction’), …]
- class Optimizable(*args, **kwargs)[source]
Minimal interface for a system that exposes a cost function.
- cost(pulse, params, tol)[source]
Evaluate the cost function for the given pulse and parameters.
- Parameters:
pulse (PulseAnsatzLike)
params (ParamsFloatLike)
tol (float)
- Return type:
Array
- class GateSystem(*args, **kwargs)[source]
Interface for gates that can be optimized for process fidelity. The interface is derived from
Evolvable. Additionally, methods are present for calculating fidelities from time-evolved basis states.Used by
rydopt.simulation.process_fidelity(),rydopt.simulation.average_gate_fidelity(),rydopt.optimization.optimize(),rydopt.characterization.analyze_gate(), andrydopt.characterization.analyze_gate_qutip().- process_fidelity_helper(final_basis_states)[source]
Given the basis states evolved under the pulse, this function calculates the fidelity with respect to the gate’s target state, specified by the gate angles \(\phi, \, \theta, \, \ldots\)
- Parameters:
final_basis_states (tuple[Array, ...]) – Time-evolved basis states.
- Returns:
Fidelity with respect to the target state.
- Return type:
Array
- class RydbergSystem(*args, **kwargs)[source]
Interface for Evolvables that utilize Rydberg states. The interface is derived from
Evolvable. Additionally, methods are present for calculating the time spent in Rydberg states during time evolution.Used by
rydopt.simulation.rydberg_time(),rydopt.characterization.analyze_gate(), andrydopt.characterization.analyze_gate_qutip().- rydberg_population_operators_for_basis_states()[source]
For each basis state, the Rydberg population operators count the number of Rydberg excitations on the diagonal.
- Returns:
Tuple of operators.
- Return type:
tuple[Array, …]
- rydberg_time(expectation_values_of_basis_states)[source]
Given the expectation values of Rydberg populations for each basis state, integrated over the full pulse, this function calculates the average time spent in Rydberg states during the gate.
- Parameters:
expectation_values_of_basis_states (tuple[Array, ...]) – Expected Rydberg times for each basis state.
- Returns:
Averaged Rydberg time \(T_R\).
- Return type:
Array
- class PulseAnsatzLike(*args, **kwargs)[source]
Minimal interface for pulse ansatz objects used in simulation and optimization.
- evaluate_pulse_functions(t, params)[source]
Evaluate detuning, phase, and Rabi pulse functions at time samples
t.- Parameters:
t (float | Array)
params (ParamsFloatLike)
- Return type:
tuple[Array, Array, Array, Array]