paraqeet.model.closed_system.ClosedSystem#

class paraqeet.model.closed_system.ClosedSystem(hamiltonian, ode_propagation=False)[source]#

Bases: EquationOfMotion

Model of a closed physical system, defined by a Hamiltonian.

Its dynamics is given by the Schrödinger equation.

Parameters:
  • hamiltonian (Hamiltonian) – Matrix representation of a Hamiltonian.

  • ode_propagation (bool)

__init__(hamiltonian, ode_propagation=False)[source]#
Parameters:

Methods

__init__(hamiltonian[, ode_propagation])

get_parameters()

Get a list of optimizable parameters.

get_right_hand_side(time, state)

Return the right-hand side of the equations of motion.

get_value(times)

Get the matrix equations of motion.

get_value_and_gradient(times)

Compute the gradient of getMatrix.

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.

ode_propagation

Flag to set method of propagation to ODE.

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

Get a list of optimizable parameters.

Returns:

List of optimizable parameters of the system.

Return type:

List[Quantity]

get_right_hand_side(time, state)[source]#

Return the right-hand side of the equations of motion.

The format depends on the implementation and could for example be a state vector or a matrix. Default implementation assumes a homogeneous ODE with matrix operator given by self.getMatrix().

Parameters:
  • time (Array) – Any one-dimensional vector of timestamps.

  • state (Array)

Returns:

The right-hand side of the equation of motion at each time stamp.

Return type:

Array

get_value(times)[source]#

Get the matrix equations of motion.

Computes the right hand side of the Schrödinger equation without multiplying the state. Used for unitary solvers.

Parameters:

times (Array) – Vector of time samples.

Returns:

RHS with dimension [t, n, n] with ‘t’ as time and ‘n’ as Hilbert space dimension.

Return type:

Array

get_value_and_gradient(times)[source]#

Compute the gradient of getMatrix.

Parameters:

times (Array) – Vector of time samples.

Returns:

Returns the gradient of getMatrix.

Return type:

Array

property name: str | None#

Get the name of the parameter.

Returns:

Name of the parameter.

Return type:

str | None

property ode_propagation: bool#

Flag to set method of propagation to ODE.

Returns:

Flag to use ODE propagation.

Return type:

bool

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