library(foreach)
library(doMPI)
m<-matrix(as.integer(0),5,5)
cl <- startMPIcluster(count=4)
registerDoMPI(cl)
foreach(b=1:5)%dopar%
{
m[b,]<-c(1:5)
}
Rで上のコードを実行すると、下の結果が得られました。
> m
[,1] [,2] [,3] [,4] [,5]
[1,] 0 0 0 0 0
[2,] 0 0 0 0 0
[3,] 0 0 0 0 0
[4,] 0 0 0 0 0
[5,] 0 0 0 0 0
行ごとの置換に行列を適用するにはどうすればよいですか?