update Matrix class.