Initial adaptation from example file. Changed function compute and cache matrix
inverse rather than vector mean