logsumexp: Compute log(sum(exp(x),dim)) while avoiding numerical...

Description Usage Arguments Value Author(s) References Examples

View source: R/vbgmm.R

Description

Compute log(sum(exp(x),dim)) while avoiding numerical underflow.

Usage

1
logsumexp(x, margin = 1)

Arguments

x

numeric vector or matrix

margin

dimension to apply summation

Value

numeric vector or matrix of the same columns or rows (depending on margin) as x

Author(s)

Yue Li

References

Mo Chen (2012). Matlab code for Variational Bayesian Inference for Gaussian Mixture Model. http://www.mathworks.com/matlabcentral/fileexchange/35362-variational-bayesian-inference-for-gaussian-mixture-model

Examples

1
logsumexp(matrix(c(1:5)), 2)

TargetScore documentation built on Nov. 8, 2020, 6:56 p.m.