Skip to content

Sparse matrix algebra fails with a 0 eigenvalue #6

@jakelishman

Description

@jakelishman

The sparse eigenvalue solver uses "shift-invert" mode to find the eigenvalues closest to zero. This involves solving for shifted eigenvalues w' = 1.0 / (w - s), where w are the original eigenvalues and s is the shift. We use zero for the shift, which causes a division by 0 when an eigenvalue is exactly 0, which isn't that rare.

This is something that the user can work around, usually by adding a constant term onto the input Hamiltonian - the dynamics aren't changed by a global phase rotation. That's not a particularly satisfying solution, though. Dense matrix algebra is immune to this problem, because the routines are far more robust, and safely calculate all the eigenvalues. This is impractical for large matrices.

Because the error happens inside the ARPACK routines, there is no ZeroDivisionError to be caught. The code throws a RuntimeError, but the entire routine fails and there seems to be no way to recover the other eigenvalues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions