krotov.second_order module¶
Support functions for the second-order update equation
Summary¶
Classes:
Function σ(t) for the second order update equation. |
Functions:
Update the second-order 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 second-order update equation, an appropriate problem-specific 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 array-like container (cf. storage in
optimize_pulses()
) of the initial state forward-propagated under optimized controls from the current iteration.forward_states0 (list) – The forward-propagated states under the guess controls of the current iteration.
chi_states (list) – The (normalized) boundary condition for the backward-propagation in the current iteration, as returned by the chi_constructor argument to
optimize_pulses()
.chi_norms (list) – The norms of the un-normalized chi_states.
optimized_pulses (list[numpy.ndarray]) – from the current iteration
guess_pulses (list[numpy.ndarray]) – current iteration
result (Result) – The result object, up-to-date for the current iteration
-
krotov.second_order.
numerical_estimate_A
(forward_states, forward_states0, chi_states, chi_norms, Delta_J_T)[source]¶ Update the second-order 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^{(i-1)}}\) propagated under the guess pulse of iteration \((i)\) – that is, the guess pulse of iteration \((i-1)\); 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^{(i-1)}(T)}\}.\]- Parameters
forward_states (list) – For each objective, the result of a forward-propagation with the optimized pulses of the current iteration.
forward_states0 (list) – For each objective, the result of a forward-propagation 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 backward-propagation 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.