Improve Matrix class