RfastOfficial / Rfast2

A collection of Rfast2 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.
37 stars 4 forks source link

is.lower.tri() seems to be treating upper triangular matrix as lower triangular #3

Closed xiao-zang closed 4 years ago

xiao-zang commented 4 years ago

is.lower.tri() seems to be treating upper triangular matrix as lower triangular matrix, and is.upper.tri() seems to be treating lower triangular matrix as upper triangular matrix.

Also, the return type seems to be inconsistent between is.lower.tri and is.upper.tri, one being logical and the other being double.

Example:

smallmat <- matrix(c(1,1,0,1), nrow = 2, byrow=FALSE) smallmat [,1] [,2] [1,] 1 0 [2,] 1 1 is.lower.tri(smallmat) [1] 0 is.upper.tri(smallmat) [1] TRUE smallmat2 <- matrix(c(1,1,0,1), nrow = 2, byrow=TRUE) smallmat2 [,1] [,2] [1,] 1 1 [2,] 0 1 is.lower.tri(smallmat2) [1] 1 is.upper.tri(smallmat2) [1] FALSE typeof(is.upper.tri(smallmat2)) [1] "logical" typeof(is.lower.tri(smallmat2)) [1] "double"

statlink commented 4 years ago

Cheers for this xiao-zang. We will have a look.

ManosPapadakis95 commented 4 years ago

Done.

xiao-zang commented 4 years ago

Done.

@ManosPapadakis95 I know it is a dumb question, but how do I install the updated version of Rfast2? Previously I installed Rfast2 using install.packages("Rfast2"), but the package installed in this way is not updated to reflect the fix yet.

ManosPapadakis95 commented 4 years ago

You need to download the package from github.

xiao-zang commented 4 years ago

@ManosPapadakis95 Thank you for the reply! I did the following: 1) downloaded Rfast2 from GitHub, uncompressed the zip file and compressed the content into Rfast2.tar.gz using terminal command tar -czf Rfast2.tar.gz Rfast2-master 2) installed dependencies RANN and Rfast using install.packages("RANN") and install.packages("Rfast") 3) tried to install Rfast2 using install.packages("~/Downloads/Rfast2.tar.gz", repos = NULL, type = "source"), but got the following error:

clang: error: unsupported option '-fopenmp' make: *** [._Eval.o] Error 1 ERROR: compilation failed for package ‘Rfast2’

Maybe I did something wrong. Could you kindly advise the correct way to install Rfast2 from GitHub?

Thanks!