special implementation for RowMajorMatrix