added cachemean calculation
solution for cachematrix