krotov.mu module¶
Routines for mu in krotov.optimize.optimize_pulses()
The firstorder Krotov update equation is usually written as
where \(\ket{\chi_k}\) are states backwardpropagated from a boundary condition determined by the functional, \(\ket{\phi_k}\) are forwardpropagated from the initial states, and \(\frac{\partial \Op{H}}{\partial \epsilon}\) is the derivative of the Hamiltonian with respect to the field. However, this is true only for Hilbertspace states evolving under a Schrödinger equation.
More generally (e.g. when the states \(\chi_k\) and \(\phi_k\) are density matrices and the equation of motion is the master equation in Lindblad form), the correct formulation is
where \(H\) is now the abstract operator appearing in the equation of motion of the abstract state
For density matrices, we have
and thus \(H = i \Liouville\).
To allow for arbitrary equations of motion, a routine mu may be passed to
optimize_pulses()
that returns the abstract operator \(\mu\) as a
Qobj
, or alternatively as a callable that takes \(\phi_k\) as its
argument and evaluates \(\mu \phi_k\). The default mu is
derivative_wrt_pulse()
, which covers the most common equation of motions:
standard Schrödinger equation
master equation, where either the H attribute of the objective contains a Hamiltonian and there are Lindblad operators in c_ops, or the H attribute contains a superoperator \(\Liouville\) directly (the case discussed above).
Alternative implementations of mu must have the same signature as
derivative_wrt_pulse()
, but should only be required in rare
circumstances, such as when the derivative still depends on the control values
or on the states. (Or, if you can provide a more efficient problemspecific
implementation).
Summary¶
Functions:
Calculate ∂H/∂ϵ for the standard equations of motion. 
__all__
: derivative_wrt_pulse
Reference¶

krotov.mu.
derivative_wrt_pulse
(objectives, i_objective, pulses, pulses_mapping, i_pulse, time_index)[source]¶ Calculate ∂H/∂ϵ for the standard equations of motion.
 Parameters
i_objective (int) – The index of the objective in objectives whose equation of motion the derivative should be calculated.
pulses (list) – The list of pulses occuring in objectives
pulses_mapping (list) – The mapping of elements of pulses to the components of objectives, as returned by
extract_controls_mapping()
i_pulse (int) – The index of the pulse in pulses for which to calculate the derivative
time_index (int) – The index of the value in
pulses[i_pulse]
that should be plugged in to ∂H/∂ϵ. Not used, as this routine only considers equations of motion that are linear in the controls.
 Returns
The quantum operator or superoperator that represents ∂H/∂ϵ. In general, the return type can be any callable mu so that
mu(state)
calculates the result of applying ∂H/∂ϵ to state. In most cases, aQobj
will be returned, which is just the most convenient example of an appropriate callable. Return type
callable
This function covers the following cases:
the
H
attribute of the objective contains a Hamiltonian, there are noc_ops
(Schrödinger equation: the abstract H in ∂H/∂ϵ is the Hamiltonian directly)the
H
attribute of the objective contains a Hamiltonian \(\Op{H}\), and there are Lindblad operators \(\Op{L}_i\) inc_ops
(master equation in Lindblad form). The abstract H is \(i \Liouville\) for the Liouvillian defined as\[\Liouville[\Op{\rho}] = i[\Op{H},\Op{\rho}]+\sum_{i} \left( \Op{L}_i \Op{\rho} \Op{L}_i^\dagger  \frac{1}{2} \left\{ \Op{L}_i^\dagger \Op{L}_i, \Op{\rho}\right\} \right)\]the
H
attribute of the objective contains a superoperator \(\Liouville\), there are noc_ops
(general master equation). The abstract H is again \(i \Liouville\).