Cached matrix inversion functions