# 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=c(4,4))
print(dx)
finalize()
Run the code above in your browser using DataLab