paraqeet.model.drive_operator.DriveOperator#
- class paraqeet.model.drive_operator.DriveOperator(generator, is_longitudinal)#
Bases:
DriveCreate a generator drive model.
Transversal (a^\dagger + a or \sigma_x type) or longitudinal (a^\dagger a or \sigma_z type) drive with a time-dependent scalar coefficient that is generated by a Generator object.
- Parameters:
generator (Generator) – Signal generator stack.
is_longitudinal (bool) – Generator is longitudinal or transversal depending on this boolean.
Methods
__init__(generator, is_longitudinal)get_gradient(annihilation_operator, times)Return the gradient of the system.
get_gradient_at_timestep(a, timestep)Get the one-time gradient of the system.
Get a list of parameters of the system.
get_value(annihilation_operator, times)Return the matrix representation of the drive.
get_value_at_timestep(a, t)Get the one-time matrix of the system.
set_all_optimizable_parameters(all_params)Set all optimizable parameters in the optimization.
set_optimizable_parameters(params)Set which parameters associated with the object shall be considered during optimization.
Attributes
Get the optimizable parameters
Get the signal generator from the system.
Get the name of the parameter.
Get the optimizable parameters
- property all_optimizable_parameters: list[Quantity]#
Get the optimizable parameters
- Returns:
The list of all the optimizable parameters considered in the optimization
- Return type:
list[Quantity]
- property generator: Generator#
Get the signal generator from the system.
- Returns:
Returns the signal generator object from the system.
- Return type:
- get_gradient(annihilation_operator, times)#
Return the gradient of the system.
Returns the gradient of the matrix representation of the Hamiltonian with respect to each parameter as a list.
- Parameters:
annihilation_operator (Array) – Operator of the subsystem to which this drive is attached.
times (Array) – Vector of time samples.
- Returns:
Array of shape [t, p, n, n] with ‘t’ as time, ‘p’ as number of parameters and ‘n’ as the Hilbert space dimension.
- Return type:
Array
- get_gradient_at_timestep(a, timestep)#
Get the one-time gradient of the system.
Fetches the gradient from the drive and transforms it into the correct shape for the Hamiltonian.
- Parameters:
a (Array) – Operator for longitudinal or transverse drive.
timestep (Array) – One-dimensional vector of timestamps.
- Returns:
Returns the shape-shifted gradient from the drive.
- Return type:
Array
- get_parameters()#
Get a list of parameters of the system.
- Returns:
List of optimizable parameters of the system.
- Return type:
list[Quantity]
- get_value(annihilation_operator, times)#
Return the matrix representation of the drive.
The dimension is given by the Hamiltonian to which this drive is attached. The default implementation calls getMatrixOneTime for each time step. Subclasses can override this function for a more efficient implementation.
- Parameters:
annihilation_operator (Array) – Operator of the subsystem to which this drive is attached
times (Array) – Vector of time samples.
- Returns:
Matrix of shape [t, n, n] with ‘t’ as time and ‘n’ as the Hilbert space dimension.
- Return type:
Array
- get_value_at_timestep(a, t)#
Get the one-time matrix of the system.
Fetches the coefficient from the drive and transforms it into the correct shape for the Hamiltonian.
- Parameters:
a (Array) – Operator for longitudinal or transverse drive.
t (Array) – One-dimensional vector of timestamps.
- Returns:
Returns the shape-shifted coefficient from the drive.
- Return type:
Array
- property name: str | None#
Get the name of the parameter.
- Returns:
Name of the parameter.
- Return type:
str | None
- property optimizable_parameters: list[Quantity]#
Get the optimizable parameters
- Returns:
The list of optimizable parameters associated with the object.
- Return type:
list[Quantity]
- set_all_optimizable_parameters(all_params)#
Set all optimizable parameters in the optimization.
- set_optimizable_parameters(params)#
Set which parameters associated with the object shall be considered during optimization.
All quantities that are not in the response of get_parameters will be filtered out. This function is called by the optimizer before gradient based optimization to tell the layers which gradients to compute.
- Parameters:
params (list[Quantity]) – List of optimizable parameters to be set.
- Return type:
None