Implemented logic for handling allocation of needed exponential matrices