Computes the inverse of a matrix if not previouly cached