Cached matrix inversion functions implemented