Cached inverse calculation

Calculates the inverse of a matrix and caches once it's calculated for
future calculations