aboutsummaryrefslogtreecommitdiff
path: root/src/bslmm.cpp
diff options
context:
space:
mode:
authorPjotr Prins2020-11-28 14:39:05 +0000
committerPjotr Prins2020-11-28 14:39:05 +0000
commitc895358937111d554999db8617c2fde696634f13 (patch)
tree9be16c4a9ced3e48621ccbeef20359a31669f88b /src/bslmm.cpp
parent9efcfa5179279fb5138d2e9ce7ae9796332fa3b2 (diff)
downloadpangemma-c895358937111d554999db8617c2fde696634f13.tar.gz
Sane random generator handling
Diffstat (limited to 'src/bslmm.cpp')
-rw-r--r--src/bslmm.cpp33
1 files changed, 3 insertions, 30 deletions
diff --git a/src/bslmm.cpp b/src/bslmm.cpp
index 3305639..eb961e9 100644
--- a/src/bslmm.cpp
+++ b/src/bslmm.cpp
@@ -84,7 +84,8 @@ void BSLMM::CopyFromParam(PARAM &cPar) {
w_pace = cPar.w_pace;
n_mh = cPar.n_mh;
geo_mean = cPar.geo_mean;
- randseed = cPar.randseed;
+ // randseed = cPar.randseed;
+ gsl_r = cPar.gsl_r;
trace_G = cPar.trace_G;
ni_total = cPar.ni_total;
@@ -107,7 +108,7 @@ void BSLMM::CopyToParam(PARAM &cPar) {
cPar.cHyp_initial = cHyp_initial;
cPar.n_accept = n_accept;
cPar.pheno_mean = pheno_mean;
- cPar.randseed = randseed;
+ // cPar.randseed = randseed;
return;
}
@@ -938,19 +939,6 @@ void BSLMM::MCMC(const gsl_matrix *U, const gsl_matrix *UtX,
// Calculate proposal distribution for gamma (unnormalized),
// and set up gsl_r and gsl_t.
- gsl_rng_env_setup();
- const gsl_rng_type *gslType;
- gslType = gsl_rng_default;
- if (randseed < 0) {
- time_t rawtime;
- time(&rawtime);
- tm *ptm = gmtime(&rawtime);
-
- randseed =
- (unsigned)(ptm->tm_hour % 24 * 3600 + ptm->tm_min * 60 + ptm->tm_sec);
- }
- gsl_r = gsl_rng_alloc(gslType);
- gsl_rng_set(gsl_r, randseed);
double *p_gamma = new double[ns_test];
CalcPgamma(p_gamma);
@@ -1643,21 +1631,6 @@ void BSLMM::MCMC(const gsl_matrix *X, const gsl_vector *y) {
}
// Calculate proposal distribution for gamma (unnormalized),
- // and set up gsl_r and gsl_t.
- gsl_rng_env_setup();
- const gsl_rng_type *gslType;
- gslType = gsl_rng_default;
- if (randseed < 0) {
- time_t rawtime;
- time(&rawtime);
- tm *ptm = gmtime(&rawtime);
-
- randseed =
- (unsigned)(ptm->tm_hour % 24 * 3600 + ptm->tm_min * 60 + ptm->tm_sec);
- }
- gsl_r = gsl_rng_alloc(gslType);
- gsl_rng_set(gsl_r, randseed);
-
double *p_gamma = new double[ns_test];
CalcPgamma(p_gamma);