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 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_method
is the ODE method used (passed asmethod
tosolve_ode()
),t_span
is the integration interval, andt_eval
is an optional set of points to evaluate the perturbation terms at.kwargs
are passed directly tosolve_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
andperturbation_labels
specify the truncated generator power series.perturbations
provides a list of python callable functions for the non-zero \(G_I(t)\), and theperturbation_labels
is a list of the corresponding multiset labels \(I\), in the form ofMultiset
instances. If not specified, the labels are assumed to be[Multiset({0: 1}), ..., Multiset({len(perturbations) - 1: 1})]
.expansion_order
andexpansion_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, andexpansion_labels
specifies individual terms to be computed, specified asMultiset
instances. At least one ofexpansion_order
andexpansion_labels
must be specified. If both are specified, then all terms up toexpansion_order
will 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
Multiset
instances also accept lists of any valid format acceptable to theMultiset
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 ofint
s, 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 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.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 byy0
on the right. Ify0
is supplied, the argumentdyson_in_frame
must beFalse
, as the operator \(V(t)\) is never explicitly computed, and therefore it cannot be removed from the results. Ify0
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 anOdeResult
instance in the same manner assolve_ode()
. The result object stores the solution of the LMDE forgenerator
andy0
as 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_data
attribute stores aPowerSeriesData
instance, and ifexpansion_method == 'dyson_like'
, it stores aDysonLikeData
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 areMultiset
instances, and in the ‘dyson_like’ case, they are lists ofint
s.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.t
in 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 (
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 withexpansion_labels
.expansion_labels (
Optional
[List
[Multiset
]]) – Specific perturbation terms to compute. If bothexpansion_order
andexpansion_labels
are specified, then all terms up toexpansion_order
are 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 (
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
]) – 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. Must be supported bysolve_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
andy0
, with additionalperturbation_data
attribute containing the requested perturbation theory terms.- Return type:
OdeResult
- Raises:
QiskitError – If problem with inputs, either
expansion_method
is unsupported, or both ofexpansion_order
andexpansion_labels
unspecified.
References