cache matrix object implementation