Only compute matrix exponential once.