Re: [Rcpp-devel] Detecting Singular Matrices in RcppArmadillo

2022-01-28 Thread Neal Fultz
There's an R object that has the machine precision, which could be a reasonable threshold. .Machine$double.eps I believe there is a similar constant in the C++ standard library. You might also try checking the condition of the matrix instead of the determinant, but you might take a performance h

Re: [Rcpp-devel] Rcpp - libtorrent

2019-02-10 Thread Neal Fultz
Rcpp should make this very straightforward; assuming you are putting this in a package (because why wouldn't you?) you would just need to set some flags in src/Makefile so that the external library gets picked up correctly by R, and write a few Rcpp wrapper functions for interacting with it. See a

Re: [Rcpp-devel] Manipulating json with Rcpp

2018-10-11 Thread Neal Fultz
lso using the nlohmann/json.h, maybe I can ask him to move json.h from src/ to inst/include for his next release. I think that's all that needed to make Rcpp::depends / LinkingTo work. On Thu, Oct 11, 2018 at 12:18 PM Dirk Eddelbuettel wrote: > > On 11 October 2018 at 11:50, Neal Fultz

[Rcpp-devel] Manipulating json with Rcpp

2018-10-11 Thread Neal Fultz
to inst/include). Maybe someone else will find this useful some day. Best, Neal Fultz ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] rwishart Rcpp implementation

2015-06-11 Thread Neal Fultz
I had ported the bayesm version a while a back, here it is: List rwishart(int nu, NumericMatrix const& V){// function to draw from Wishart (nu,V) and IW// // W ~ W(nu,V) E[W]=nuV// // WI=W^-1 E[WI]=V^-1/(nu-m-1) RNGScope rngscope; int m = V.nrow();mat Vm(V.begin(), m, m, false);// Can'

Re: [Rcpp-devel] rwishart Rcpp implementation

2015-06-11 Thread Neal Fultz
I had ported the bayesm version a while a back, here it is: List rwishart(int nu, NumericMatrix const& V){// function to draw from Wishart (nu,V) and IW// // W ~ W(nu,V) E[W]=nuV// // WI=W^-1 E[WI]=V^-1/(nu-m-1) RNGScope rngscope; int m = V.nrow();mat Vm(V.begin(), m, m, false);// Can'

Re: [Rcpp-devel] Difference between runif and unif_rand?

2013-07-12 Thread Neal Fultz
I use the debian packages. Upgrading r-cran-rcpp from testing to unstable seems to have fixed this for me, so good call. On Fri, Jul 12, 2013 at 10:25:17PM -0400, Krzysztof Sakrejda wrote: > On Fri, Jul 12, 2013 at 8:50 PM, Dirk Eddelbuettel wrote: > > > > On 12 July 2013 at 12

[Rcpp-devel] Difference between runif and unif_rand?

2013-07-12 Thread Neal Fultz
I've been updating the C in an r package to use Rcpp and started seeing so odd results from a function that samples from a discrete distribution. I think I've narrowed it down to the sugar runif. The two programs below are identical except f_works uses unif_rand and f_broke goes through runif.