Skip to content

Inaccurate HermitianEig for larger matrices #268

@wlandry

Description

@wlandry

Running the attached program gives me the output

eigval: -2514.532332452646371076876843923197100285732340520947510920424934587171685099521383378129109497782512

uncommenting lines 32 or 35 changes the output to

eigval: -2514.532332452646371076876843923197100285732340520947510920424934587171685099521565445322063739285174

These differ around the 80'th digit. This code is running at 1024 bits (308 digit) precision. After some work, I verified that the second result is correct.

It seems that the problem arises within the DivideAndConquer(). DivideAndConquer() calls itself recursively and then calls Merge() to merge the results. When not computing eigenvectors, Merge() expects to get the last eigenvector of the first submatrix and the first eigenvector of the last second. However, the output of Merge() is the middle two eigenvectors, not the first and last eigenvectors. So everything works fine if there is only one level of recursion, but it breaks down with two levels. When I set the cutoff to greater than half of the matrix size, it only does one level of recursion.

The code path is different when computing eigenvalues and eigenvectors, so it does not run into this bug.
Hermitian_bug.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions