Accurately computes the logarithm of the sum of exponentials across rows or columns.
rowLogSumExps(lx, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(lx), ..., useNames = TRUE)colLogSumExps(lx, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(lx), ..., useNames = TRUE)
A numeric
vector
of length N
(K).
A vector
indicating subset of rows
(and/or columns) to operate over. If NULL
, no subsetting
is done.
If TRUE
, any missing values are
ignored, otherwise not.
An integer
vector
of
length two specifying the dimension of x
, also when not a
matrix
.
Not used.
If FALSE
(default), no naming
support is done. Else if TRUE
, names attributes
of result are set.
These methods are implemented in native code and have been optimized for speed and memory.
Native implementation by Henrik Bengtsson. Original R code by Nakayama ??? (Japan).
To calculate the same on vectors, logSumExp
().