Added documentation and transcribed the vector example in the matrix version where the inverted matrx is cached