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

matrnorm return errors #49

Closed xiekunwhy closed 2 years ago

xiekunwhy commented 2 years ago

Hi,

I got the following errors when using matrnorm, do you know why?

library(Rfast) Loading required package: Rcpp Loading required package: RcppZiggurat x <- matrnorm(37488, 130123) Error in RcppZiggurat::zrnorm(n p) : negative length vectors are not allowed In addition: Warning message: In RcppZiggurat::zrnorm(n p) : NAs introduced by coercion to integer range

Best, Kun

StefanosFafalios commented 2 years ago

Hello xiekunwhy,

Thank you for notifying us. As you can observe, the error actually comes from package RcppZiggurat::zrnorm. This most probably happens because 37488 130123 = 4878051024, whereas INTEGER_MAX_VALUE = 2147483647. This issue could be resolved if the RcppZiggurat developers set zrnorm accept long as input instead of int. For now RcppZiggurat can not handle such matrix sizes. Try reducing the number of rows (n) or number of columns (p) so that n p < 2147483647

Best, Rfast team

P.S. this issue will be closed since it is occuring in another package.