compute matrix exponential with output written to file