Sparse Matrix Exponentiation

64 Views Asked by At

Given a sparse square matrix $M$ (whose size is about $10^5 \times 10^5$ which is too large to fit in the memory) and a positive integer $n$ (roughly a billion), I'd like to ask how to calculate the sum of all entries of $M^n$?