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_methodargument, which impacts the interpretation of several of the function arguments (described below). Regardless ofexpansion_method, the main computation is performed by solving a differential equation, utilizingsolve_ode(), and as such several of the function arguments are direct inputs into this function:integration_methodis the ODE method used (passed asmethodtosolve_ode()),t_spanis the integration interval, andt_evalis an optional set of points to evaluate the perturbation terms at.kwargsare passed directly tosolve_ode(), enabling passing through of tolerance or step size arguments.
Other arguments which are treated the same regardless off
expansion_methodare:generatoris 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:perturbationsandperturbation_labelsspecify the truncated generator power series.perturbationsprovides a list of python callable functions for the non-zero \(G_I(t)\), and theperturbation_labelsis a list of the corresponding multiset labels \(I\), in the form ofMultisetinstances. If not specified, the labels are assumed to be[Multiset({0: 1}), ..., Multiset({len(perturbations) - 1: 1})].expansion_orderandexpansion_labelsspecify which terms in the chosen expansion are to be computed.expansion_orderspecifies that all expansion terms up to a given order are to be computed, andexpansion_labelsspecifies individual terms to be computed, specified asMultisetinstances. At least one ofexpansion_orderandexpansion_labelsmust be specified. If both are specified, then all terms up toexpansion_orderwill be computed, along with any additional specific terms given byexpansion_labels.
Note that in the above, this function requires that the Multisets consist of non-negative integers. Arguments requiring lists of
Multisetinstances also accept lists of any valid format acceptable to theMultisetconstructor (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.perturbationsgives the list of matrix functions as callables \(G_0(t), \dots, G_{r-1}(t)\).perturbation_labelsis not used in this mode.expansion_orderspecifies 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_labelsallows for specification of specific terms to be computed. In this case, a term is specified by a list ofints, 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_framecontrols which frame the results are returned in. The default isTrue, in which case the results are returned as described above. IfFalse, the returned results include a pre-factor of \(V(t)\), the solution of the unperturbed generator, e.g. \(V(t)\mathcal{D}_I(t)\). Ifexpansion_method=='magnus', this argument has no effect on the computation.y0is the initial state for the LMDE given by the unperturbed generator. The effect of this argument on the output is to multiply all outputs byy0on the right. Ify0is supplied, the argumentdyson_in_framemust beFalse, as the operator \(V(t)\) is never explicitly computed, and therefore it cannot be removed from the results. Ify0is 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 anOdeResultinstance in the same manner assolve_ode(). The result object stores the solution of the LMDE forgeneratorandy0as if these were passed directly tosolve_ode()before, as well as the computed perturbation theory terms in the additional attributeperturbation_data. Ifexpansion_method in ['dyson', 'magnus'], theperturbation_dataattribute stores aPowerSeriesDatainstance, and ifexpansion_method == 'dyson_like', it stores aDysonLikeDatainstance. 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 areMultisetinstances, and in the ‘dyson_like’ case, they are lists ofints.data: A 4d array storing all computed terms. The first axis indexes the expansion terms in the same ordering aslabels, and the second axis indexes the perturbation terms evaluated at the times inresults.tin the same manner asresults.y.
Additionally, both the
PowerSeriesData.get_item()andDysonLikeData.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 viaresults.perturbation_data.get_term([0, 1]).- Parameters:
perturbations (
List[Callable]) – List of matrix-valued callables.t_span (
Array) – 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 withexpansion_labels.expansion_labels (
Optional[List[Multiset]]) – Specific perturbation terms to compute. If bothexpansion_orderandexpansion_labelsare specified, then all terms up toexpansion_orderare computed, along with the additional terms specified inexpansion_labels.perturbation_labels (
Optional[List[Multiset]]) – Optional description of power series terms specified byperturbations. To only be used with'dyson'and'magnus'methods.generator (
Optional[Callable]) – Optional frame generator. Defaults to0.y0 (
Optional[Array]) – Optional initial state for frame generator LMDE. Defaults to the identity matrix.dyson_in_frame (
Optional[bool]) – Forexpansion_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.t_eval (
Optional[Array]) – 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
generatorandy0, with additionalperturbation_dataattribute containing the requested perturbation theory terms.- Return type:
OdeResult
- Raises:
QiskitError – If problem with inputs, either
expansion_methodis unsupported, or both ofexpansion_orderandexpansion_labelsunspecified.
References