rowLogSumExps: Accurately computes the logarithm of the sum of exponentials...

Description Usage Arguments Value Benchmarking Author(s) See Also

Description

Accurately computes the logarithm of the sum of exponentials across rows or columns.

Usage

1
2
 rowLogSumExps(lx, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(lx), ...)
 colLogSumExps(lx, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(lx), ...)

Arguments

lx

A numeric NxK matrix. Typically lx are log(x) values.

rows, cols

A vector indicating subset of rows (and/or columns) to operate over. If NULL, no subsetting is done.

na.rm

If TRUE, any missing values are ignored, otherwise not.

dim.

An integer vector of length two specifying the dimension of x, also when not a matrix.

...

Not used.

Value

A numeric vector of length N (K).

Benchmarking

These methods are implemented in native code and have been optimized for speed and memory.

Author(s)

Native implementation by Henrik Bengtsson. Original R code by Nakayama ??? (Japan).

See Also

To calculate the same on vectors, logSumExp().



Search within the matrixStats package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.