## S3 method for class 'character':
ddmatrix(data, nrow = 1, ncol = 1, byrow = FALSE,
..., min = 0, max = 1, mean = 0, sd = 1,
rate = 1, shape, scale = 1,
bldim = .BLDIM, ICTXT = .ICTXT)
## S3 method for class 'matrix':
ddmatrix(data, nrow = 1, ncol = 1, byrow = FALSE,
..., bldim = .BLDIM, ICTXT = .ICTXT)
## S3 method for class 'missing':
ddmatrix(data, nrow = 1, ncol = 1, byrow = FALSE,
..., bldim = .BLDIM, ICTXT = .ICTXT)
## S3 method for class 'vector':
ddmatrix(data, nrow = 1, ncol = 1, byrow = FALSE,
..., bldim = .BLDIM, ICTXT = .ICTXT)
## S3 method for class 'character':
ddmatrix.local(data, nrow = 1, ncol = 1, byrow = FALSE,
..., min = 0, max = 1, mean = 0, sd = 1,
rate = 1, shape, scale = 1,
bldim = .BLDIM, ICTXT = .ICTXT)
## S3 method for class 'matrix':
ddmatrix.local(data, nrow = 1, ncol = 1, byrow = FALSE,
..., bldim = .BLDIM, ICTXT = .ICTXT)
## S3 method for class 'missing':
ddmatrix.local(data, nrow = 1, ncol = 1, byrow = FALSE,
..., bldim = .BLDIM, ICTXT = .ICTXT)
## S3 method for class 'vector':
ddmatrix.local(data, nrow = 1, ncol = 1, byrow = FALSE,
..., bldim = .BLDIM, ICTXT = .ICTXT)
ddmatrix()
. Local
rows for ddmatrix.local()
. See details below.ddmatrix()
.
Local columns for ddmatrix.local()
. See details below.FALSE
then the distributed matrix will
be filled by column major storage, otherwise row-major.ddmatrix
using these methods (in contrast to using as.ddmatrix()
et al).
For non-character inputs, the methods attempt to mimic R as closely
as possible. So ddmatrix(1:3, 5, 7)
produces the distributed
analogue of matrix(1:3, 5, 7)
.
For character inputs, you may also specify additional parametric family
information.
The functions predicated with .local
generate data with a
fixed local dimension, i.e., each processor gets an identical amount
of data. Likewise, the remaining functions generate a fixed global
amount of data, and each processor may or may not have an identical
amount of local data.
To ensure good random number generation, you should only consider
using the character methods with the comm.set.seed()
function
from pbdMPI which uses the method of L'Ecuyer via the rlecuyer package.as.ddmatrix
# 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()
dx <- ddmatrix(data="rnorm", nrow=5, ncol=6, mean=10, sd=100)
dy <- ddmatrix(data=1:4, nrow=7, ncol=5)
print(dx)
print(dy)
finalize()
Run the code above in your browser using DataLab