simplify Matrix class