R/RcppExports.R

Defines functions rowVariance_cpp make_m2_cpp make_m2_cpp_parallel standardizeSparse_variance_vst calcNBDeviancesWithThetaEstimation cppBetabinPseudoR2_mixed2 cppBetabinPseudoR2_mixed1 cppBetabinPseudoR2_sparse cppBetabinPseudoR2 calcDeviances_ratio silhouette_avg check_openmp_enabled

Documented in make_m2_cpp make_m2_cpp_parallel

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

check_openmp_enabled <- function() {
    .Call(`_splikit_check_openmp_enabled`)
}

silhouette_avg <- function(X, cluster_assignments, n_threads = 1L) {
    .Call(`_splikit_silhouette_avg`, X, cluster_assignments, n_threads)
}

calcDeviances_ratio <- function(M1, M2, num_threads = 1L) {
    .Call(`_splikit_calcDeviances_ratio`, M1, M2, num_threads)
}

cppBetabinPseudoR2 <- function(Z, m1, m2, metric = "CoxSnell") {
    .Call(`_splikit_cppBetabinPseudoR2`, Z, m1, m2, metric)
}

cppBetabinPseudoR2_sparse <- function(Z, m1, m2, metric = "CoxSnell") {
    .Call(`_splikit_cppBetabinPseudoR2_sparse`, Z, m1, m2, metric)
}

cppBetabinPseudoR2_mixed1 <- function(Z, m1, m2, metric = "CoxSnell") {
    .Call(`_splikit_cppBetabinPseudoR2_mixed1`, Z, m1, m2, metric)
}

cppBetabinPseudoR2_mixed2 <- function(Z, m1, m2, metric = "CoxSnell") {
    .Call(`_splikit_cppBetabinPseudoR2_mixed2`, Z, m1, m2, metric)
}

calcNBDeviancesWithThetaEstimation <- function(gene_expression, num_threads = 1L) {
    .Call(`_splikit_calcNBDeviancesWithThetaEstimation`, gene_expression, num_threads)
}

standardizeSparse_variance_vst <- function(matSEXP, display_progress = FALSE) {
    .Call(`_splikit_standardizeSparse_variance_vst`, matSEXP, display_progress)
}

#' Memory-efficient M2 computation building CSC format directly
#'
#' This version minimizes memory usage by:
#' - Building CSC format directly (no triplet intermediate)
#' - Using O(n_groups) workspace per column instead of dense group_sums matrix
#' - Two-pass algorithm: count then fill
#'
#' Memory usage: O(nnz_output) + O(n_groups) workspace
#' vs previous: O(n_groups * n_cells) + O(6 * nnz_output)
#'
#' @param M1 Sparse matrix (dgCMatrix) of inclusion counts (events x cells)
#' @param group_ids Integer vector of group IDs for each event
#' @param n_threads Number of threads for OpenMP (default 1)
#'
#' @return Sparse matrix M2 with same dimensions as M1
#'
#' @keywords internal
make_m2_cpp_parallel <- function(M1, group_ids, n_threads = 1L) {
    .Call(`_splikit_make_m2_cpp_parallel`, M1, group_ids, n_threads)
}

#' Legacy function - redirects to memory-efficient version
#'
#' @param M1 Sparse matrix (dgCMatrix) of inclusion counts (events x cells)
#' @param group_ids Integer vector of group IDs for each event
#' @param n_threads Number of threads for OpenMP (default 1)
#'
#' @return Sparse matrix M2 with same dimensions as M1
#'
#' @keywords internal
make_m2_cpp <- function(M1, group_ids, n_threads = 1L) {
    .Call(`_splikit_make_m2_cpp`, M1, group_ids, n_threads)
}

rowVariance_cpp <- function(mat) {
    .Call(`_splikit_rowVariance_cpp`, mat)
}

Try the splikit package in your browser

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

splikit documentation built on May 13, 2026, 9:08 a.m.