-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
decompositions for Rational matrices #3
Comments
That would be very cool. |
Indeed, it would be pretty awesome. |
Isn't there a problem with the square roots? A Cholesky decomposition begins by taking the square root of the [1,1] element. Unless I am misremembering (always a possibility as my math classes were many, many years ago) that takes you out of the rational numbers right away. You may be able to avoid the square root in the LDLt form of the decomposition. |
That's right. It seems that one must use the LDLt form. |
On thing to look out for is that the numerators and denominators would probably blow up pretty quickly. |
That was my initial reaction too. |
For the use case I was thinking of, all of the elements in the matrix have small numerators and denominators, so I wouldn't expect overflow to be an issue with Int64. To some extent the user is responsible for selecting the right precision, especially since the base integer type must be explicitly stated to use rational matrices. I can also think of some quick sanity checks that would detect many cases of overflow. For example, when eliminating a variable in Gaussian elimination, one could check something of the form |
This one is almost completed. You can compute the lu in rational arithmetic and therefore solve linear systems of equations, which I think is the main goal for this issue. The only remaining part is the ldlt factorization of symmetric or hermitian matrices. I guess these need pivoting to be stable for floating point arithmetic, i.e. what we and LAPACK call Bunch-Kaufman. The pivoting in this case is a little tedious and I wonder if we really need our own version of this factorization. |
Having LU factorizations is a big step forward. For positive definite rational matrices, one can actually implement LDLt without pivoting, though I wouldn't say that this is essential. |
Cross-ref: JuliaLang/julia#5381, JuliaLang/julia#5430, JuliaLang/julia#5526, #61 |
We've made a lot of progress on this. Only thing missing I'd say is LDLt for symmetric positive definite matrices. |
Much of this works now. Should we still leave this open? |
Currently,
lu
,chol
,(\)
, etc. convert anArray{Rational{Int64},2}
toArray{Float64,2}
before doing any computation. These should actually compute the decompositions using rational arithmetic. Textbook implementations would likely be fine to start with, since the only possible numerical issues are integer overflow.Of course it's not always possible to use rational arithmetic. For QR it's pretty reasonable to just convert to floating-point.
The text was updated successfully, but these errors were encountered: