Reputation: 143
I am working with very large graphs and their corresponding weighted adjacency matrices, and I need to take these large matrices to similarly large powers (i.e. raising matrices to the power of tens of thousands).
The issue I have run into is that elements of the matrix quickly become too large for the computer to handle, and I am wondering how to get around this problem.
Has anyone worked with such problems before(raising matrices to large powers), and how did you resolve them?
I know Python's numpy
can handle these computations. Is there an analogous library in Julia that can do this as well?
Upvotes: 0
Views: 364
Reputation: 6086
You could do a transfomation of type to BigFloat:
julia> A = [1.5 2 -4; 3 -1 -6; -10 2.3 4]
3×3 Array{Float64,2}:
1.5 2.0 -4.0
3.0 -1.0 -6.0
-10.0 2.3 4.0
julia> (BigFloat.(A))^32000
3×3 Array{BigFloat,2}:
4.16164e+31019 8.71351e+31017 -3.22788e+31019
4.60207e+31019 9.63565e+31017 -3.56949e+31019
-5.83403e+31019 -1.22151e+31018 4.52503e+31019
Upvotes: 1