routines to cache a matrix inverse