# jump_trajectory_evolution_pwc

Source: https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/jump_trajectory_evolution_pwc

```python
Graph.jump_trajectory_evolution_pwc(initial_state_vector, hamiltonian, lindblad_terms, max_time_step, trajectory_count, sample_times=None, seed=None, *, name=None)
```

Calculate the state evolution of an open system described by the GKS–Lindblad master
equation using a jump-based trajectory method.

This function calculates multiple pure-state trajectories starting from an initial pure
state and returns the average density matrix over all trajectories.

Note that regardless of their original formats, both hamiltonian and lindblad_terms
are internally converted to a dense representation, so there is no computational advantage
in using a sparse representation with this method.

### Parameters
* **initial_state_vector** (*np.ndarray* *or* [*Tensor*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Tensor.md#boulderopal.graph.Tensor)) – The initial state vector $|\psi\rangle$ as a `(D,)` array or Tensor,
  or batch of initial state vectors as a `(B, D)` array or Tensor.
* **hamiltonian** ([*Pwc*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Pwc.md#boulderopal.graph.Pwc) *or* [*SparsePwc*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/SparsePwc.md#boulderopal.graph.SparsePwc)) – A piecewise-constant function representing the system Hamiltonian,
  $H_{\mathrm s}(t)$, for the entire evolution duration,
  with Hilbert space dimension D.
* **lindblad_terms** (*list* *[* *tuple* *[* *float* *,* *np.ndarray* *or* [*Tensor*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Tensor.md#boulderopal.graph.Tensor) *or* *scipy.sparse.spmatrix* *]* *]*) – 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$. You must provide at least one Lindblad term.
* **max_time_step** (*float*) – The maximum time step to use in the integration.
  Each PWC segment will be subdivided into steps that are, at most, this value.
  A smaller value for the maximum time step will more accurately sample the jump
  processes, but also lead to a slower computation.
* **trajectory_count** (*int*) – The number of quantum trajectories to run.
* **sample_times** (*np.ndarray* *or* *None* *,* *optional*) – A 1D array like object of length $T$ specifying the times $\{t_i\}$ at
  which this function calculates system states. Must be ordered and contain at least
  one element. If omitted only the evolved density matrix at the final time of the
  system Hamiltonian is returned. Note that increasing the density of sample times
  does not affect the computation precision of this function, but might slow down
  the calculation.
* **seed** (*int* *or* *None* *,* *optional*) – A seed for the random number generator.
  Defaults to None, in which case a random value for the seed is used.
* **name** (*str* *,* *optional*) – The name of the node.
### Returns
The time-evolved density matrix, with shape `(D, D)` or `(T, D, D)`,
depending on whether you provided sample times.
If you provide a batch of initial states, the shape is `(B, T, D, D)`
or `(B, D, D)`.
### Return type
[Tensor](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Tensor.md#boulderopal.graph.Tensor)

### SEE ALSO
[`Graph.density_matrix_evolution_pwc`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/density_matrix_evolution_pwc.md#boulderopal.graph.Graph.density_matrix_evolution_pwc)
: State evolution of an open quantum system.

[`Graph.steady_state`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/steady_state.md#boulderopal.graph.Graph.steady_state)
: Compute the steady state of open quantum system.

## Notes

Under the Markovian approximation, the dynamics of an open quantum system can be described
by the GKS–Lindblad master equation <sup>[1](#id3)</sup> <sup>[2](#id4)</sup>

$$
\frac{{\mathrm d}\rho_{\mathrm s}(t)}{{\mathrm d}t} =
-i [H_{\mathrm s}(t), \rho_{\mathrm s}(t)]
+ \sum_j \gamma_j {\mathcal D}[L_j] \rho_{\mathrm 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 solves the GKS–Lindblad master equation with an initial pure state
$\rho_{\mathrm s}(0) = |\psi\rangle\langle\psi|$, by calculating
multiple quantum trajectories performing quantum jumps,
$|\tilde\psi_k(t)\rangle$, and averaging the result:

$$
\rho(t) = \frac{1}{M} \sum_{k=1}^M |\tilde\psi_k(t) \rangle\langle \tilde\psi_k(t) | .
$$

## References

* <a id='id3'>**[1]**</a> [V. Gorini, A. Kossakowski, and E. C. G. Sudarshan, J. Math. Phys. 17, 821 (1976).](https://doi.org/10.1063/1.522979)
* <a id='id4'>**[2]**</a> [G. Lindblad, Commun. Math. Phys. 48, 119 (1976).](https://doi.org/10.1007/BF01608499)
