Skip to content

Determinant

1 message · Boris Steipe

#
Please keep discussion son the list.
On May 15, 2015, at 5:19 AM, chasiotisv at math.auth.gr wrote:

            
Yes, but it requires significant effort to do so because you need arbitrary-precision algorithms.
I don't think we are talking about the same thing here.
You have not clearly stated what the problem is you are trying to solve. Clearly you don't need to know whether the number is an integer - you already know it is. You also know that a number of that size cannot be exactly represented natively in your computer. So asking whether it turns out to be a whole number or not is asking a question about the machine precision and the algorithm, not about the number.
[1] 9.223372e+18
[1] 9223372036854775808       # wrong!

library(Rmpfr)
a <- mpfr(2, 64)
print(a^63 - 1, digits=19)
1 'mpfr' number of precision  64   bits 
[1] 9223372036854775807       # correct!

... but you will need to change the code that does the calculation so that it uses mpfr-class number with enough precision to safely avoid rounding errors for the size of all intermediate values in your calculation. Probably this means you will write your own determinant algorithm - and if this is just for one matrix it doesn't need to be fast so why not. Google tells me there are division-free algorithms for calculating determinants that are O(n^4). But as I wrote above, I can't imagine why this makes sense.


B.