Re: [Rcpp-devel] RNGScope

2012-08-14 Thread Dirk Eddelbuettel
Hi Rodney, On 14 August 2012 at 09:17, Rodney Sparapani wrote: | This is my first post so please be gentle ;o) I have been through Welcome -- the list is generally very nice and helpful. | all of the docs that I can find (but I haven't looked at the source | code directly). Here is the behav

Re: [Rcpp-devel] RNGScope

2012-08-14 Thread Rodney Sparapani
On 08/14/2012 09:38 AM, Douglas Bates wrote: I think you want to move the RNGScope declaration before the calls to rcauchy and runif. That's it! Thank you Doug. -- Rodney Sparapani, PhD Center for Patient Care and Outcomes Research Sr. Biostatistician http://www.mcw.edu/pcor 4

Re: [Rcpp-devel] RNGScope

2012-08-14 Thread Douglas Bates
I think you want to move the RNGScope declaration before the calls to rcauchy and runif. On Tue, Aug 14, 2012 at 9:17 AM, Rodney Sparapani wrote: > This is my first post so please be gentle ;o) I have been through > all of the docs that I can find (but I haven't looked at the source > code direc

[Rcpp-devel] RNGScope

2012-08-14 Thread Rodney Sparapani
This is my first post so please be gentle ;o) I have been through all of the docs that I can find (but I haven't looked at the source code directly). Here is the behavior that I see: > require(inline) Loading required package: inline > source("helper.R") > source("corrMH.R") > > set.seed(66) >

Re: [Rcpp-devel] RNGScope, importing function, and if-else statement

2012-04-16 Thread Dirk Eddelbuettel
On 16 April 2012 at 12:43, Marie Auger-Methe wrote: | Hi Dirk and list, | | As suggested by Dirk I have re-written the function rvm in Rcpp (see | below) and it now gives the same results as the rvm function in R. So my Super! | problem is fixed (although it would nice if you could just impor

Re: [Rcpp-devel] RNGScope, importing function, and if-else statement

2012-04-16 Thread Marie Auger-Methe
Hi Dirk and list, As suggested by Dirk I have re-written the function rvm in Rcpp (see below) and it now gives the same results as the rvm function in R. So my problem is fixed (although it would nice if you could just import an R RNG function in Rcpp... maybe a future development ;) ). I'm st

Re: [Rcpp-devel] RNGScope, importing function, and if-else statement

2012-04-16 Thread Dirk Eddelbuettel
Marie, On 16 April 2012 at 08:56, Marie Auger-Methe wrote: | Hi Dirk, | | Thank you for the prompt reply! | By reimplement rvm using Rcpp sugar functions, do you mean re-write the | rvm function using sugar functions? Yes. (But as I said I have not yet looked at the code for rvm at all...)

Re: [Rcpp-devel] RNGScope, importing function, and if-else statement

2012-04-16 Thread Marie Auger-Methe
Yes, there is something weird about the RNG. If you replace vmc by a function known to Rcpp such as rnorm this problem doesn't occur. If you create a function that uses only the imported vmc the problem doesn't occur either. The problem resides in calling two functions, of which one is importe

Re: [Rcpp-devel] RNGScope, importing function, and if-else statement

2012-04-16 Thread Marie Auger-Methe
Hi Dirk, Thank you for the prompt reply! By reimplement rvm using Rcpp sugar functions, do you mean re-write the rvm function using sugar functions? Marie On 15/04/2012 9:39 PM, Dirk Eddelbuettel wrote: Hi Marie, On 15 April 2012 at 19:01, Marie Auger-Methe wrote: | Hi, | | I want to use a r

Re: [Rcpp-devel] RNGScope, importing function, and if-else statement

2012-04-15 Thread Davor Cubranic
At Sun, 15 Apr 2012 19:01:30 +0100, Marie Auger-Methe wrote: > I want to use a random generator that is not available in the Rcpp: > rvm from R's CircStats package and I want the number generated to be > the same as the equivalent function in R. Importing the function > within a Rcpp inline functio

Re: [Rcpp-devel] RNGScope, importing function, and if-else statement

2012-04-15 Thread Dirk Eddelbuettel
Hi Marie, On 15 April 2012 at 19:01, Marie Auger-Methe wrote: | Hi, | | I want to use a random generator that is not available in the Rcpp: rvm | from R's CircStats package and I want the number generated to be the | same as the equivalent function in R. Importing the function within a | Rcpp

[Rcpp-devel] RNGScope, importing function, and if-else statement

2012-04-15 Thread Marie Auger-Methe
Hi, I want to use a random generator that is not available in the Rcpp: rvm from R's CircStats package and I want the number generated to be the same as the equivalent function in R. Importing the function within a Rcpp inline function works fine except if you have an if-else statement. The s

Re: [Rcpp-devel] RNGScope does work?

2011-02-17 Thread Dirk Eddelbuettel
On 17 February 2011 at 18:16, Carlos Almeida wrote: | Hi, | | I'm new by using C++ and Rcpp, but I wrote an minimal example which | shows the problem: | | | | require( inline ) | require( Rcpp ) | | | src <- ' | RNGScope scope; | //GetRNGstate(); | |

[Rcpp-devel] RNGScope does work?

2011-02-17 Thread Carlos Almeida
Hi, I'm new by using C++ and Rcpp, but I wrote an minimal example which shows the problem: require( inline ) require( Rcpp ) src <- ' RNGScope scope; //GetRNGstate(); int NN = INTEGER(sNN)[0]; int T = INTEGER(sT)[0]; Rcpp::NumericMatrix lar(T+1