[R] simple matrix calculation
Kehl Dániel
kehld at ktk.pte.hu
Wed Mar 28 22:46:11 CEST 2012
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
a31, a32, a33
- I want to get rowSums of this A1 matrix
- Multiply A1*B and get a scalar, the first element of my new 3x3 matrix.
I could do that with loop. Can you suggest something that is more
elegant and faster?
Thank you
Daniel
More information about the R-help
mailing list