There are many scenarios where it is worth it to wait for the correct answer, rather than getting the wrong one quickly…
There’s actually no need to write a new LU factorisation routine. According to the documentation of LinearAlgebra.lu
, it supports any element type that has +
, -
, *
, and /
. (If pivoting is chosen (default) the element type should also support abs
and <
.)
julia> A = rand(Int64, 50, 50);
julia> my_lu(A) == lu(Rational{BigInt}.(A), Val(false))
true