qiskit_dynamics.perturbation.solve_lmde_perturbation#

solve_lmde_perturbation(perturbations, t_span, expansion_method, expansion_order=None, expansion_labels=None, perturbation_labels=None, generator=None, y0=None, dyson_in_frame=True, integration_method='DOP853', t_eval=None, **kwargs)[source]#

Compute time-dependent perturbation theory terms for an LMDE.

This function computes multi-variable Dyson or Magnus expansion terms via the algorithm in [1], or Dyson-like terms via the algorithm in [2]. See the review on time-dependent perturbation theory to understand the details and notation used in this documentation.

Which expansion is used is specified by the expansion_method argument, which impacts the interpretation of several of the function arguments (described below). Regardless of expansion_method, the main computation is performed by solving a differential equation, utilizing solve_ode(), and as such several of the function arguments are direct inputs into this function:

  • integration_method is the ODE method used (passed as method to solve_ode()), t_span is the integration interval, and t_eval is an optional set of points to evaluate the perturbation terms at.

  • kwargs are passed directly to solve_ode(), enabling passing through of tolerance or step size arguments.

Other arguments which are treated the same regardless off expansion_method are:

  • generator is the unperturbed generator, and the computation is performed in the toggling frame of this generator.

If expansion_method in ['dyson', 'magnus'], this function computes either multivariable Dyson series or Magnus expansion terms. That is, given a (finitely truncated) power series for the generator:

\[G(t, c_0, \dots, c_{r-1}) = G_\emptyset(t) + \sum_{k=1}^\infty \sum_{I \in \mathcal{I}_k(r)} c_I G_I(t),\]

this function computes, in the toggling frame of \(G_\emptyset(t)\) given by generator, either a collection of multivariable Dyson terms \(\mathcal{D}_I(t)\) or multivariable Magnus terms \(\mathcal{O}_I(t)\), whose definitions are given in the perturbation theory review. In this case, the arguments to the function are interpreted as follows:

  • perturbations and perturbation_labels specify the truncated generator power series. perturbations provides a list of python callable functions for the non-zero \(G_I(t)\), and the perturbation_labels is a list of the corresponding multiset labels \(I\), in the form of Multiset instances. If not specified, the labels are assumed to be [Multiset({0: 1}), ..., Multiset({len(perturbations) - 1: 1})].

  • expansion_order and expansion_labels specify which terms in the chosen expansion are to be computed. expansion_order specifies that all expansion terms up to a given order are to be computed, and expansion_labels specifies individual terms to be computed, specified as Multiset instances. At least one of expansion_order and expansion_labels must be specified. If both are specified, then all terms up to expansion_order will be computed, along with any additional specific terms given by expansion_labels.

Note that in the above, this function requires that the Multisets consist of non-negative integers. Arguments requiring lists of Multiset instances also accept lists of any valid format acceptable to the Multiset constructor (modulo the non-negative integer constraint).

If expansion_method == 'dyson_like', the setup is different. In this case, for a list of matrix-valued functions \(G_0(t), \dots, G_{r-1}(t)\), this function computes integrals of the form

\[\int_{t_0}^{t_F} dt_1 \int_{t_0}^{t_1} dt_2 \dots \int_{t_0}^{t_{k-1}}dt_k \tilde{G}_{i_1}(t_1) \dots \tilde{G}_{i_k}(t_k),\]

for lists of integers \([i_1, \dots, i_k]\), and similar to the other cases, \(\tilde{G}_j(t) = V(t)^\dagger G_j(t)V(t)\), i.e. the computation is performed in the toggling frame specified by generator.

  • perturbations gives the list of matrix functions as callables \(G_0(t), \dots, G_{r-1}(t)\).

  • perturbation_labels is not used in this mode.

  • expansion_order specifies that all possible integrals of the above form should be computed up to a given order (i.e. integrals up to a given order with all possible orderings of the \(G_0(t), \dots, G_{r-1}(t)\)).

  • expansion_labels allows for specification of specific terms to be computed. In this case, a term is specified by a list of ints, where the length of the list is the order of the integral, and the \(G_0(t), \dots, G_{r-1}(t)\) appear in the integral in the order given by the list.

Finally, additional optional arguments which can be used in the 'dyson' and 'dyson_like' cases are:

  • dyson_in_frame controls which frame the results are returned in. The default is True, in which case the results are returned as described above. If False, the returned results include a pre-factor of \(V(t)\), the solution of the unperturbed generator, e.g. \(V(t)\mathcal{D}_I(t)\). If expansion_method=='magnus', this argument has no effect on the computation.

  • y0 is the initial state for the LMDE given by the unperturbed generator. The effect of this argument on the output is to multiply all outputs by y0 on the right. If y0 is supplied, the argument dyson_in_frame must be False, as the operator \(V(t)\) is never explicitly computed, and therefore it cannot be removed from the results. If y0 is 1d, it will first be transformed into a 2d column vector to ensure consistent usage of matrix multiplication.

Regardless of the value of expansion_method, results are returned in an OdeResult instance in the same manner as solve_ode(). The result object stores the solution of the LMDE for generator and y0 as if these were passed directly to solve_ode() before, as well as the computed perturbation theory terms in the additional attribute perturbation_data. If expansion_method in ['dyson', 'magnus'], the perturbation_data attribute stores a PowerSeriesData instance, and if expansion_method == 'dyson_like', it stores a DysonLikeData instance. In either case, these are data container classes with the following attributes:

  • metadata: Containing expansion information.

  • labels: Index labels for all computed perturbation terms. In the case of the Dyson or Magnus expansion, the labels are Multiset instances, and in the ‘dyson_like’ case, they are lists of ints.

  • data: A 4d array storing all computed terms. The first axis indexes the expansion terms in the same ordering as labels, and the second axis indexes the perturbation terms evaluated at the times in results.t in the same manner as results.y.

Additionally, both the PowerSeriesData.get_item() and DysonLikeData.get_item() methods can be used to retrieve the results for a given perturbation term according to its label. E.g. the results for the term with label [0, 1] is retrievable via results.perturbation_data.get_term([0, 1]).

Parameters:
  • perturbations (List[Callable]) – List of matrix-valued callables.

  • t_span (Union[ndarray, number, int, float, complex, Tracer, Array, Array, spmatrix, BCOO, list]) – Integration bounds.

  • expansion_method (str) – Either 'dyson', 'magnus', or 'dyson_like'.

  • expansion_order (Optional[int]) – Order of perturbation terms to compute up to. Specifying this argument results in computation of all terms up to the given order. Can be used in conjunction with expansion_labels.

  • expansion_labels (Optional[List[Multiset]]) – Specific perturbation terms to compute. If both expansion_order and expansion_labels are specified, then all terms up to expansion_order are computed, along with the additional terms specified in expansion_labels.

  • perturbation_labels (Optional[List[Multiset]]) – Optional description of power series terms specified by perturbations. To only be used with 'dyson' and 'magnus' methods.

  • generator (Optional[Callable]) – Optional frame generator. Defaults to 0.

  • y0 (Union[ndarray, number, int, float, complex, Tracer, Array, Array, spmatrix, BCOO, list, None]) – Optional initial state for frame generator LMDE. Defaults to the identity matrix.

  • dyson_in_frame (Optional[bool]) – For expansion_method 'dyson' or 'dyson_like', whether or not to remove the frame transformation pre-factor from the Dyson terms.

  • integration_method (Optional[str]) – Integration method to use. Must be supported by solve_ode().

  • t_eval (Union[ndarray, number, int, float, complex, Tracer, Array, Array, spmatrix, BCOO, list, None]) – Points at which to evaluate the system.

  • **kwargs – Additional arguments to pass to ode integration method used to compute terms.

Returns:

Results object containing standard ODE results for LMDE given by generator and y0, with additional perturbation_data attribute containing the requested perturbation theory terms.

Return type:

OdeResult

Raises:

QiskitError – If problem with inputs, either expansion_method is unsupported, or both of expansion_order and expansion_labels unspecified.

References