RandomExpArray-class {DelayedRandomArray} | R Documentation |
A DelayedArray subclass that performs on-the-fly sampling of exponentially distributed values.
RandomExpArraySeed(dim, rate = 1, chunkdim = NULL) ## S4 method for signature 'RandomExpArraySeed' DelayedArray(seed) RandomExpArray(dim, rate = 1, chunkdim = NULL)
dim |
Integer vector of positive length, specifying the dimensions of the array. |
rate |
Numeric vector used as |
chunkdim |
Integer vector of length equal to |
seed |
A RandomExpArraySeed object. |
All constructors return an instance of a RandomExpArray object, containing random draws from a exponential distribution with the specified parameters.
Aaron Lun
The RandomArraySeed class, for details on chunking and the distributional parameters.
X <- RandomExpArraySeed(c(1e5, 1e5)) Y <- DelayedArray(X) Y # Fiddling with the distribution parameters: X2 <- RandomExpArraySeed(c(1e5, 1e5), rate=runif(1e5)) Y2 <- DelayedArray(X2) Y2 # Using another array as input: library(Matrix) rate <- rsparsematrix(1e5, 1e5, density=0.00001) rate <- abs(DelayedArray(rate)) + 1 X3 <- RandomExpArraySeed(c(1e5, 1e5), rate=rate) Y3 <- DelayedArray(X3) Y3