Hi @karlnapf, 
No this is not transpose. Let me explain with an example. Suppose m was 4x50 (4 num_features and 51 num_vectors). Let our target dimension be 2. So we want a 2x51 matrix. But in the array m.matrix matrix elements are arranged in a column major format. So, in the final matrix we need the 1st 2 elements and then we dont need the next 2 of m.matrix array. Then again we need the next 2 elements and dont need then next 2 of them. In this part of code, I rearrange the array in such a way that all the elements needed are blocked together in the left part of array and then cut out the right part of array. Now that I have the array with needed elements only, I just change num_rows and num_cols of m to get the final matrix. This works for all cases!