Graph.density_matrix_evolution_pwc(initial_density_matrix, hamiltonian, lindblad_terms, sample_times=None, krylov_subspace_dimension=None, error_tolerance=None, *, name=None)

Calculates the state evolution of an open system described by the GKS–Lindblad master equation.

The controls that you provide to this function have to be in piecewise constant format. If your controls are smooth sampleable tensor-valued functions (STFs), you have to discretize them with discretize_stf before passing them to this function. You may need to increase the number of segments that you choose for the discretization depending on the sizes of oscillations in the smooth controls.

By default, this function computes the exact piecewise constant solution and might be inefficient for simulating large systems. In that case, you may use an approximated method by passing the error_tolerance parameter, which controls the computation precision.

  • initial_density_matrix (np.ndarray or Tensor) – A 2D array of the shape [D, D] representing the initial density matrix of the system, \(\rho_{\rm s}\). You can also pass a batch of density matrices and the input data shape must be [B, D, D] where B is the batch dimension.

  • hamiltonian (Pwc or SparsePwc) – A piecewise-constant function representing the effective system Hamiltonian, \(H_{\rm s}(t)\), for the entire evolution duration. If you pass any Lindblad operator as a dense array, the Hamiltonian will get converted to a (dense) Pwc.

  • lindblad_terms (list[tuple[float, np.ndarray or scipy.sparse.coo_matrix]]) – A list of pairs, \((\gamma_j, L_j)\), representing the positive decay rate \(\gamma_j\) and the Lindblad operator \(L_j\) for each coupling channel \(j\). If you pass the Hamiltonian as a Pwc, the operators will get converted to dense operators.

  • sample_times (np.ndarray, optional) – A 1D array of length \(T\) specifying the times \(\{t_i\}\) at which this function calculates system states. Must be ordered and contain at least one element. Note that increasing the density of sample times does not affect the computation precision of this function.

  • krylov_subspace_dimension (deprecated) – This parameter is to be deprecated and has no effect on the calculation. Assigning a value to this parameter is equivalent to setting error_tolerance to 1e-7.

  • error_tolerance (float, optional) – Defaults to None, meaning this function calculates the exact piecewise constant solution. Use this option to invoke an approximation method to solve the master equation. This tolerance controls the computation precision. That is, the 2-norm of the difference between the propagated state and the exact solution at the final time (and at each sample time if passed) is within the error tolerance. Note that, if set, this value must be smaller than 1e-2 (inclusive). However, setting it to a too small value (for example below 1e-12) might result in slower computation, but would not further improve the precision, since the dominating error in that case is due to floating point error. A recommended value is around 1e-7.

  • name (str, optional) – The name of the node.


Systems states at sample times. The shape of the return value is [D, D] or [T, D, D], depending on whether you provide sample times. Otherwise, the shape is [B, T, D, D] if you provide a batch of initial states.

Return type


See also


Discretize an Stf into a Pwc.


Create SparsePwc operators.


Corresponding operation for coherent evolution.


Under Markovian approximation, the dynamics of an open quantum system can be described by the GKS–Lindblad master equation 1 2

\[\frac{{\rm d}\rho_{\rm s}(t)}{{\rm d}t} = -i [H_{\rm s}(t), \rho_{\rm s}(t)] + \sum_j \gamma_j {\mathcal D}[L_j] \rho_{\rm s}(t) \;,\]

where \({\mathcal D}\) is a superoperator describing the decoherent process in the system evolution and defined as

\[{\mathcal D}[X]\rho := X \rho X^\dagger - \frac{1}{2}\left( X^\dagger X \rho + \rho X^\dagger X \right)\]

for any system operator \(X\).

This function uses sparse matrix multiplication when the Hamiltonian is passed as a SparsePwc and the Lindblad operators as sparse matrices. This leads to more efficient calculations when they involve large operators that are relatively sparse (contain mostly zeros). In this case, the initial density matrix is still a densely represented array or tensor.



V. Gorini, A. Kossakowski, and E. C. G. Sudarshan, Journal of Mathematical Physics 17, 821 (1976).


G. Lindblad, Communications in Mathematical Physics 48, 119 (1976).