matrix exponentiation