rydiqule.sensor_utils.generate_eom

rydiqule.sensor_utils.generate_eom(hamiltonian: ndarray, gamma_matrix: ndarray, remove_ground_state: bool = True, real_eom: bool = True) Tuple[ndarray, ndarray][source]

Create the optical bloch equations for a hamiltonian and decoherence matrix using the Lindblad master equation.

Parameters:
  • hamiltonian (numpy.ndarray) – Complex array representing the Hamiltonian matrix of the system, the matrix should be of shape (*l, n, n), where n is the basis size and l is the shape of the stack of hamiltonians. For example, if the hamiltonian varies in 2 parameters l might be (10, 10).

  • gamma_matrix (numpy.ndarray) – Complex array representing the decoherence matrix of the system, the matrix should be of size (n, n), where n is the basis size.

  • remove_ground_state (bool, optional) – Remove the ground state from the equations of motion using population conservation. Setting to False is intended for internal use only and is not officially supported. See remove_ground() for details.

  • real_eom (bool, optional) – Transform the equations of motion from the complex basis to the real basis. Setting to False is intended for internal use only and is not officially supported. Seee make_real() for details.

Returns:

  • equations (numpy.ndarray) – The array representing the Optical Bloch Equations (OBEs) of the system. The shape will be (*l, n^2-1, n^2-1) if remove_ground_state is True and (*l, n^2, n^2) otherwise. The datatype will be np.float64 if real_eom is True and np.complex128 otherwise.

  • const (numpy.ndarray) – Array of which defines the constant term in the linear OBEs. The shape will be (*l, n^2-1) if remove_ground_state is True and (*l, n^2) otherwise. The datatype will be np.float64 if real_eom is True and np.complex128 otherwise.

Raises:

RydiquleError – If the shapes of gamma_matrix and hamiltonian are not matching: or not square in the last 2 dimensions

Examples

>>> ham = np.diag([1,-1])
>>> gamma = np.array([[.1, 0],[.1,0]])
>>> print(ham.shape)
(2, 2)
>>> eom, const = rq.sensor_utils.generate_eom(ham, gamma)
>>> print(eom)
[[-0.1  2.   0. ]
 [-2.  -0.1  0. ]
 [ 0.   0.  -0.1]]
>>> print(const.shape)
(3,)

This also works with a “stack” of multiple hamiltonians:

>>> ham_base = np.diag([1,-1])
>>> ham_full = np.array([ham_base for _ in range(10)])
>>> gamma = np.array([[.1, 0],[.1,0]])
>>> print(ham_full.shape)
(10, 2, 2)
>>> eom, const = rq.sensor_utils.generate_eom(ham_full, gamma)
>>> print(eom.shape)
(10, 3, 3)
>>> print(const.shape)
(10, 3)