Apply a function to the margins of a distributed matrix.
# S4 method for ddmatrix
apply(X, MARGIN, FUN, ..., reduce = FALSE,
proc.dest = "all")distributed matrix
subscript over which the function will be applied
the function to be applied
additional arguments to FUN
logical or string. See details
Destination process (or 'all') if a reduction occurs
Returns a distributed matrix unless a reduction is requested, then a global matrix/vector is returned.
If reduce==TRUE then a global matrix or vector (whichever is more
appropriate) will be returned. The argument proc.dest= behaves
exactly as in the as.vector() and as.matrix() functions of
pbdDMAT. If reduce=FALSE then a distributed matrix is returned.
Other acceptable arguments are reduce="matrix" and
reduce="vector" which demand global matrix or vector return,
respectively. This should generally be slightly more efficient than running
apply and then calling as.vector() or as.matrix().