# 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()
# don't do this in production code
x <- matrix(1:16, ncol=4)
dx <- as.ddmatrix(x)
y <- as.matrix(dx, proc.dest=0)
finalize()
Run the code above in your browser using DataLab