Inverse of a matrix

This code calculates the inverse of a matrix and cache it in memory for
use it in the future if it is needed.