newtonprop.propagator module¶
Newton Propagator
Summary¶
Functions:
jit 

step 
Evaluate \(f(A\,dt)\,v\), for example \(e^{i\,A\,dt}\,v\) for the propagation of a quantum state. 
__all__
: step
Reference¶

newtonprop.propagator.
step
(A, v, dt, func='exp', m_max=10, maxrestart=100, tol=1e12, inner=None, norm=None, zero=None)[source]¶ Evaluate \(f(A\,dt)\,v\), for example \(e^{i\,A\,dt}\,v\) for the propagation of a quantum state.
Applies the result of an arbitrary abstract operator function \(f(A\,dt)\) to an abstract state \(v\), where \(A\) is an abstract operator and \(dt\) is a scalar factor. The intended application is computing a single time step \(dt\) of the time evolution of a quantum state, where the form of the time evolution operator/dynamical map is \(e^{i\,A\,dt}\). If \(v\) is a Hilbert space state, \(A\) is the system Hamiltonian (constant over the duration \(dt\)). If \(v\) is a density matrix, \(A = i \Liouville\) with the Liouvillian superoperator \(\Liouville\).
The operator \(f(A\,dt)\) is never explicitly constructed, only its application to \(v\) is calculated. This distinguishes the Newton propagator from functions like
scipy.linalg.expm()
for matrix exponentiation. Internally, it uses an iterative restarted Krylov projection of \((A\,dt)\), where the Krylov dimension in each iteration is m_max. Consequently, storage for only m_max Arnoldivectors of the same size as v is required.Parameters:  A (callable) – Function encoding the abstract operator \(A\). Calling
A(v)
must return the result of applying \(A\) to \(v\).  v – Initial state \(v\).
 dt (float) – scalar parameter (time step \(dt\))
 func (callable or str) –
The scalar version of the operatorfunction \(f\). Must take one complex argument and return a complex value. Note that func will only ever be called with a scalar argument, not with the argument \((A\,dt)\). If passed as a string, func may have the following values, corresponding to “standard” functions:
'exp'
:lambda x: np.exp(x)
'expmi'
:lambda x: np.exp(1j * x)
'expi'
:lambda x: np.exp(1j * x)
 m_max (int) – Maximal Krylov dimension
 maxrestart (int) – Maximal number of Newton restarts (iterations of the algorithm)
 tol (float) – Desired precision of the result
 inner (callable) – Function that evaluates an inner product. Must take
two arguments of the type of v0 and return a complex number. If
None, defaults to
numpy.vdot()
.  norm (callable) – Function that calculates the norm of a state. Must
take one argument of the type of v0 and return a real number. If
None, defaults to
numpy.linalg.norm()
. The norm must be induced by the inner product specified by inner.  zero (callable) – Function that takes v as input and allocates and
returns a new zero state of the same type and shape as v.
If None, defaults to
lambda v: numpy.zeros(shape=v.shape, dtype=v.dtype)
Returns: The result of the operatorfunction \(f(A\,dt)\) applied to \(v\). The return value will be of the same type as the input v.
Note
The input state may be of any arraylike type. It should have (but is not strictly required to have) a shape attribute. It must support being multiplied or divided by a scalar, e.g.
state / 2.0
or2 * state
. Lastly, it must support inplace addition with another state,state += state2
. All other mathematical properties of state can be defined via custom inner, norm, and zero functions.Mathematically, state must be an element a Hilbert space (a “complete inner product space”). This includes density matrices, which can be interpreted as elements of a Hilbert space provided one chooses an appropriate norm and inner product.
Warning
The norm must be the one induced by the inner product,
\[\Norm{v} \equiv \sqrt{\Braket{v}{v}}\]The parameters inner and norm must fulfill this definition. For density matrices, they should be the HilbertSchmidt product and the HilbertSchmidt norm. The “operator norm” has no associated inner product. If the operator norm is used, density matrices are not elements of a Hilbert space, but of a C* algebra, which would not allow for the evaluation of the propagator.
A mismatch between norm and inner leads to subtle errors that will not be obvious (e.g., a substantial lack of precision)
 A (callable) – Function encoding the abstract operator \(A\). Calling