| bpvec {BiocParallel} | R Documentation |
bpvec applies FUN to subsets of X. Any type of
object X is allowed, provided length, [, and
c methods are available. The return value is a vector of
length equal to X, as with FUN(X).
bpvec(X, FUN, ..., AGGREGATE=c, BPPARAM=bpparam()) ## S4 method for signature 'ANY,ANY' bpvec(X, FUN, ..., AGGREGATE=c, BPPARAM=bpparam()) ## S4 method for signature 'ANY,BiocParallelParam' bpvec(X, FUN, ..., AGGREGATE=c, BPPARAM=bpparam()) ## S4 method for signature 'ANY,missing' bpvec(X, FUN, ..., AGGREGATE=c, BPPARAM=bpparam())
X |
Any object for which methods |
FUN |
The |
... |
Additional arguments for |
AGGREGATE |
A function taking any number of arguments |
BPPARAM |
A optional |
When BPPARAM is an instance of a class derived from
BiocParallelParam for which no other method applies, this
method creates a vector of indexes and uses these in conjunction with
bplapply to arrange for parallel evaluation.
When BPPARAM is a class for which no method is defined (e.g.,
SerialParam), FUN(X) is used.
See showMethods{bpvec} for additional methods, e.g.,
method?bpvec("MulticoreParam").
The result should be identical to FUN(X, ...) (assuming that
AGGREGATE is set appropriately).
Martin Morgan mailto:mtmorgan@fhcrc.org. Original code as
attributed in pvec.
bplapply for parallel lapply.
BiocParallelParam for possible values of BPPARAM.
showMethods("bpvec")
## ten tasks (1:10), called with as many back-end elements are specified
## by BPPARAM. Compare with bplapply
system.time(result <- bpvec(1:10, function(v) {
message("working") ## 10 tasks
sqrt(v)
}))
result