paraqeet.propagation package¶
Submodules¶
paraqeet.propagation.differentiable_propagation module¶
Class definition of the State propagation model.
- class paraqeet.propagation.differentiable_propagation.DifferentiablePropagation¶
Bases:
Propagation,DifferentiablePropagation methods that provide a get_value_and_gradient method.
- Parameters:
model (Model) – Represents the equation of motion for a given Hamiltonian.
- __init__(model, resolution)¶
- Parameters:
model (EquationOfMotion)
resolution (float)
- abstract get_value_and_gradient(times)¶
Gradient method to be implemented
- Parameters:
times (Array) – Array of timesteps.
- Returns:
First dimension is time, second dimension is the parameter.
- Return type:
tuple[Array, Array]
paraqeet.propagation.euler module¶
Class definition of the Euler propagation model.
- class paraqeet.propagation.euler.Euler¶
Bases:
PropagationSimple implementation of first order Euler propagation.
Solves the equation of motion d/dt psi(t) = F(psi(t), t) with a finite step size d as psi(t+d) = psi(t) + F(psi(t), t). The step size can be variable and is calculated from the time array that is passed to the propagate function.
- Parameters:
model (Model) – Represents the equation of motion for a given Hamiltonian.
- __init__(model, resolution=1000000000.0)¶
- Parameters:
model (EquationOfMotion)
resolution (float)
- get_parameters()¶
Get a list of parameters of the system.
- Returns:
List of optimizable parameters of the system.
- Return type:
list[Quantity]
- propagate(time)¶
Calulate the first order Euler propagation.
Performs the actual propagation calculation.
- Parameters:
time (Array) – Vector of time samples.
- Returns:
Results of the Euler propagation.
- Return type:
Array
paraqeet.propagation.propagation module¶
Class definition of the Propagation model.
- class paraqeet.propagation.propagation.Propagation¶
Bases:
ABCAbstract base class for any implementation of the equations of motion.
The right-hand side of the equation is provided by the underlying model.
- Parameters:
model (Model) – Represents the equation of motion for a given Hamiltonian.
resolution (float) – Propagation resolution used to solve the equation of motion. The corresponding time step dt = 1/resolution
- __init__(model, resolution)¶
- Parameters:
model (EquationOfMotion | None)
resolution (float)
- get_parameters()¶
Per default, propagation methods have no parameters to optimize.
- property is_open: bool¶
Return if the propagation is for open or closed system.
- abstract propagate(time)¶
Return the solution of the equations of motion.
The first dimension of the result will always be the time. Like in the model, the format of the other dimensions depends on the implementation and could for example be a propagated state vector or a propagator in matrix form.
- Parameters:
time (Array) – Any one-dimensional vector of timestamps.
- Returns:
Returns the solution of the equations of motion.
- Return type:
Array
- property resolution: float¶
Return the propagation resolution.
- set_initial_state(state)¶
Set the initial state for the propagation. (Default implementation)
Propagation implementations that do not need the state should not implement this function.
Subclasses can access the state in the _initial_sate field.
- Parameters:
state (Array) – Parameter value to be set as the initial state for the propagation.
paraqeet.propagation.runge_kutta module¶
Class definition for the Runge-Kutta Scipy propagation model.
- class paraqeet.propagation.runge_kutta.RungeKutta¶
Bases:
PropagationPropagation via the Runge-Kutta Scipy implementation.
Uses scipy’s Runge-Kutta implementation for propagating a state vector or density matrix.
- Parameters:
model (Model) – Represents the equation of motion for a given Hamiltonian.
initial_time_step (float | None, optional) – The initial time step for the adaptive time steps in RK45.
- __init__(model, initial_time_step=None)¶
- Parameters:
model (EquationOfMotion)
initial_time_step (float | None)
- get_parameters()¶
Get a list of parameters of the system.
- Returns:
List of optimizable parameters of the system.
- Return type:
list[Quantity]
- propagate(time)¶
Return the solution of the equations of motion.
- Parameters:
time (Array) – Any one-dimensional vector of timestamps.
- Returns:
Returns the solution of the equations of motion.
- Return type:
Array
- Raises:
ConfigurationException – If the initial state is not set.
ValueError – If the propagation needs at least two time steps.
- set_initial_state(state)¶
Set the initial state for the propagation.
Subclasses can access the state in the _initial_state field.
- Parameters:
state (Array) – Parameter value to be set as the initial state for the propagation.
paraqeet.propagation.scipy_expm module¶
Class definition of the Scipy piecewise exponential propagation model.
- class paraqeet.propagation.scipy_expm.ScipyExpm¶
Bases:
PropagationPiecewise matrix exponential propagation system.
Solve the equation of motion by piecewise exponentation with the Scipy package.
- Parameters:
model (Model) – Represents the equation of motion for a given Hamiltonian.
res (float) – Resolution at which to sample the EOM.
- __init__(model, resolution)¶
- Parameters:
model (EquationOfMotion)
resolution (float)
- propagate(time)¶
Return the solution of the equations of motion.
Loop over all desired times in time at set resolution.
- Parameters:
time (Array) – Any one-dimensional vector of timestamps.
- Returns:
Returns the solution of the equations of motion.
- Return type:
Array
- Raises:
ConfigurationException – If the initial state is not set.
- set_initial_state(state)¶
Set initial state.
paraqeet.propagation.scipy_expm_goat module¶
Class definition of the Scipy piecewise exponential propagation model.
Uses the GOAT optimization method.
- class paraqeet.propagation.scipy_expm_goat.ScipyExpmGOAT¶
Bases:
ScipyExpm,DifferentiablePropagationSolve EOMs by piecewise exponentation via Scipy using GOAT.
- get_value_and_gradient(times)¶
Solve the GOAT equation for the gradient vector.
- Parameters:
time (Array) – Array of timesteps.
times (Array)
- Returns:
First dimension is time, second dimension is the parameter.
- Return type:
tuple[Array, Array]
paraqeet.propagation.scipy_expm_grape module¶
Class definition of the Scipy piecewise exponential propagation model.
Uses the GRAPE optimization method. Assumes that the signal is piecewise constant (PWC) without an LO and the Hamiltonian is defined in the rotating frame of drive.
- class paraqeet.propagation.scipy_expm_grape.ScipyExpmGRAPE¶
Bases:
ScipyExpm,DifferentiablePropagationSolve EOMs by piecewise exponentation via Scipy using GRAPE.
Compute the gradients of a closed quantum system for PWC pulses by using GRAPE. Here, we use forward propagation of the initial state and backward propagation of the target state to compute the gradients.
The state propagations are done by the ScipyExpm method.
- _res: float
Simulation resolution.
- _initial_state: Array = None
Initial state for forward propagation.
- _target_state: Array = None
Target state for backward propagation.
- _schirmer_derivative: bool = False
If true, compute the gradient by Schirmer Derivative/Method of auxillary matrix exponential. If false, use frechet derivative.
- __init__(model, resolution)¶
- Parameters:
model (EquationOfMotion)
resolution (float)
- get_value_and_gradient(times)¶
Compute gradients using GRAPE.
Compute the forward propagation of the initial state and the backward propagation of the target state.
Psis represent the forward propagation and lamdas represent the backward propagation states.
This propagation method assumes a PWC pulse as input.
- Parameters:
times (Array)
- Return type:
tuple[Array, Array]
- propagate(time)¶
Loop over all desired times in time at set resolution.
- Parameters:
time (Array)
- Return type:
Array
- set_target_state(target_state)¶
Set target state for backward propagation.
- Parameters:
target_state (Array) – Target state.
- Return type:
None
- property use_schirmer_derivative: bool¶
Returns whether the Schirmer method is used to compute the derivative of the unitary operator.
paraqeet.propagation.vern7 module¶
Class definition of the fixed time-step 7th-order Verner ODE solver. Adapted from Julia DiffEq Vern7.
- class paraqeet.propagation.vern7.Vern7¶
Bases:
PropagationPropagate state by solving the Schrödinger equation / Lindblad master equation by using ODE solver.
Implements Vern7 ODE Solver algorithm non adaptive (fixed time-step) version.
- __init__(model, resolution)¶
- Parameters:
model (Model) – Model
res (float) – Resolution at which to sample the EOM
resolution (float)
- propagate(time)¶
Return the solution of the equation of motion for open/closed system using vern7 ODE solver.
Loop over all desired times in time at set resolution.
- Parameters:
time (Array) – Any one-dimensional vector of timestamps.
- Returns:
Returns the solution of the equations of motion.
- Return type:
Array
- Raises:
ConfigurationException – If the initial state is not set.
- set_initial_state(state)¶
Set initial state.
paraqeet.propagation.vern7_grape module¶
Class definition of the 7th-order Verner ODE solver for GRAPE.
- class paraqeet.propagation.vern7_grape.Vern7GRAPE¶
Bases:
Vern7,DifferentiablePropagationSolve EOMs by 7th order ODE method to compute gradients using GRAPE.
Compute the gradients of a quantum system for PWC pulses by using GRAPE. Here, we use forward propagation of the initial state and backward propagation of the target state to compute the gradients.
The state propagations are done by the Vern7 ODE method.
- _resolution: float
Simulation resolution.
- _initial_state: Array = None
Initial state for forward propagation.
- _target_state: Array = None
Target state for backward propagation.
- __init__(model, resolution)¶
- Parameters:
model (Model) – Model
res (float) – Resolution at which to sample the EOM
resolution (float)
- get_value_and_gradient(times)¶
Compute gradients using GRAPE.
Compute the forward propagation of the initial state and the backward propagation of the target state.
Psis represent the forward propagation and lamdas represent the backward propagation states.
This propagation method assumes a PWC pulse as input.
Note: This method only computes the first order gradients right now.
- Parameters:
times (Array)
- Return type:
tuple[Array, Array]
- set_target_state(target_state)¶
Set target state for backward propagation.
- Parameters:
target_state (Array) – Target state.
- Return type:
None
Module contents¶
Propagation model module.