paraqeet.model.hamiltonian.Hamiltonian#

class paraqeet.model.hamiltonian.Hamiltonian(drives=None)#

Bases: Optimizable

Class definition for a matrix representation of a Hamiltonian.

Implementations can contain subsystems, couplings, and drive lines and have to take care of frame transformations. Derived classes need to implement the functions get_matrix, gradient, dimension, get_collapse_ops, get_value_at_timestep

Parameters:

drives (list[Drive]) – List of time-dependent drives.

__init__(drives=None)#
Parameters:

drives (list[Drive] | None)

Methods

__init__([drives])

dimension()

Return the dimension of the Hilbert space of this Hamiltonian.

get_collapseops()

Return a list tuples of decay rates and collapse operators for each subsystem.

get_parameters()

Return all parameters of this class that can be optimized.

get_value(times)

Return the matrix representation of the Hamiltonian.

get_value_at_timestep(timestep)

Return the matrix representation of the Hamiltonian.

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

drives

Return the list of Drives of the system.

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]

abstract dimension()#

Return the dimension of the Hilbert space of this Hamiltonian.

Returns:

Returns the dimension of the Hilbert space of this Hamiltonian.

Return type:

int

property drives: list[Drive]#

Return the list of Drives of the system.

Returns:

Returns a list of time-dependent drives of the system.

Return type:

list[Drive]

abstract get_collapseops()#

Return a list tuples of decay rates and collapse operators for each subsystem.

Returns:

List of collapse operators

Return type:

list[Tuple[Array, Array]]

abstract get_parameters()#

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(times)#

Return the matrix representation of the Hamiltonian.

The default implementation calls get_value_at_timestep for each time step. Subclasses can override this function for a more efficient implementation.

Parameters:

times (Array) – Vector of time samples.

Returns:

Hamiltonian of shape [t, n, n] with ‘t’ as time and ‘n’ as the Hilbert space dimension.

Return type:

Array

abstract get_value_at_timestep(timestep)#

Return the matrix representation of the Hamiltonian.

Parameters:

timestep (float) – One time point.

Returns:

Hamiltonian 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)#

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)#

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