static OperationNamespace.state_evolution_pwc(initial_state, hamiltonian, krylov_subspace_dimension, sample_times=None, *, name=None)

Calculates the time evolution of a state generated by a piecewise-constant Hamiltonian by using the Lanczos method.

  • initial_state (Union[Tensor, np.ndarray]) – The initial state as a Tensor or np.ndarray of shape [D].

  • hamiltonian (SparsePwc) – The control Hamiltonian.

  • krylov_subspace_dimension (Union[Tensor, int]) – The dimension of the Krylov subspace k for the Lanczos method.

  • sample_times (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 is returned.

  • 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



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 unitary operator.