matrix object that can cache its inverse