LindbladModel#
- class LindbladModel(static_hamiltonian=None, hamiltonian_operators=None, hamiltonian_signals=None, static_dissipators=None, dissipator_operators=None, dissipator_signals=None, rotating_frame=None, in_frame_basis=False, array_library=None, vectorized=False, validate=True)[source]#
Bases:
BaseGeneratorModel
A model of a quantum system in terms of the Lindblad master equation.
The Lindblad master equation models the evolution of a density matrix according to:
\[\dot{\rho}(t) = -i[H(t), \rho(t)] + \mathcal{D}_0(\rho(t)) + \mathcal{D}(t)(\rho(t)),\]where \(\mathcal{D}_0\) is the static dissipator portion, and \(\mathcal{D}(t)\) is the time-dependent dissipator portion of the equation, given by
\[\mathcal{D}_0(\rho(t)) = \sum_j N_j \rho N_j^\dagger - \frac{1}{2} \{N_j^\dagger N_j, \rho\},\]and
\[\mathcal{D}(t)(\rho(t)) = \sum_j \gamma_j(t) L_j \rho L_j^\dagger - \frac{1}{2} \{L_j^\dagger L_j, \rho\},\]respectively. In the above:
\([\cdot, \cdot]\) and \(\{\cdot, \cdot\}\) respectively denote the matrix commutator and anti-commutator,
\(H(t)\) denotes the Hamiltonian,
\(N_j\) denotes the operators appearing in the static dissipator,
\(L_j\) denotes the operators appearing in the time-dpendent portion of the dissipator, and
\(\gamma_j(t)\) denotes the signal corresponding to the \(j^{th}\) time-dependent dissipator operator.
Instantiating an instance of
LindbladModel
requires specifying the above decomposition:lindblad_model = LindbladModel( static_hamiltonian=static_hamiltonian, hamiltonian_operators=hamiltonian_operators, hamiltonian_signals=hamiltonian_signals, static_dissipators=static_dissipators, dissipator_operators=dissipator_operators, dissipator_signals=dissipator_signals )
where the arguments
hamiltonian_operators
,hamiltonian_signals
, andstatic_hamiltonian
are for the Hamiltonian decomposition as inHamiltonianModel
, and thestatic_dissipators
correspond to the \(N_j\), thedissipator_operators
to the \(L_j\), and thedissipator_signals
the \(\gamma_j(t)\).Initialize.
- Parameters:
static_hamiltonian (
Union
[ndarray
,number
,int
,float
,complex
,Tracer
,Array
,Array
,spmatrix
,BCOO
,list
,None
]) – Constant term in Hamiltonian.hamiltonian_operators (
Union
[ndarray
,number
,int
,float
,complex
,Tracer
,Array
,Array
,spmatrix
,BCOO
,list
,None
]) – List of operators in Hamiltonian with time-dependent coefficients.hamiltonian_signals (
Union
[SignalList
,List
[Signal
],None
]) – Time-dependent coefficients for hamiltonian_operators.static_dissipators (
Union
[ndarray
,number
,int
,float
,complex
,Tracer
,Array
,Array
,spmatrix
,BCOO
,list
,None
]) – List of dissipators with coefficient 1.dissipator_operators (
Union
[ndarray
,number
,int
,float
,complex
,Tracer
,Array
,Array
,spmatrix
,BCOO
,list
,None
]) – List of dissipator operators with time-dependent coefficients.dissipator_signals (
Union
[SignalList
,List
[Signal
],None
]) – Time-dependent coefficients for dissipator_operators.rotating_frame (
Union
[ndarray
,number
,int
,float
,complex
,Tracer
,Array
,Array
,spmatrix
,BCOO
,list
,RotatingFrame
,None
]) – Rotating frame in which calcualtions are to be done. If provided, it is assumed that all operators were already in the frame basis.in_frame_basis (
bool
) – Whether to represent the model in the basis in which the rotating frame operator is diagonalized.array_library (
Optional
[str
]) – Array library with which to represent the operators in the model, and to evaluate the model. See the list of supported array libraries in thearraylias
submodule API documentation. IfNone
, the arrays will be handled by general dispatching rules.vectorized (
bool
) – Whether or not to setup the Lindblad equation in vectorized mode. IfTrue
, the operators in the model are stored as \((dim^2,dim^2)\) matrices that act on vectorized density matrices by left-multiplication. Setting this toTrue
is necessary forSuperOp
simulation.validate (
bool
) – If True check input hamiltonian_operators and static_hamiltonian are Hermitian.
- Raises:
QiskitError – If model insufficiently or incorrectly specified.
Methods
- evaluate(time)[source]#
Evaluate the model in array format as a matrix, independent of state.
- Parameters:
time (
float
) – The time to evaluate the model at.- Returns:
The evaluated model as an anti-Hermitian matrix.
- Return type:
ArrayLike
- Raises:
QiskitError – If model cannot be evaluated.
NotImplementedError – If the model is currently unvectorized.
- evaluate_hamiltonian(time)[source]#
Evaluates Hamiltonian matrix at a given time.
- Parameters:
time (
float
) – The time at which to evaluate the Hamiltonian.- Returns:
Hamiltonian matrix.
- Return type:
ArrayLike
- evaluate_rhs(time, y)[source]#
Evaluates the Lindblad model at a given time.
- Parameters:
time (
float
) – The time at which the model should be evaluated.y (
Union
[ndarray
,number
,int
,float
,complex
,Tracer
,Array
,Array
,spmatrix
,BCOO
,list
]) – Density matrix as an (n,n) Array if not vectorized, or an (n^2) Array if using vectorized evaluation.
- Returns:
Either the evaluated generator or the state.
- Return type:
ArrayLike
- Raises:
QiskitError – If signals not sufficiently specified.
- classmethod from_hamiltonian(hamiltonian, static_dissipators=None, dissipator_operators=None, dissipator_signals=None, array_library=None, vectorized=False)[source]#
Construct from a
HamiltonianModel
.- Parameters:
hamiltonian (
HamiltonianModel
) – TheHamiltonianModel
.static_dissipators (
Union
[ndarray
,number
,int
,float
,complex
,Tracer
,Array
,Array
,spmatrix
,BCOO
,list
,None
]) – List of dissipators with coefficient 1.dissipator_operators (
Union
[ndarray
,number
,int
,float
,complex
,Tracer
,Array
,Array
,spmatrix
,BCOO
,list
,None
]) – List of dissipators with time-dependent coefficients.dissipator_signals (
Union
[ndarray
,number
,int
,float
,complex
,Tracer
,Array
,Array
,spmatrix
,BCOO
,list
,None
]) – List time-dependent coefficients for dissipator_operators.array_library (
Optional
[str
]) – Array library to use.vectorized (
bool
) – Whether or not to vectorize the Lindblad equation.
- Returns:
Linblad model from parameters.
- Return type:
Attributes
- array_library#
Array library with which to represent the operators in the model, and to evaluate the model.
See the list of supported array libraries in the
arraylias
submodule API documentation.
- dim#
The matrix dimension.
- dissipator_operators#
The dissipator operators.
- hamiltonian_operators#
The Hamiltonian operators.
- in_frame_basis#
Whether to represent the model in the basis in which the frame operator is diagonalized.
- rotating_frame#
The rotating frame.
- signals#
The model’s signals as tuple with the 0th entry storing the Hamiltonian signals and the 1st entry storing the dissipator signals.
- Raises:
QiskitError – If, when setting this property, the given signals are incompatible with operator structure.
- static_dissipators#
The static dissipator operators.
- static_hamiltonian#
The static Hamiltonian term.
- vectorized#
Whether or not the Lindblad equation is vectorized.