Calculate the time evolution of a state generated by a piecewise-constant
Hamiltonian by using the Lanczos method.
initial_state (Tensor or np.ndarray) – The initial state as a Tensor or np.ndarray of shape
hamiltonian (Pwc or SparsePwc) – The control Hamiltonian. Uses sparse matrix multiplication if of type
SparsePwc, which can be more efficient for large operators that are
relatively sparse (contain mostly zeros).
krylov_subspace_dimension (Tensor or int) – The dimension of the Krylov subspace k for the Lanczos method.
sample_times (list or tuple or np.ndarray(1D, real), optional) – The N times at which you want to sample the state. Elements must be non-negative
and strictly increasing, with a supremum that is the duration of the hamiltonian.
If omitted only the evolved state at the final time of the control Hamiltonian
name (str, optional) – The name of the node.
Tensor of shape
(N, D) or
(D,) if sample_times is omitted
representing the state evolution. The n-th element (along the first
dimension) represents the state at
sample_times[n] evolved from
the initial state.
- Return type
This calculation can be relatively inefficient for small systems (very roughly
speaking, when the dimension of your Hilbert space is less than around 100; the
exact cutoff depends on the specifics of your problem though). You should generally
first try using time_evolution_operators_pwc to get the full time evolution
operators (and evolve your state using those), and only switch to this method
if that approach proves too slow or memory intensive. See the
How to simulate quantum dynamics for noiseless systems using graphs user guide
for an example of calculating state evolution with time_evolution_operators_pwc.
The Lanczos algorithm calculates the unitary evolution of a state in the Krylov
subspace. This subspace is spanned by the states resulting from applying the first
k powers of the Hamiltonian on the input state, with k being the subspace dimension,
much smaller that the full Hilbert space dimension. This allows for an efficient
state propagation in high-dimensional systems compared to calculating the full
Moreover, this function uses sparse matrix multiplication when the Hamiltonian is passed as a
SparsePwc. This can lead to more efficient calculations when they involve large operators that
are relatively sparse (contain mostly zeros). In this case, the initial state is still a densely
represented array or tensor.
Note that increasing the density of sample_times does not affect the accuracy of the
integration. However, increasing the Krylov subspace dimension or subdividing the Hamiltonian
into shorter piecewise-constant segments can reduce the integration error, at the expense of
longer computation times.
See example in the How to optimize controls on large sparse Hamiltonians user guide.