Cached matrix inverse for R programming class