Skip to content

Better error message for when Hilbert space is smaller than requested eigenvalues #32

@hankarls

Description

@hankarls

When using eigs_lanczos, if I request more eigenvalues than the Hilbert space allows, the error is a bit difficult to understand. The current error message is "ERROR: LoadError: Mat::submat(): indices out of bounds or incorrectly used", when preferably it should tell that the requested number of eigenvalues is too large, or perhaps even better, default neigvals to the largest value allowed. A minimal example follows below:

  using XDiag

  let

     L=10    # systemsize
     N = 0   # number of particles

     block = Electron(L, N ÷ 2, N ÷ 2)
     ops = OpSum()

     # Hubbard model as example
     for i in 1:L-1
         ops += "t" * Op("Hop",[i,i+1])
     end

     ops += "U" * Op("HubbardU")

     ops["t"] = -1.0
     ops["U"] = -6.0

     res = eigs_lanczos(ops,block,neigvals=2)    # ask for two converged eigenvalues

  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions