Cache Inverse Matrix Function

Checks on the cache before recalculating the Inverse