Jutho / KrylovKit.jl

Krylov methods for linear problems, eigenvalues, singular values and matrix functions
Other
302 stars 38 forks source link

Eigsolve and extended precision #51

Open zmoitier opened 3 years ago

zmoitier commented 3 years ago

I am trying to compute eigenvalues of matrices with extended precision but the function eigsolve return an error. For example with the following matrix

using LinearAlgebra, LinearMaps, Quadmath, KrylovKit

T = Complex{Float128}
N = 32
A = Tridiagonal(rand(T, N - 1), rand(T, N), rand(T, N - 1))

the matrix version give

julia> vals, vecs, info = eigsolve(A, 3, :LM)
ERROR: LoadError: MethodError: no method matching hschur!(::SubArray{Complex{Float128}, 2, Matrix{Complex{Float128}}, Tuple{UnitRange{Int64}, UnitRange{Int64}}, false}, ::SubArray{Complex{Float128}, 2, Matrix{Complex{Float128}}, Tuple{UnitRange{Int64}, UnitRange{Int64}}, false})

and the matrix-free version give the same error

julia> A_map = LinearMap{T}(x -> A * x, N);
julia> vals, vecs, info = eigsolve(A_map, N, 3, :LM)
ERROR: MethodError: no method matching hschur!(::SubArray{Complex{Float128}, 2, Matrix{Complex{Float128}}, Tuple{UnitRange{Int64}, UnitRange{Int64}}, false}, ::SubArray{Complex{Float128}, 2, Matrix{Complex{Float128}}, Tuple{UnitRange{Int64}, UnitRange{Int64}}, false})

From this discussion on julialang, I have been advise to open this issue.


Additional information:

Jutho commented 3 years ago

Yes, KrylovKit currently uses the Schur decomposition algorithm from BLAS, and thus only works with BLAS numbers. With GenericSchur.jl that could be circumvented, and I welcome PR requests to do that, but I am afraid I won't have time for this myself in the near future.

zmoitier commented 3 years ago

Ha ok, I note for the PR but I also do not have the time right now to immerse myself in how that works.