Skip to contents

Symbolic element-wise x*log(x) function for LazyTensor objects or standard element-wise x*log(x) function otherwise.

Usage

xlogx(x)

Arguments

x

input for xlogx.default() or xlogx.LazyTensor().

Value

See value of xlogx.default() or xlogx.LazyTensor()

Details

If x is a LazyTensor, see xlogx.LazyTensor(), else see xlogx.default().

Note: by convention xlogx(0) returns 0.

Author

Chloe Serre-Combe, Amelie Vernay

Examples

if (FALSE) {
# Numerical input
xlog(4)
xlog(1:10)
# LazyTensor symbolic element-wise `x*log(x)`
x <- matrix(runif(150 * 3), 150, 3) # arbitrary R matrix, 150 rows, 3 columns
x_i <- LazyTensor(x, index = 'i')   # creating LazyTensor from matrix x, 
                                    # indexed by 'i'
xlog_x <- xlogx(x_i)                # symbolic matrix, 150 rows and 3 columns
}