Dear R-users,

	I would have a question regarding the multiplication between a
matrix (A, mXn) and a block-diagonal matrix, B, (m*n)X(m*n).
The easy solution would be to, first, vectorize A and use simple matrix
multiplication, but my aim is to avoid such vectorization. Is it
possible?
Please find below an explanatory example.

Thanks in advance for any help you can provide.
Best,
Carlo Giovanni



library(Matrix)
# matrix A
A <- matrix(1:12, 3, 4)
# elements of the block-diagonal matrix
M1 <- matrix(1:9,3,3)
M2 <- M1+1
M3 <- M2+1
M4 <- M3+1
# block-diagonal matrix
B <- bdiag(M1, M2, M3, M4)
# simple solution
a <- c(A)
B %*% a

----------
This mail has been sent through the MPI for Demographic ...{{dropped:10}}


