paraqeet.propagation package¶
Submodules¶
paraqeet.propagation.euler module¶
Class definition of the Euler propagation model.
- class paraqeet.propagation.euler.Euler¶
Bases:
StatePropagationSimple 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)¶
- Parameters:
model (EquationOfMotion)
- get_parameters()¶
Get a list of parameters of the system.
- Returns:
List of optimisable 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:
OptimisableAbstract 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.
- __init__(model)¶
- Parameters:
model (EquationOfMotion | None)
- gradient(time)¶
Compute this part of the chain rule for a gradient trace.
Computes the result of the propagation wrt model. The returned tuple contains the time-evolved state as well as the gradient. The time-dependent state is returned in the same shape as from the propagate method. In the gradient. the second dimension is the parameter index, i.e. result[i] will be the gradient at time t_i.
- Parameters:
time (Array) – Any one-dimensional vector of timestamps.
- Returns:
Computes part of the chain rune for a gradient trace.
- Return type:
tuple[Array Array]
- Raises:
NotImplementedError – Subclasses derived from this class must implement this method.
- 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
- Raises:
NotImplementedError – Subclasses derived from this class must implement this method.
- set_initial_state(state)¶
Set the initial state for the propagation.
Propagation implementations that do not need the state should not implement this function.
- Parameters:
state (Array) – Parameter value to be set as the initial state for the propagation.
- Raises:
NotImplementedError – Subclasses derived from this class must implement this method.
paraqeet.propagation.runge_kutta module¶
Class definition for the Runge-Kutta Scipy propagation model.
- class paraqeet.propagation.runge_kutta.RungeKutta¶
Bases:
StatePropagationPropagation 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 optimisable 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:
StatePropagationPiecewise 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, res)¶
- Parameters:
model (EquationOfMotion)
res (float)
- get_parameters()¶
Get a list of optimisable parameters of the system.
Note: Method has no optimisable parameters.
- Returns:
Returns an empty list.
- Return type:
list[Quantity]
- 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.
- property resolution: float¶
Get the resolution of the system.
- 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 optimisation method.
- class paraqeet.propagation.scipy_expm_goat.ScipyExpmGOAT¶
Bases:
ScipyExpmSolve EOMs by piecewise exponentation via Scipy using GOAT.
- gradient(time)¶
Solve the GOAT equation for the gradient vector.
- Parameters:
time (Array) – Array of timesteps.
- 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 optimisation 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:
ScipyExpmSolve 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, res)¶
- Parameters:
model (EquationOfMotion)
res (float)
- gradient(time)¶
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:
time (Array)
- Return type:
tuple[Array, Array]
- propagate(time)¶
Loop over all desired times in time at set resolution.
- Parameters:
time (Array)
- Return type:
Array
- property target_state: Array | None¶
Returns the current target state for backward propagation.
- property use_schirmer_derivative: bool¶
Returns whether the Schirmer method is used to compute the derivative of the unitary operator.
paraqeet.propagation.state_propagation module¶
Class definition of the State propagation model.
- class paraqeet.propagation.state_propagation.StatePropagation¶
Bases:
Propagation,ABCPropagation implementation that need an initial state.
This implements the set_initial_state function.
- Parameters:
model (Model) – Represents the equation of motion for a given Hamiltonian.
- __init__(model)¶
- Parameters:
model (EquationOfMotion)
- property is_open: bool¶
Return if the propagation is for open or closed system.
- set_initial_state(state)¶
Set the initial state for the propagation.
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.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:
StatePropagationPropagate 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, res)¶
- Parameters:
model (Model) – Model
res (float) – Resolution at which to sample the EOM
- get_parameters()¶
Method has no optimizable parameters.
- Return type:
Empty list
- 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.
- property resolution: float¶
Get the resolution of the system.
- 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:
Vern7Solve 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.
- _res: float
Simulation resolution.
- _initial_state: Array = None
Initial state for forward propagation.
- _target_state: Array = None
Target state for backward propagation.
- __init__(model, res)¶
- Parameters:
model (Model) – Model
res (float) – Resolution at which to sample the EOM
- gradient(time)¶
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:
time (Array)
- Return type:
tuple[Array, Array]
- property target_state: Array | None¶
Returns the current target state for backward propagation.
Module contents¶
Propagation model module.