# 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()
### Grab diagonal of a ddmatrix
x <- ddmatrix(1:16, 4, bldim=2)
y <- diag(x)
comm.print(y)
### Construct a diagonal ddmatrix
eye <- diag(1, 10, type="ddmatrix", bldim=2)
eye
finalize()
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab