cached matrix inversion

caching inverted matrix for repaated use