paraqeet.model.coupling.TwoBodyCoupling#

class paraqeet.model.coupling.TwoBodyCoupling(subsystem_A, subsystem_B, coefficient, is_longitudinal, use_rwa=False)[source]#

Bases: Optimizable

Create a coupling optimizable model.

Represents the coupling of two or more subsystems in a composite Hamiltonian. This class implements longitudinal and transversal coupling with a constant scalar coefficient. The coefficient is the only optimizable parameter. Subclasses can alter the behavior by overriding the get_couplings function.

Parameters:
  • subsystems (list[Hamiltonian]) – The coupled subsystems.

  • coefficient (Quantity) – Either a constant coefficient as float or a callable that returns the coefficient for a given time.

  • is_longitudinal (bool) – Whether the coupling is longitudinal or transversal.

  • use_rwa (bool, optional) – If the transversal coupling should use the rotating-wave approximation or should include double excitation terms.

  • subsystem_A (DifferentiableHamiltonian)

  • subsystem_B (DifferentiableHamiltonian)

__init__(subsystem_A, subsystem_B, coefficient, is_longitudinal, use_rwa=False)[source]#
Parameters:

Methods

__init__(subsystem_A, subsystem_B, ...[, ...])

get_coupling_gradients()

Return the gradients of the coupling terms.

get_couplings()

Return the matrix representation of a time-indepedent coupling.

get_parameters()

Collect parameters from all subsystems and couplings.

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

subsystem_A

Return subsystem A that is coupled by this term.

subsystem_B

Return subsystem A that is coupled by this term.

subsystems

Return the subsystems as a list to be compatible with other couplings with potentially more subsystems.

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

Return the gradients of the coupling terms.

Returns:

The outer list represents the gradients with respect to all optimized parameters. The rest is in the same shape as the result of get_matrices.

Return type:

list[Array]

get_couplings()[source]#

Return the matrix representation of a time-indepedent coupling.

Returns:

The outer list are the coupling terms. The inner list represents the subsystems. The matrices (Array) have the same shape as the subsystem’s Hamiltonian.get_value: (t,n,n) with t the time and n the subsystem dimension.

Return type:

list[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]

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

property subsystem_A: DifferentiableHamiltonian#

Return subsystem A that is coupled by this term.

Returns:

List of subsystems.

Return type:

list[Hamiltonian]

property subsystem_B: DifferentiableHamiltonian#

Return subsystem A that is coupled by this term.

Returns:

List of subsystems.

Return type:

list[Hamiltonian]

property subsystems: list[DifferentiableHamiltonian]#

Return the subsystems as a list to be compatible with other couplings with potentially more subsystems.