Re: [Rcpp-devel] rwishart Rcpp implementation

2015-06-11 Thread Yue Li
Many thanks Neal! Yue > On Jun 11, 2015, at 5:07 PM, Neal Fultz wrote: > > 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 > <>// > <>//

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'

[Rcpp-devel] rwishart Rcpp implementation

2015-06-11 Thread Yue Li
Dear List, I wonder if anyone could share their Rcpp code for an equivalence of rWishart. I’ve come across a similar question in the forum: http://stackoverflow.com/questions/23463852/generate-wishart-distribution-using-rwishart-within-rcpp