Skip to content

Sign convention for eigenvectors #5568

Backlog

Description

@jpkrowe

Is your feature request related to a problem?

PR #5563 introduced the use of eigh instead of eig for the generation of eigenvectors from the covariance matrix. Because we do not currently enforce any sign convention for the eigenvectors, this change lead to the eigenvectors in the User Guide example arbitrarily switching sign (see MDAnalysis/UserGuide#466 and MDAnalysis/UserGuide#467). We should have some sort of sign convention that ensures the sign of the eigenvectors are decided deterministically.

Describe the solution you'd like

A simple convention would be to enforce the sign of the component with the largest magnitude to always be positive

Describe alternatives you've considered

I believe the solution above is probably the simplest and is similar to what I have seen elsewhere (see https://github.com/scikit-learn/scikit-learn/blob/990620c9c9e9b331e18da617dfb0c7ebddfe5a96/sklearn/utils/extmath.py#L912 for example)

Additional context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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