matrix exponentiation.