Accuracy of Computing Determinants

Notice that there are two different matrices considered here. There is the actual Hilbert matrix

A = Rational{BigInt}[1//(i+j-1) for i in 1:12, j in 1:12]

and the floating point representation of this matrix Float64.(A). These two matrices have slightly different determinants even when computed exactly

julia> Float64(det(A))
2.6377806512535473e-78

julia> Float64(det(Rational{BigInt}.(Float64.(A))))
2.687225581661903e-78

Furthermore, since the matrix is so ill conditioned, different ways of computing the determinant in floating point arithmetic give quite deifferent results.

LU

julia> det(lufact(Float64.(A)))
2.550554736789249e-78

Bunch-Kaufman using upper and lower triangle for storage

julia> det(Symmetric(Float64.(A), :L))
2.8930243994501074e-78

julia> det(Symmetric(Float64.(A), :U))
2.557691999626182e-78

Cholesky using uppler and lower triangle for storage

julia> det(cholfact(Symmetric(Float64.(A), :L)))
2.6834441543359152e-78

julia> det(cholfact(Symmetric(Float64.(A), :U)))
2.8372335715728185e-78
7 Likes