Search code examples
juliamatrix-factorization

Issues with LowRankApprox in Julia


I am trying to a Hermitian eigendecomposition using the pheigfact function provided with the LowRankApprox.jl package in Julia v0.6.0. Basically, it was just one line of code like:

(E, F) = pheigfact(A);

where A is a real symmetric positive definite matrix. However, I got the following error:

MethodError: no method matching
start(::LowRankApprox.PartialHermitianEigen{Float64,Float64})
Closest candidates are:
  start(!Matched::SimpleVector) at essential.jl:258
  start(!Matched::Base.MethodList) at reflection.jl:560
  start(!Matched::ExponentialBackOff) at error.jl:107 

Appreciate any help!


Solution

  • TL;DR

    Use the function pheig not pheigfact to return a tuple of values and vectors


    Full answer

    I don't have the package but from the docs it looks like pheigfact returns a single element from which you can access the values/vectors using getindex(x,ind::Symbol).

    e.g.

    F = pheigfact(A)
    values=F[:values]
    vectors=F[:vectors]
    

    and if you try and assign a single element to a tube it will try and iterate over that a type that does not support it and so give you your error (i.e. the type does not have the method start). I could get a similar error doing either x,y = :onetwo or start(:onetwo)

    Solution

    Use the function pheig which does returns a tuple.

    E, F = pheig(A)