MagnusSolver#
- class MagnusSolver(operators, rotating_frame, dt, carrier_freqs, chebyshev_orders, expansion_order=None, expansion_labels=None, integration_method=None, include_imag=None, **kwargs)[source]#
Bases:
_PerturbativeSolver
Solver for linear matrix differential equations based on the Magnus expansion.
This class implements the Magnus expansion-based solver presented in [[1]], which is a Magnus expansion variant of the Dysolve algorithm originally introduced in [[2]]. Its setup and behaviour are the same as as the
DysonSolver
class, with the sole exception being that it uses a truncated Magnus expansion and matrix exponentiation to solve over a single time step. See the Time-dependent perturbation theory and multi-variable series expansions review for a description of the Magnus expansion, and the documentation forDysonSolver
for more detailed behaviour of this class.Initialize.
- Parameters:
operators (
List
[Operator
]) – List of constant operators specifying the operators with signal coefficients.rotating_frame (
Union
[Array
,Operator
,RotatingFrame
,None
]) – Rotating frame to setup the solver in. Must be Hermitian or anti-Hermitian.dt (
float
) – Fixed step size to compile to.carrier_freqs (
Array
) – Carrier frequencies of the signals in the generator decomposition.chebyshev_orders (
List
[int
]) – Approximation degrees for each signal over the interval [0, dt].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_terms
.expansion_labels (
Optional
[List
[Multiset
]]) – Specific perturbation terms to compute. If bothexpansion_order
andexpansion_terms
are specified, then all terms up toexpansion_order
are computed, along with the additional terms specified inexpansion_terms
. Labels are specified either asMultiset
or as valid arguments to theMultiset
constructor. This function further requires thatMultiset
s consist only of non-negative integers.integration_method (
Optional
[str
]) – ODE solver method to use when computing perturbation terms.include_imag (
Optional
[List
[bool
]]) – List of bools determining whether to keep imaginary components in the signal approximation. Defaults to True for all signals.kwargs – Additional arguments to pass to the solver when computing perturbation terms.
Methods
- solve(t0, n_steps, y0, signals)#
Solve given an initial time, number of steps, signals, and initial state.
Note that this method can be used to solve a list of simulations at once, by specifying one or more of the arguments
t0
,n_steps
,y0
, orsignals
as a list of valid inputs. For this mode of operation, all of these arguments must be either lists of the same length, or a single valid input, which will be used repeatedly.- Parameters:
- Returns:
Results object, or list of results objects.
- Return type:
OdeResult
- Raises:
QiskitError – If improperly formatted arguments.
Attributes
- model#
Model object storing expansion details.