dougmet / unsumnet

R package to reconstruct aggregated network data.
Other
0 stars 0 forks source link

Swap random number generator #12

Closed dougmet closed 9 years ago

dougmet commented 9 years ago

(migrated from bitbucket.org/dougashton/unsumnet)

dougmet commented 9 years ago

Bit of a thorny issue with regard to behaving the same way in R and Python. Might be able to wrap it up.

dougmet commented 9 years ago

The seed needs to be able to be set from the R side. So we'll either use an R RNG (not my preference) or we'll somehow make the RNG state persist between function calls.

dougmet commented 9 years ago

I would say it's a requirement that a user can set the seed in R and that passes through to the C++ code. This being said I'm not wildly happy about using the R RNGs. Option 1: Use the R based RNGs and stop worrying. Option 2: Pull through the RNG state vector and push it back when done. Option 3: Look at how gsl is used with set.seed. Option 4: Look at RcppArmadillo.

dougmet commented 9 years ago

Of course you must remember that in dense_hybrid I'd like this to be easily swap-outable. Probably an ifdef around the mt() function.

dougmet commented 9 years ago

Fixes #12. It's looking a bit buggy though. 960c241ed025

dougmet commented 9 years ago

I'm having too many problems with the Rcpp random numbers. Let's bring back MersenneTwister.h. Remember to add it to the license. What we can do for now is use Rcpp random numbers to fill up the random state. This will give reproducible random numbers and if we use a big enough seed then it won't have problems with repetition.

dougmet commented 9 years ago

rng_wrap was removed in 549192b

dougmet commented 9 years ago

Swapped back to MersenneTwister.h because Rcpp random numbers were crashing all the time. Instead I'm linking with the R seed by using R to fill the MT. Fixes #12 and might affect #22. b967521e9b6b

dougmet commented 9 years ago

New GitHub comment. I bugs me that it crashed so much trying to use the Rcpp solution. I'd like a permanent good solution using RNGs in C++ from R.