0

I am a beginner at Julia. I want to obtain r eigenvalues and eigenvectors of input symmetric n times n matrix X in increasing order. I heard the computational complexity is O(n^2 r).

n is around 1000-20000, r is around 100-1000. How can I obtain the eigenvalue and eigenvectors within O(nmr)?

Sakurai.JJ
  • 553
  • 3
  • 10
  • 1
    If you already have a matrix, you could add and test a few libraries with [BenchmarkTools.jl](https://github.com/JuliaCI/BenchmarkTools.jl). It should be quick. Some libraires are pure Julia, others relies on BLAS&LAPACK – Thomas Jalabert Mar 06 '22 at 11:39
  • Thank you. But I think these three libraries are not specialized in a symmetric dense matrix. Do you know some libraries of eigendecomposition for symmetric dense matrix? – Sakurai.JJ Mar 06 '22 at 11:41
  • 1
    @Sakurai.JJ You can also try asking at the Julia Discourse https://discourse.julialang.org/, which might be a more receptive venue for this kind of question. – Sundar R Mar 06 '22 at 22:16

1 Answers1

2

I'm not an expert on this, but I would start out trying the methods in the LinearAlgebra stdlib. The LinearAlgebra.eigen function is specialized on the input matrix types SymTridiagonal, Hermitian, Symmetric, and lets you specify how many vectors/values you want:

If you have a dense matrix, A, and want the largest r eigenvalues and vectors:

(evals, evecs) = eigen(Symmetric(A), 1:r)

You can also use eigvals and eigvecs if you just need eigenvalues or eigenvectors. Also check out eigen! if you want to save some memory.

BTW, using Symmetric(A) doesn't create a new matrix, it is just a wrapper around A that tells the compiler that A is symmetrical and only accesses the part of A that is above the diagonal.

If the version in LinearAlgebra is not the fastest in this quite general case, then it should probably be reported on Julia's github. There may be faster implementations for more specialized cases, but for general symmetric dense matrices, the implementation in the stdlib should be expected to be near optimal.

DNF
  • 11,584
  • 1
  • 26
  • 40