new matrix implementation