entropy: Entropy of a vector

View source: R/RcppExports.R

entropyR Documentation

Entropy of a vector

Description

This function computes the entropy of a vector, understood as a discrete distribution over the index.

Usage

entropy(x)

Arguments

x

vector representing the distribution. Not checked to see whether it is properly normalized.

Value

sum_i x_i \log x_i, where the log is base 2 and the sum is taken only over non-zero elements of x.


agoldst/dfrtopics documentation built on July 15, 2022, 4:13 p.m.