Added optimized version of Matrix Exponentiation.