easy algoritam for collect rows from matrix and put them in new matrix in c++