Re: [R] Split matrix into square submatices

2012-02-10 Thread xiddw
Thanks to Peter and Gabriel for their comments, The first way which Peter commented was my first approach, however as I use it for a 'large' matrix (in my case nrow = ncol = 512) and I want to split it into very small matrices (e.g. nrow = ncol = {4, 8, 16}) both nested loops I think are a quite e

[R] Split matrix into square submatices

2012-02-10 Thread xiddw
Hi everybody, I'm looking for an optimal way to split a big matrix (e.g. ncol = 8, nrow=8) into small square submatrices (e.g. ncol=2, nrow=2) For example If I have > h [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,]19 17 25 33 41 49 57 [2,]2 10 18 26 34