Learn R Programming

pbdDMAT (version 0.5-1)

reductions: Arithmetic Reductions: Sums, Means, and Prods

Description

Arithmetic reductions for distributed matrices.

Usage

rowMin(x, ...)

rowMax(x, ...)

colMin(x, ...)

colMax(x, ...)

# S4 method for ddmatrix rowSums(x, na.rm = FALSE)

# S4 method for ddmatrix colSums(x, na.rm = FALSE)

# S4 method for ddmatrix rowMeans(x, na.rm = FALSE)

# S4 method for ddmatrix colMeans(x, na.rm = FALSE)

# S4 method for ddmatrix rowMin(x, na.rm = FALSE)

# S4 method for matrix rowMin(x, na.rm = FALSE)

# S4 method for ddmatrix colMin(x, na.rm = FALSE)

# S4 method for matrix colMin(x, na.rm = FALSE)

# S4 method for ddmatrix rowMax(x, na.rm = FALSE)

# S4 method for matrix rowMax(x, na.rm = FALSE)

# S4 method for ddmatrix colMax(x, na.rm = FALSE)

# S4 method for matrix colMin(x, na.rm = FALSE)

Arguments

x

numeric distributed matrix

...

additional arguments

na.rm

logical. Should missing (including NaN) be removed?

Value

Returns a global numeric vector.

Details

Performs the reduction operation on a distributed matrix.

There are several legitimately new operations, including rowMin(), rowMax(), colMin(), and colMax(). These implementations are not really necessary in R because one can easily (and reasonably efficiently) do something like

apply(X=x, MARGIN=1L, FUN=min, na.rm=TRUE)

But apply() on a ddmatrix is very costly, and should be used sparingly.

sd() will compute the standard deviations of the columns, equivalent to calling apply(x, MARGIN=2, FUN=sd) (which will work for distributed matrices, by the way). However, this should be much faster and use less memory than apply(). If reduce=FALSE then the return is a distributed matrix consisting of one (global) row; otherwise, an R vector is returned, with ownership of this vector determined by proc.dest.