make_m2_cpp_parallel: Memory-efficient M2 computation building CSC format directly

View source: R/RcppExports.R

make_m2_cpp_parallelR Documentation

Memory-efficient M2 computation building CSC format directly

Description

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

Usage

make_m2_cpp_parallel(M1, group_ids, n_threads = 1L)

Arguments

M1

Sparse matrix (dgCMatrix) of inclusion counts (events x cells)

group_ids

Integer vector of group IDs for each event

n_threads

Number of threads for OpenMP (default 1)

Details

Memory usage: O(nnz_output) + O(n_groups) workspace vs previous: O(n_groups * n_cells) + O(6 * nnz_output)

Value

Sparse matrix M2 with same dimensions as M1


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