hqs_quantum_solver.lindblad#

Implementation of the Lindblad equation.

Classes

HamiltonianProtocol(*args, **kwargs)

Requirement for an Hamiltonian used in a Linbladian.

Lindbladian(hamiltonian, gamma_z, gamma_p, ...)

The operator \(\mathcal{L}\) of the Lindblad equation.

class HamiltonianProtocol(*args, **kwargs)#

Requirement for an Hamiltonian used in a Linbladian.

__init__(*args, **kwargs)#
property codomain: T_co#

The codomain of the operator.

property domain: T_co#

The domain of the operator.

dot(x: ndarray, out: ndarray | None = None) ndarray#

Compute the dot product of operator with array; optional out to avoid reallocation.

When represented by NumPy this operation would be A @ x.

Parameters:
  • x (np.ndarray) – The vector/array to dot product with.

  • out (Optional[np.ndarray]) – Optional array to store results and avoid reallocation.

Returns:

The result of the dot product, A @ x.

Return type:

np.ndarray

dot_add(x: ndarray, out: ndarray, z: float | complex = 1.0) None#

Compute the dot product of operator with array and add it to out array.

When represented by NumPy this operation would be out += z * (A @ x).

Parameters:
  • x (np.ndarray) – The vector/array to dot product with.

  • out (np.ndarray) – The array to which the outcome will be added.

  • z (complex) – scalar prefactor before addition, defaults to unity.

dot_h(x: ndarray, out: ndarray | None = None) ndarray#

Compute the dot product of operator adjoint with array, allows optional out.

When represented by NumPy this operation would be A.conj().T @ x. Though transpose returns only a view of a matrix, conjugate returns a copy, hence this method.

Parameters:
  • x (np.ndarray) – The vector/array to dot product with.

  • out (Optional[np.ndarray]) – Optional array to store results and avoid reallocation.

Returns:

The result of the dot product, A.conj().T @ x.

Return type:

np.ndarray

property dtype: OperatorDType#

The type of the scalar elements of the vector space that is acted on.

rdot(x: ndarray) ndarray#

Compute the dot product of array with operator.

When represented by NumPy this operation would be x @ A.

Parameters:

x (np.ndarray) – The vector/array to dot product with.

Returns:

The result of the dot product, x @ A.

Return type:

np.ndarray

rdot_h(x: ndarray) ndarray#

Compute the dot product of array with operator adjoint.

When represented by NumPy this operation would be x @ A.conj().T.

Parameters:

x (np.ndarray) – The vector/array to dot product with.

Returns:

The result of the dot product, x @ A.conj().T.

Return type:

np.ndarray

property shape: Tuple[int, int]#

The shape=(int, int) of the operator.

Returns:

The shape of the operator.

Return type:

Tuple[int, int]

todense() ndarray#

Return the operator as a dense matrix.

Returns:

The operator as a dense matrix.

Return type:

np.ndarray

class Lindbladian(hamiltonian: OperatorType, gamma_z: ndarray, gamma_p: ndarray, gamma_m: ndarray)#

The operator \(\mathcal{L}\) of the Lindblad equation.

The Lindblad equation is given by

\[\newcommand{\iu}{\mathrm{i}} \iu \hbar \dot\rho(t) = \mathcal{L}\rho(t) \,,\]

where

\[\begin{split}\begin{aligned} \mathcal{L}\rho = [H, \rho] &+ \iu \hbar \sum_{i=0}^{M-1} \sum_{j=0}^{M-1} \gamma_{ij}^z \big( S^z_i \rho S^z_j - \tfrac12 S^z_j S^z_i \rho - \tfrac12 \rho S^z_j S^z_i \big) \\ &+ \iu \hbar \sum_{i=0}^{M-1} \sum_{j=0}^{M-1} \gamma_{ij}^+ \big( S^+_i \rho S^-_j - \tfrac12 S^-_j S^+_i \rho - \tfrac12 \rho S^-_j S^+_i \big) \\ &+ \iu \hbar \sum_{i=0}^{M-1} \sum_{j=0}^{M-1} \gamma_{ij}^- \big( S^-_i \rho S^+_j - \tfrac12 S^+_j S^-_i \rho - \tfrac12 \rho S^+_j S^-_i \big) \,. \end{aligned}\end{split}\]

The computation is carried out in units where \(\hbar = 1\).

Lindbladian constructor.

Parameters:
  • M (int) – The number of sites in the system.

  • hamiltonian (SpinOperatorProtocol) – The underlying Hamiltonian \(H\).

  • gamma_z (ndarray, shape (M,) | ndarray, shape (M,M)) – The \(\gamma^z\) coefficient matrix. When a vector is given, the argument is interpreted as the diagonal elements of a diagonal matrix.

  • gamma_p (ndarray, shape (M,) | ndarray, shape (M,M)) – The \(\gamma^+\) coefficients. When a vector is given, the argument is interpreted as the diagonal elements of a diagonal matrix.

  • gamma_m (ndarray, shape (M,) | ndarray, shape (M,M)) – The \(\gamma^-\) coefficients. When a vector is given, the argument is interpreted as the diagonal elements of a diagonal matrix.

property M: int#

The total number of sites.

property Sz: int#

Implements SpinProtocol.Sz().

__init__(hamiltonian: OperatorType, gamma_z: ndarray, gamma_p: ndarray, gamma_m: ndarray) None#

Lindbladian constructor.

Parameters:
  • M (int) – The number of sites in the system.

  • hamiltonian (SpinOperatorProtocol) – The underlying Hamiltonian \(H\).

  • gamma_z (ndarray, shape (M,) | ndarray, shape (M,M)) – The \(\gamma^z\) coefficient matrix. When a vector is given, the argument is interpreted as the diagonal elements of a diagonal matrix.

  • gamma_p (ndarray, shape (M,) | ndarray, shape (M,M)) – The \(\gamma^+\) coefficients. When a vector is given, the argument is interpreted as the diagonal elements of a diagonal matrix.

  • gamma_m (ndarray, shape (M,) | ndarray, shape (M,M)) – The \(\gamma^-\) coefficients. When a vector is given, the argument is interpreted as the diagonal elements of a diagonal matrix.

apply_von_neumann(rho: ndarray) ndarray#

Apply operator from the von Neumann equation.

Computes

\[\rho \mapsto \left[ H, \rho \right] \,.\]
Parameters:

rho (ndarray, shape (n,n)) – The density matrix to which the operator is applied to.

Returns:

The result of applying the operator to the density matrix rho.

Return type:

ndarray, shape (n, n)

dot(x: ndarray, out: ndarray | None = None) ndarray#

Implements SimpleOperatorProtocol.dot().

dot_add(x: ndarray, out: ndarray, z: float | complex = 1.0) None#

Implements SimpleOperatorProtocol.dot_add().

property dtype: OperatorDType#

The type of the scalar elements of the vector space that is acted on.

property hamiltonian: OperatorType#

The underlying Hamiltonian \(H\).

property mod_Sz: int#

Implements SpinProtocol.mod_Sz().

property shape: tuple[int, int]#

Implements SimpleOperatorProtocol.shape().

property spin_representation: int#

Implements SpinProtocol.spin_representation().