Implementation of matrix object creation with caching of matrix inverse.