dzhang314 / MultiFloats.jl

Fast, SIMD-accelerated extended-precision arithmetic for Julia
MIT License
75 stars 10 forks source link

eigen accuracy #45

Closed edljk closed 1 week ago

edljk commented 4 weeks ago

I was surprised by the loss of accuracy computing small eigenvalues / eigenvectors with respect to BigFloat:

using MultiFloats, LinearAlgebra, GenericLinearAlgebra
setprecision(BigFloat, precision(Float64x8))
for T ∈  [Float64, Float64x4, Float64x6, Float64x8, BigFloat]
    A = Hermitian(rand(T, 10, 10))
    l, E = eigen(A)
    err = norm(A * E - l' .* E, Inf)
    @show T 
    @show Float64.((err, eps(T)))
end

which produces on my laptop

T = Float64
Float64.((err, eps(T))) = (1.9984014443252818e-15, 2.220446049250313e-16)
T = MultiFloat{Float64, 4}
Float64.((err, eps(T))) = (1.3773321015224588e-62, 2.4308653429145085e-63)
T = MultiFloat{Float64, 6}
Float64.((err, eps(T))) = (2.341425747879783e-71, 1.1985091468012028e-94)
T = MultiFloat{Float64, 8}
Float64.((err, eps(T))) = (1.886488663970321e-84, 5.909106315382871e-126)
T = BigFloat
Float64.((err, eps(T))) = (3.606632272572553e-129, 3.606632272572553e-130)

Could it be related to some normalization issue? Thanks!

dzhang314 commented 1 week ago

Hey @edljk, thanks for your interest in MultiFloats.jl! I believe this is related to issue #42, so if it is alright with you, I would like to close this issue and continue the discussion on that thread.