Basic implementation of cacheable matrix and inverse calculation