paraqeet.model.composite_hamiltonian.CompositeHamiltonian#

class paraqeet.model.composite_hamiltonian.CompositeHamiltonian(subsystems, couplings=None)[source]#

Bases: DifferentiableHamiltonian

A hamiltonian that consists of subsystems and couplings.

This class takes care of the tensor products. The list of parameters will contain the parameters of all subsystems and couplings in the order they were added.

Parameters:
  • subsystems (list[DifferentiableHamiltonian]) – List of DifferentiableHamiltonians forming the subsystems of a composite system.

  • couplings (list[Coupling], optional) – List of couplings between the various subsystems

__init__(subsystems, couplings=None)[source]#
Parameters:

Methods

__init__(subsystems[, couplings])

dimension()

Return the dimension of the system.

get_collapseops()

Gather collapse operators from the subsystems and then tensor product them with identity to create the collapse operators of the right dimension.

get_gradient_at_timestep(time)

Return the gradient of each parameter as an array for one timestamp.

get_parameters()

Collect parameters from all subsystems and couplings.

get_subsystem_dimensions()

Return a list of dimensions of each subsystem in the composite Hamiltonian.

get_value(times)

Return the matrix representation of the Hamiltonian.

get_value_and_gradient(times)

Compute value and gradient for given timesteps.

get_value_at_timestep(timestep)

Get matrix representation of the Hamiltonian for a single time point.

set_all_optimizable_parameters(all_params)

Set all optimizable parameters in the optimization.

set_optimizable_parameters(params)

Set optimizable parameters for the system.

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]

dimension()[source]#

Return the dimension of the system.

Returns:

Dimension of the system.

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]

get_collapseops()[source]#

Gather collapse operators from the subsystems and then tensor product them with identity to create the collapse operators of the right dimension.

Return type:

list[tuple[Array, Array]]

get_gradient_at_timestep(time)[source]#

Return the gradient of each parameter as an array for one timestamp.

Collects the gradients from every subsystem and coupling and constructs the matrix in the dimension of the composite system.

Parameters:

time (float) – One time point.

Returns:

Gradient at time t.

Return type:

Array

get_parameters()[source]#

Collect parameters from all subsystems and couplings.

Parameters:

list[Quantity] – Returns the list of parameters of the system.

Return type:

list[Quantity]

get_subsystem_dimensions()[source]#

Return a list of dimensions of each subsystem in the composite Hamiltonian.

Returns:

list of dimension of each subsystem.

Return type:

list[int]

get_value(times)[source]#

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

get_value_and_gradient(times)[source]#

Compute value and gradient for given timesteps. The gradient call uses vmap over at_timestep methods.

Parameters:

times (Array)

Return type:

tuple[Array, Array]

get_value_at_timestep(timestep)[source]#

Get matrix representation of the Hamiltonian for a single time point.

Parameters:

timestep (float) – One time step.

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)[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 optimizable parameters for the system.

Forward parameters to the subsystems and couplings. All of them should find their own parameters in the list.

Parameters:

params (list[Quantity]) – Input list of parameters to be set.

Return type:

None