I am trying to solve the generalised eigenvalue problem in arbitrary precision, using the BigFloat data type.
using LinearAlgebra
using GenericLinearAlgebra
setprecision(128)
println(eigen(Hermitian(rand(BigFloat, 2, 2)), Hermitian(rand(BigFloat, 2, 2))))
It produces this error:
Exception has occurred: MethodError
MethodError: no method matching eigen!(::Hermitian{BigFloat, Matrix{BigFloat}}, ::Hermitian{BigFloat, Matrix{BigFloat}})
The function `eigen!` exists, but no method is defined for this combination of argument types.
However, using BigFloat for the standard eigenvalue problem works
println(eigen(Hermitian(rand(BigFloat, 2, 2))))
Does anyone know why this is or how I could fix it? Thanks so much for any help, I’ve been asked to use Julia for my masters project and have no experience using it!
There are methods for generalized eigensystems of complex matrices with arbitrary precision in GenericSchur.jl. I haven’t gotten around to writing all the conventional wrappers but you can do something like
using LinearAlgebra, GenericSchur
A = rand(Complex{BigFloat},n,n)
B = rand(Complex{BigFloat},n,n)
S = schur(A,B)
V = eigvecs(S)
# check result:
resid = norm(A * V - V * B * Diagonal(S.values))
I haven’t implemented methods for the plain real or Hermitian cases.
Thankyou! Are you aware of any additional time constraints the cholsesky factorisation would have on the calculation? I am using matrix sizes of > (30)^3. If not don’t worry I can do some analysis
The Cholesky factorization wouldn’t be the limiting factor here. The eigenvalue computation would be much more costly than the Cholesky. Using a symmetric eigen solver, as would be available when transforming the problem with the Cholesky factor, is also typically much faster than using a general solver. However, if the dimension is ~30^3 then I think it will be almost prohibitively costly to solve with BigFloat elements. Do you need all the eigenvalues? If not, then you should probably consider an iterative solver.
I am aware of the computational cost required, this code has already been used in python to solve the non-BO Schrodinger equation (w/ Float64). Implementation into Julia is in order to increase precision, as it has been extraordinarily difficult in python. The python code also uses sparse matrices, but as far as I am aware, there is no package that allows for solving the eigenvalue problem with precision > 64 bits for sparse matrices in Julia. For this purpose, only the minimum eigenvalue(s) is required. Do you know an iterative solver that would work using the BigFloat type?