# NOT RUN {
# Save code in a file "demo.r" and run with 2 processors by
# > mpiexec -np 2 Rscript demo.r
library(pbdDMAT, quiet = TRUE)
init.grid()
if (comm.rank()==0){
x <- matrix(1:16, ncol=4)
} else {
x <- NULL
}
dx <- as.ddmatrix(x, bldim=2)
dx
### Can also be common to all ranks
y <- matrix(1:25, 5, bldim=2)
dy <- as.ddmatrix(y)
dy
finalize()
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab