Adding capability to calculate inverse of matrix a single time and reuse result