Compute powers of matrix using diagonalization (#698)

Compute powers of matrix using diagonalization (#698)

An=PDnP−1A^n = P D^n P^{-1}.