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

Re: [R] Split matrix into square submatices

2012-02-10 Thread Gabor Grothendieck
On Fri, Feb 10, 2012 at 3:02 AM, xiddw wrote: > 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,]    1  

Re: [R] Split matrix into square submatices

2012-02-10 Thread Petr Savicky
On Fri, Feb 10, 2012 at 12:02:25AM -0800, xiddw wrote: > 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] [,

[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