Updated inverse of matrix code in R.