calculate_colored_noise_simulation

static FunctionNamespace.calculate_colored_noise_simulation(*, duration, sample_times=None, drives=None, shifts=None, drifts=None, trajectory_count=1, initial_state_vector=None, target=None, result_scope='ALL', **kwargs)

Perform the evolution of a closed quantum system with noisy controls.

Use this function to simulate the dynamics of a system under a Hamiltonian expressed as a sum of piecewise-constant terms, some of which are noisy. The function creates a set of trajectories corresponding to different noise realizations and calculates, for each trajectory, the resulting unitary evolution operator, the infidelity with respect to a given target operator, and the evolution of a given initial state. The function also calculates the average over all the trajectories of the infidelity and the density matrix.

When using this function, you must provide at least one term in drives, shifts, or drifts.

Parameters:
  • duration (float) – The duration of the simulation, \(\tau\). Must be positive and match the duration of each control pulse in drives and shifts.

  • sample_times (List[float], optional) – The times at which you want to sample the simulation. If provided, it must contain at least one element, be increasing, and each element must be between 0 and \(\tau\) (inclusive). Defaults to a singleton array containing duration.

  • drives (List[qctrl.dynamic.types.colored_noise_simulation.Drive], optional) – The list of complex control terms in the system’s Hamiltonian. Each term has the form \(\left(1 + \beta_{\gamma_{j}}(t) \right) \left(\gamma_{j}(t) C_{j} + \mathrm{H.c.}\right)\), where \(C_{j}\) is a non-Hermitian operator, \(\gamma_{j}(t)\) is a complex piecewise-constant function between 0 and \(\tau\), and \(\beta_{\gamma_{j}}(t)\) is the amplitude of its noise. Defaults to an empty list.

  • shifts (List[qctrl.dynamic.types.colored_noise_simulation.Shift], optional) – The list of real control terms in the system’s Hamiltonian. Each term has the form \(\left(1 + \beta_{\alpha_{k}}(t) \right) \alpha_{k}(t) A_{k}\), where \(A_{k}\) is a Hermitian operator, \(\alpha_{k}(t)\) is a real piecewise-constant function between 0 and \(\tau\), and \(\beta_{\alpha_{k}}(t)\) is the amplitude of its noise. Defaults to an empty list.

  • drifts (List[qctrl.dynamic.types.colored_noise_simulation.Drift], optional) – The list of static or pure noise terms in the system’s Hamiltonian. Each term has the form \(D_{l}\) or \(\beta_{D_{l}}(t) D_{l}\), where \(D_{l}\) is a Hermitian operator and \(\beta_{D_{l}}(t)\) is a noise amplitude. Defaults to an empty list.

  • trajectory_count (int, optional) – The number of noise simulation trajectories to generate, \(N_\mathrm{traj}\), each with independently sampled noise realizations. Defaults to 1.

  • initial_state_vector (ndarray, optional) – The initial state vector to be evolved, \(|\psi(0)\rangle\). If provided, the function calculates its evolution at the sample times for each trajectory and the trajectory-averaged density matrix.

  • target (qctrl.dynamic.types.TargetInput, optional) – The target partial isometry, \(V\). If provided, the function calculates the infidelity with respect to it at the sample times for each trajectory, and the average and standard error of the infidelity over all trajectories.

  • result_scope (qctrl.dynamic.types.colored_noise_simulation.ResultScope, optional) – Configuration for the scope of the returned data. Use this to select which data you want returned and which you want to omit.

Returns:

The result of the colored noise simulation. It includes, for each trajectory, the realizations for each control noise \(\{\beta_{\mu}(t)\}\) and the values at the sample times of the unitary evolution operator \(U(t)\), the target operation infidelity \(\mathcal{I}(t)\) (if requested), and the evolved state_vector \(|\psi(t)\rangle\) (if requested). It also includes the average_infidelity \(\langle\mathcal{I}(t)\rangle\) (if requested) and average_density_matrix \(\rho(t)\) (if requested).

Return type:

qctrl.dynamic.types.colored_noise_simulation.Result

Warning

This is a legacy function that will be removed in the future. The recommended way of running simulations is through the calculate_graph function. You can read about how to use the calculate_graph function for simulations with noise in the How to simulate quantum dynamics subject to noise with graphs user guide.

See also

calculate_graph

Evaluate generic functions.

Notes

This function integrates the time-dependent Schrödinger equation,

\[i \frac{d U(t)}{d t} = H(t) U(t),\]

with the Hamiltonian

\[\begin{split}\begin{aligned} H(t) =& \sum_{j = 1}^{N_\mathrm{drives}} \left(1 + \beta_{\gamma_{j}}(t) \right) \left(\gamma_{j}(t) C_{j} + \text{H.c.} \right) + \sum_{k = 1}^{N_\mathrm{shifts}} (1 + \beta_{\alpha_{k}}(t)) \alpha_{k}(t) A_{k} \\ & + \sum_{l = 1}^{N_\mathrm{drifts}^{(\mathrm{noiseless})}} D_{l} + \sum_{l = 1}^{N_\mathrm{drifts}^{(\mathrm{noisy})}} \beta_{D_{l}}(t) D_{l} . \end{aligned}\end{split}\]

The function creates \(N_\mathrm{traj}\) trajectories, each with independently sampled realizations of the noise amplitudes \(\{\beta_{\mu}(t)\}\) in the noisy terms, obtained from the one-sided power spectral densities \(\{S_{\mu}(f)\}\) you provide. See qctrl.dynamic.types.colored_noise_simulation.Noise for more details.

The function returns the individual trajectories for each realization \(\nu \in (1, 2, \ldots, N_\mathrm{traj})\). Each trajectory includes the noise_realizations, with the durations and values of each piecewise segment for each noise amplitude \(\beta^{(\nu)}_\mu(t)\), and the samples, with the results of the trajectory simulation for each time in sample_times. These include the unitary evolution_operator \(U^{(\nu)}(t)\), the evolved state_vector \(|\psi^{(\nu)}(t)\rangle = U^{(\nu)}(t)|\psi(0)\rangle\) (if you provide initial_state_vector), and the infidelity with respect to target (if you provide it), calculated as

\[\mathcal{I}^{(\nu)}(t) = 1 - \left| \frac{\mathrm{Tr} \left(V^\dagger U^{(\nu)}(t)\right)} {\mathrm{Tr} \left(V^\dagger V\right)} \right|^2 .\]

The function also returns the average_samples with the average dynamics over all noise realizations. Namely, the average_infidelity (if you provide target)

\[\langle \mathcal{I}(t) \rangle = \frac{1}{N_\mathrm{traj}} \sum_{\nu=1}^{N_\mathrm{traj}} \mathcal{I}^{(\nu)}(t)\]

(with the corresponding standard error average_infidelity_uncertainty if \(N_\mathrm{traj}>1\)) and the average_density_matrix (if you provide an initial_state_vector),

\[\rho(t) = \frac{1}{N_\mathrm{traj}} \sum_{\nu=1}^{N_\mathrm{traj}} |\psi^{(\nu)}(t)\rangle\langle\psi^{(\nu)}(t)| .\]