Learn R Programming

BayesCPclust (version 0.1.0)

logsumexp: Transfor a vector with over- or underflow

Description

Transfor a vector with over- or underflow

Usage

logsumexp(x, min_x = Inf)

Value

`logsumexp` returns each element of the vector `x` transformed using the Log-Sum-Exp trick.

Arguments

x

A vector with numbers

min_x

A numerical value to represent the minimum value to perform comparison with the actual minimum value of `x`

Examples

Run this code
# Transforming all elements in a vector using the Log-Sum-Exp trick
x <- c(1, 2, 3, 4, 5, 6)
logsumexp(x)

Run the code above in your browser using DataLab