Thanks to visit codestin.com
Credit goes to github.com

Skip to content

LOBPCG inefficinet when computing > 20% of eigenvalues #10983

@lobpcg

Description

@lobpcg

Is your feature request related to a problem? Please describe.
Even if the original input matrices were given as arrays, each of them is first turned into a LinearOperator:

    A = _makeOperator(A, (n, n))
    B = _makeOperator(B, (n, n))

When lobpcg is requested to compute > 20% of eigenvalues, it simply switches to eigh, but before that needs to recover the matrices back:

        A_dense = A(np.eye(n, dtype=A.dtype))
        B_dense = None if B is None else B(np.eye(n, dtype=B.dtype))

        vals, vecs = eigh(A_dense, B_dense, eigvals=eigvals,
                          check_finite=False)

which is a dramatic waste.

Describe the solution you'd like
Unless original input matrices were given as LinearOperator's, avoid

        A_dense = A(np.eye(n, dtype=A.dtype))
        B_dense = None if B is None else B(np.eye(n, dtype=B.dtype))

when computing > 20% of eigenvalues and call eigh directly on the original matrices.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions