Skip to content

Sparse matrix eigsolve defaults to non-sparse, dense x₀ #126

@BenjaminRemez

Description

@BenjaminRemez

x₀ = Random.rand!(similar(A, T, size(A, 1)))

For sparse A, above line leads to a dense SparseVector x₀. Being dense, multiplications A*x₀ are slow and lead to excessive allocations. In my benchmarking, runtime for A with density ~5% exceeds that of calling eigsolve(collect(A)...). This also leads to inconsistent runtime/memory usage between calling eigsolve(A,...) and eigsolve(A, size(A,1), ...), as the latter correctly initializes a x₀::Vector{Float64}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions