netket.exact.lanczos_ed(operator, *, k=1, compute_eigenvectors=False, matrix_free=False, scipy_args=None)[source]¶

Computes first_n smallest eigenvalues and, optionally, eigenvectors of a Hermitian operator using scipy.sparse.linalg.eigsh.

  • operator (AbstractOperator) – NetKet operator to diagonalize.

  • k (int) – The number of eigenvalues to compute.

  • compute_eigenvectors (bool) – Whether or not to return the eigenvectors of the operator. With ARPACK, not requiring the eigenvectors has almost no performance benefits.

  • matrix_free (bool) – If true, matrix elements are computed on the fly. Otherwise, the operator is first converted to a sparse matrix.

  • scipy_args (Optional[dict]) – Additional keyword arguments passed to scipy.sparse.linalg.eigvalsh. See the Scipy documentation for further information.


Either w or the tuple (w, v) depending on whether compute_eigenvectors is True.

w: Array containing the lowest first_n eigenvalues.

v: Array containing the eigenvectors as columns, such that`v[:, i]` corresponds to w[i].


Test for 1D Ising chain with 8 sites. s >>> import netket as nk >>> hi = nk.hilbert.Spin(s=1/2)**8 >>> hamiltonian = nk.operator.Ising(hi, h=1.0) >>> w = nk.exact.lanczos_ed(hamiltonian, k=3) >>> w array([-10.25166179, -10.05467898, -8.69093921])