paraqeet.model.composite_hamiltonian.CompositeHamiltonian#
- class paraqeet.model.composite_hamiltonian.CompositeHamiltonian(subsystems, couplings=None)#
Bases:
DifferentiableHamiltonianA 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)#
- Parameters:
subsystems (list[DifferentiableHamiltonian])
couplings (list[TwoBodyCoupling] | None)
Methods
__init__(subsystems[, couplings])Return the dimension of the system.
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.
Collect parameters from all subsystems and couplings.
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
Get the optimizable parameters
Return the list of Drives of 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]
- dimension()#
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()#
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)#
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()#
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()#
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)#
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)#
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)#
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)#
Set all optimizable parameters in the optimization.