krotov.second_order module¶
Support functions for the secondorder update equation
Summary¶
Classes:
Function σ(t) for the second order update equation. 
Functions:
Update the secondorder parameter \(A\). 
__all__
: Sigma
, numerical_estimate_A
Reference¶

class
krotov.second_order.
Sigma
[source]¶ Bases:
abc.ABC
Function σ(t) for the second order update equation.
This is an abstract bases class. For any optimization that requires the secondorder update equation, an appropriate problemspecific subclass of
Sigma
must be implemented that definesthe evaluation of σ(t) in
__call__()
the update of any values that σ(t) depends on parametrically (typically: any of the parameters A, B, C), in
refresh()
.
An instantiation of that subclass is then passed as sigma to
optimize_pulses()
.
abstract
refresh
(forward_states, forward_states0, chi_states, chi_norms, optimized_pulses, guess_pulses, objectives, result)[source]¶ Recalculate the parametric dependencies of σ(t)
This is called at the end of each control iteration, and may be used to estimate the internal parameters in σ(t)
 Parameters
forward_states (list) – For each objective, an arraylike container (cf. storage in
optimize_pulses()
) of the initial state forwardpropagated under optimized controls from the current iteration.forward_states0 (list) – The forwardpropagated states under the guess controls of the current iteration.
chi_states (list) – The (normalized) boundary condition for the backwardpropagation in the current iteration, as returned by the chi_constructor argument to
optimize_pulses()
.chi_norms (list) – The norms of the unnormalized chi_states.
optimized_pulses (list[numpy.ndarray]) – from the current iteration
guess_pulses (list[numpy.ndarray]) – current iteration
result (Result) – The result object, uptodate for the current iteration

krotov.second_order.
numerical_estimate_A
(forward_states, forward_states0, chi_states, chi_norms, Delta_J_T)[source]¶ Update the secondorder parameter \(A\).
Calculate the new value of \(A\) according to the equation
\[A^{(i+1)} = \frac{ \sum_k 2 \Re \Braket{\chi_k(T)}{\Delta\phi_k(T)} + \Delta J_T }{ \sum_k \Braket{\Delta \phi_k(T)}{\Delta\phi_k(T)} },\]where \(\Delta\phi_k\) is the difference of the forward_states \(\ket{\phi_k^{(i)}}\) propagated under the optimized pulse of iteration \((i)\), and the forward_states0 \(\ket{\phi_k^{(i1)}}\) propagated under the guess pulse of iteration \((i)\) – that is, the guess pulse of iteration \((i1)\); and \(\Delta J_T\) is the difference of the final time functional,
\[\Delta J_T = J_T(\{\ket{\phi_k^{(i)}(T)}\}  J_T(\{\ket{\phi_k^{(i1)}(T)}\}.\] Parameters
forward_states (list) – For each objective, the result of a forwardpropagation with the optimized pulses of the current iteration.
forward_states0 (list) – For each objective, the result of a forwardpropagation with the guess pulses of the current iteration
chi_states (list) – For each objective, the normalized boundary state \(\ket{\chi_k(T)}/\Abs{\ket{\chi_k(T)}}\) for the backwardpropagation with the guess pulse of the current iteration.
chi_norms (list) – The norms of the chi_states
Delta_J_T (float) – The value by which the final time functional improved in the current iteration.