# Arithmetic Reductions: Sums, Means, and Prods

### Description

Arithmetic reductions for distributed matrices.

### Usage

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ```
rowMin(x, ...)
rowMax(x, ...)
colMin(x, ...)
colMax(x, ...)
## S4 method for signature 'ddmatrix'
rowSums(x, na.rm = FALSE)
## S4 method for signature 'ddmatrix'
colSums(x, na.rm = FALSE)
## S4 method for signature 'ddmatrix'
rowMeans(x, na.rm = FALSE)
## S4 method for signature 'ddmatrix'
colMeans(x, na.rm = FALSE)
## S4 method for signature 'ddmatrix'
rowMin(x, na.rm = FALSE)
## S4 method for signature 'matrix'
rowMin(x, na.rm = FALSE)
## S4 method for signature 'ddmatrix'
colMin(x, na.rm = FALSE)
## S4 method for signature 'matrix'
colMin(x, na.rm = FALSE)
## S4 method for signature 'ddmatrix'
rowMax(x, na.rm = FALSE)
## S4 method for signature 'matrix'
rowMax(x, na.rm = FALSE)
## S4 method for signature 'ddmatrix'
colMax(x, na.rm = FALSE)
## S4 method for signature 'matrix'
colMin(x, na.rm = FALSE)
``` |

### Arguments

`x` |
numeric distributed matrix |

`...` |
additional arguments |

`na.rm` |
logical. Should missing (including |

### 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`

.

### Value

Returns a global numeric vector.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |