R/RcppExports.R

Defines functions draw_multinom entropy calc_row_entropies naive_cluster_width naive_cluster jsdiv_m jsdiv_v

Documented in entropy

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

jsdiv_v <- function(P, Q) {
    .Call('_dfrtopics_jsdiv_v', PACKAGE = 'dfrtopics', P, Q)
}

jsdiv_m <- function(x, y) {
    .Call('_dfrtopics_jsdiv_m', PACKAGE = 'dfrtopics', x, y)
}

naive_cluster <- function(D, K, threshold) {
    .Call('_dfrtopics_naive_cluster', PACKAGE = 'dfrtopics', D, K, threshold)
}

naive_cluster_width <- function(cl, D) {
    .Call('_dfrtopics_naive_cluster_width', PACKAGE = 'dfrtopics', cl, D)
}

calc_row_entropies <- function(m) {
    .Call('_dfrtopics_calc_row_entropies', PACKAGE = 'dfrtopics', m)
}

#' Entropy of a vector
#'
#' This function computes the entropy of a vector, understood as a discrete
#' distribution over the index.
#'
#' @param x vector representing the distribution. Not checked to see whether
#' it is properly normalized.
#'
#' @return \eqn{sum_i x_i \log x_i}, where the log is base 2 and the sum is
#' taken only over non-zero elements of \eqn{x}.
#'
#' @export
entropy <- function(x) {
    .Call('_dfrtopics_entropy', PACKAGE = 'dfrtopics', x)
}

draw_multinom <- function(nn, probs) {
    .Call('_dfrtopics_draw_multinom', PACKAGE = 'dfrtopics', nn, probs)
}
agoldst/dfrtopics documentation built on July 15, 2022, 4:13 p.m.