first version of cached matrix inverse functions