update Matrix class