Skip to content

Commit

Permalink
using Param->thread_rng
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarxblanco committed Dec 18, 2024
1 parent 680efdb commit e1308ea
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions atintegrators/VariableThinMPolePass.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct elem {
};


/* get_amp returns the same value when ramps is False.
/* get_amp returns the input value when ramps is False.
* If ramps is True, it returns a value linearly interpolated
* accoding to the ramping turn.*/
double get_amp(double amp, double* ramps, double t)
Expand Down Expand Up @@ -113,8 +113,8 @@ double get_pol(
randmean = elem->Mean;
randstd = elem->Std;
// using seed needs to be debugged
//val = atrandn_r(rng, randmean, randstd);
val = atrandn(randmean, randstd);
val = atrandn_r(rng, randmean, randstd);
//val = atrandn(randmean, randstd);
printf("randmean %.4f\n",randmean);
printf("randstd %.4f\n",randstd);
printf("val %.4f\n",val);
Expand Down Expand Up @@ -330,12 +330,7 @@ ExportMode struct elem* trackFunction(const atElem* ElemData, struct elem* Elem,
}
double t0 = Param->T0;
int turn = Param->nturn;
pcg32_random_t rng;
printf("pymexElem->Seed %d\n",Elem->Seed);
printf("pymexElem->Seedinitstate %d\n",Elem->Seedinitstate);
pcg32_srandom_r(&rng, Elem->Seedinitstate, Elem->Seed);

VariableThinMPolePass(r_in, Elem, t0, turn, num_particles, &rng);
VariableThinMPolePass(r_in, Elem, t0, turn, num_particles, Param->thread_rng);
return Elem;
}

Expand Down Expand Up @@ -443,8 +438,7 @@ void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
r_in = mxGetDoubles(plhs[0]);

printf("mexElem->Seed %d\n",Elem->Seed);
VariableThinMPolePass(r_in, Elem, 0, 0, num_particles);
// VariableThinMPolePass(r_in, Elem, 0, 0, num_particles, &pcg32_global);
VariableThinMPolePass(r_in, Elem, 0, 0, num_particles, Param->thread_rng);
} else if (nrhs == 0) {
/* list of required fields */
plhs[0] = mxCreateCellMatrix(4, 1);
Expand Down

0 comments on commit e1308ea

Please sign in to comment.