RfastOfficial / Rfast

A collection of Rfast functions for data analysis. Note 1: The vast majority of the functions accept matrices only, not data.frames. Note 2: Do not have matrices or vectors with have missing data (i.e NAs). We do no check about them and C++ internally transforms them into zeros (0), so you may get wrong results. Note 3: In general, make sure you give the correct input, in order to get the correct output. We do no checks and this is one of the many reasons we are fast.
139 stars 19 forks source link

Running rowMedians with parallel = TRUE on certain matrices can crash R session #106

Open StevenMayher opened 3 months ago

StevenMayher commented 3 months ago

Describe the bug I haven't fully deduced the precise nature of the following bug, but it seems that running rowMedians with parallel = TRUE on the matrix generated below crashes my R session:

To Reproduce

library(Rfast)
set.seed(42)
mat = matrix(sample(100000, replace = TRUE), nrow = 1000, ncol = 100)
rowMedians(mat, parallel = TRUE)

Expected behavior

rowMedians(mat, parallel = FALSE)

Desktop:

sessionInfo()

R version 4.3.3 (2024-02-29 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

time zone: America/New_York tzcode source: internal

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] Rfast_2.1.0 RcppParallel_5.1.7 RcppZiggurat_0.1.6 Rcpp_1.0.12

loaded via a namespace (and not attached): [1] compiler_4.3.3 parallel_4.3.3 tools_4.3.3 rstudioapi_0.15.0