performance - Vectorized reshaping of matrix by blocks -


i have matrix

[1,2,3;  4,5,6;  7,8,9;  10,11,12;] 

i want reshape in block of 2, stack rows in multiples of 2. output like

[1,2,3,7,8,9;  4,5,6,10,11,12] 

in general want reshape in (n^2) x m matrix n x (n*m) matrix in blocks. ideas?

simple enough, assuming a input matrix -

reshape(permute(reshape(a,n,n,[]),[1 3 2 4]),n,[]) 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -