Displaying 2 results from an estimated 2 matches for "binarysearch".
2011 Apr 04
2
General binary search?
...ich is quite noticeable for largish N. But that is easy
enough to work around by writing a variant of findInterval which calls
find_interv_vec without checking.
-s
PS Yes, binary search is a one-liner in R, but I always prefer to use
standard, fast native libraries when possible....
binarysearch <- function(val,tab,L,H) {while (H>=L) { M=L+(H-L) %/% 2; if
(tab[M]>val) H<-M-1 else if (tab[M]<val) L<-M+1 else return(M)};
return(L-1)}
[[alternative HTML version deleted]]
2023 Sep 02
1
Fails to install Rfast package
...orks/R.framework/Resources/include" -DNDEBUG
-I../inst/include
-I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include'
-I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppArmadillo/include'
-I/usr/local/include -fPIC -Wall -g -O2 -c binarysearch.cpp -o
binarysearch.o
In file included from binarysearch.cpp:3:
In file included from
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppArmadillo/include/RcppArmadillo.h:29:
In file included from
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppArmadillo/includ...