Re: [R] simple matrix calculation

2012-03-29 Thread Petr Savicky
On Thu, Mar 29, 2012 at 03:13:25PM +0200, Petr Savicky wrote: > On Thu, Mar 29, 2012 at 01:16:49PM +0200, Kehl Dániel wrote: > > Dear David, Ted, Kjetil, Petr, > > > > thank you, you guys did a great job, I'll use your ideas in the future > > for sure. > > After I sent the question I figured a wa

Re: [R] simple matrix calculation

2012-03-29 Thread Petr Savicky
On Thu, Mar 29, 2012 at 01:16:49PM +0200, Kehl Dániel wrote: > Dear David, Ted, Kjetil, Petr, > > thank you, you guys did a great job, I'll use your ideas in the future > for sure. > After I sent the question I figured a way, see below. > > x <- 1:81 > b <- 1:3 > Q <- matrix(x,9,9) > result <- m

Re: [R] simple matrix calculation

2012-03-29 Thread Berend Hasselman
On 29-03-2012, at 13:16, Kehl Dániel wrote: > Dear David, Ted, Kjetil, Petr, > > thank you, you guys did a great job, I'll use your ideas in the future for > sure. > After I sent the question I figured a way, see below. > > x <- 1:81 > b <- 1:3 > Q <- matrix(x,9,9) > result <- matrix(matrix(co

Re: [R] simple matrix calculation

2012-03-29 Thread Kehl Dániel
Dear David, Ted, Kjetil, Petr, thank you, you guys did a great job, I'll use your ideas in the future for sure. After I sent the question I figured a way, see below. x <- 1:81 b <- 1:3 Q <- matrix(x,9,9) result <- matrix(matrix(colSums(matrix(t(Q),3)),,3,TRUE) %*% b,3,3) I hope there is no er

Re: [R] simple matrix calculation

2012-03-28 Thread Petr Savicky
On Wed, Mar 28, 2012 at 10:46:11PM +0200, Kehl Dániel wrote: > Dear list-members, > > I have a 9-by-9 matrix lets call it A with first row a11, a12, a13,..., > a19 etc. > I also have a vector of length 3 (B). > I want to construct a matrix of size 3x3 in the following way: > - divide matrix A to

Re: [R] simple matrix calculation

2012-03-28 Thread Kjetil Halvorsen
see inline. On Wed, Mar 28, 2012 at 2:46 PM, Kehl Dániel wrote: > Dear list-members, > > I have a 9-by-9 matrix lets call it A with first row a11, a12, a13,..., a19 > etc. > I also have a vector of length 3 (B). > I want to construct a matrix of size 3x3 in the following way: > - divide matrix A

Re: [R] simple matrix calculation

2012-03-28 Thread David Winsemius
On Mar 28, 2012, at 4:46 PM, Kehl Dániel wrote: Dear list-members, I have a 9-by-9 matrix lets call it A with first row a11, a12, a13,..., a19 etc. I also have a vector of length 3 (B). I want to construct a matrix of size 3x3 in the following way: - divide matrix A to 9 3x3 blocks - first

Re: [R] simple matrix calculation

2012-03-28 Thread Ted Harding
On 28-Mar-2012 Kehl Dániel wrote: > Dear list-members, > I have a 9-by-9 matrix lets call it A with first row > a11, a12, a13,..., a19 etc. > I also have a vector of length 3 (B). > I want to construct a matrix of size 3x3 in the following way: > - divide matrix A to 9 3x3 blocks > - first is >

[R] simple matrix calculation

2012-03-28 Thread Kehl Dániel
Dear list-members, I have a 9-by-9 matrix lets call it A with first row a11, a12, a13,..., a19 etc. I also have a vector of length 3 (B). I want to construct a matrix of size 3x3 in the following way: - divide matrix A to 9 3x3 blocks - first is a11, a12, a13 a21, a22, a23