R/RcppExports.R

Defines functions fast_threshold_detect fast_mutual_info fast_entropy_2d fast_conditional_cor fast_rolling_cor

Documented in fast_conditional_cor fast_entropy_2d fast_mutual_info fast_rolling_cor fast_threshold_detect

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

#' @title Fast Rolling Correlation
#' @description Compute rolling correlation between two vectors efficiently.
#' @param x Numeric vector
#' @param y Numeric vector
#' @param window_size Integer window size
#' @return Numeric vector of rolling correlations
#' @keywords internal
fast_rolling_cor <- function(x, y, window_size) {
    .Call('_dormancy_fast_rolling_cor', PACKAGE = 'dormancy', x, y, window_size)
}

#' @title Fast Conditional Correlation
#' @description Compute correlation conditioned on a third variable being in a range.
#' @param x Numeric vector
#' @param y Numeric vector
#' @param z Conditioning variable
#' @param z_min Lower bound for z
#' @param z_max Upper bound for z
#' @return Correlation coefficient
#' @keywords internal
fast_conditional_cor <- function(x, y, z, z_min, z_max) {
    .Call('_dormancy_fast_conditional_cor', PACKAGE = 'dormancy', x, y, z, z_min, z_max)
}

#' @title Fast 2D Entropy
#' @description Compute entropy of a 2D binned distribution.
#' @param x Numeric vector
#' @param y Numeric vector
#' @param n_bins Number of bins per dimension
#' @return Normalized entropy value
#' @keywords internal
fast_entropy_2d <- function(x, y, n_bins) {
    .Call('_dormancy_fast_entropy_2d', PACKAGE = 'dormancy', x, y, n_bins)
}

#' @title Fast Mutual Information
#' @description Estimate mutual information between two variables.
#' @param x Numeric vector
#' @param y Numeric vector
#' @param n_bins Number of bins for discretization
#' @return Mutual information estimate
#' @keywords internal
fast_mutual_info <- function(x, y, n_bins) {
    .Call('_dormancy_fast_mutual_info', PACKAGE = 'dormancy', x, y, n_bins)
}

#' @title Fast Threshold Detection
#' @description Find optimal threshold where correlation changes most.
#' @param x Numeric vector
#' @param y Numeric vector
#' @param n_thresholds Number of candidate thresholds to test
#' @return List with threshold value and correlation difference
#' @keywords internal
fast_threshold_detect <- function(x, y, n_thresholds) {
    .Call('_dormancy_fast_threshold_detect', PACKAGE = 'dormancy', x, y, n_thresholds)
}

Try the dormancy package in your browser

Any scripts or data that you put into this service are public.

dormancy documentation built on March 16, 2026, 5:09 p.m.