paraqeet.model.drive.Drive#

class paraqeet.model.drive.Drive[source]#

Bases: Optimizable

Represents a time-dependent drive on a subsystem.

This can for example be a microwave or flux drive.

__init__()#

Methods

__init__()

get_gradient(annihilation_operator, times)

Return the gradient of the system.

get_gradient_at_timestep(...)

Get the one-time gradient of the system.

get_parameters()

Return all parameters of this class that can be optimized.

get_value(annihilation_operator, times)

Return the matrix representation of the drive.

get_value_at_timestep(annihilation_operator, t)

Return the matrix representation of the drive.

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

all_optimizable_parameters

Get the optimizable parameters

name

Get the name of the parameter.

optimizable_parameters

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]

get_gradient(annihilation_operator, times)[source]#

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

abstract get_gradient_at_timestep(annihilation_operator, timestep)[source]#

Get the one-time 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.

  • timestep (float) – One time step.

Returns:

Array of shape [p, n, n] with ‘p’ as the number of parameters and ‘n’ as the Hilbert space dimension.

Return type:

Array

abstract get_parameters()[source]#

Return all parameters of this class that can be optimized.

Raises:

NotImplementedError – Subclasses derived from this class must implement this method.

Return type:

list[Quantity]

get_value(annihilation_operator, times)[source]#

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

abstract get_value_at_timestep(annihilation_operator, t)[source]#

Return the matrix representation of the drive.

The dimension is given by the Hamiltonian to which this drive is attached.

Parameters:
  • annihilation_operator (Array) – Operator of the subsystem to which this drive is attached.

  • t (float) – One time point.

Returns:

Matrix of shape [n, n] with n as the Hilbert space dimension.

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)[source]#

Set all optimizable parameters in the optimization.

Parameters:
  • params (List[Quantity]) – List of optimizable parameters to be set.

  • all_params (list[Quantity])

Return type:

None

set_optimizable_parameters(params)[source]#

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