Commit 45ed09b2 authored by Lynn Garren's avatar Lynn Garren
Browse files

rename get_next and friends as clhep_get_next for CLHEP-142

parent 9bb586c9
......@@ -97,8 +97,8 @@ void seed_vielbein(rng_state_t* X, unsigned int i); // seeds with the i-th unit
// FUNCTIONS FOR GETTING RANDOM NUMBERS
#ifdef __MIXMAX_C
myuint get_next(rng_state_t* X); // returns 64-bit int, which is between 1 and 2^61-1 inclusive
double get_next_float(rng_state_t* X); // returns double precision floating point number in (0,1]
myuint clhep_get_next(rng_state_t* X); // returns 64-bit int, which is between 1 and 2^61-1 inclusive
double clhep_get_next_float(rng_state_t* X); // returns double precision floating point number in (0,1]
#endif //__MIXMAX_C
void fill_array(rng_state_t* X, unsigned int n, double *array); // fastest method: set n to a multiple of N (e.g. n=256)
......@@ -166,8 +166,8 @@ void branch_inplace( rng_state_t* Xin, myID_t* ID ); // almost the same as apply
#ifndef __MIXMAX_C // c++ can put code into header files, why cant we? (with the inline declaration, should be safe from duplicate-symbol error)
#define get_next(X) GET_BY_MACRO(X)
#define get_next_float(X) get_next_float_BY_MACRO(X)
#define clhep_get_next(X) GET_BY_MACRO(X)
#define clhep_get_next_float(X) clhep_get_next_float_BY_MACRO(X)
#endif // __MIXMAX_C
......@@ -186,8 +186,8 @@ inline myuint GET_BY_MACRO(rng_state_t* X) {
}
inline double get_next_float_BY_MACRO(rng_state_t* X){
int64_t Z=(int64_t)get_next(X);
inline double clhep_get_next_float_BY_MACRO(rng_state_t* X){
int64_t Z=(int64_t)clhep_get_next(X);
#if defined(__x86_64__) && defined(__SSE__) && defined(__AVX__) && defined(USE_INLINE_ASM)
double F;
__asm__ __volatile__( "pxor %0, %0;"
......@@ -236,12 +236,12 @@ static const gsl_rng_type mixmax_type =
unsigned long gsl_get_next(void *vstate) {
rng_state_t* X= (rng_state_t*)vstate;
return (unsigned long)get_next(X);
return (unsigned long)clhep_get_next(X);
}
double gsl_get_next_float(void *vstate) {
rng_state_t* X= (rng_state_t*)vstate;
return ( (double)get_next(X)) * INV_MERSBASE;
return ( (double)clhep_get_next(X)) * INV_MERSBASE;
}
void seed_for_gsl(void *vstate, unsigned long seed){
......
......@@ -180,7 +180,7 @@ void MixMaxRng::setSeeds(const long* Seeds, int seedNum)
double MixMaxRng::flat()
{
return get_next_float(fRngState);
return clhep_get_next_float(fRngState);
}
void MixMaxRng::flatArray(const int size, double* vect )
......@@ -191,8 +191,8 @@ void MixMaxRng::flatArray(const int size, double* vect )
MixMaxRng::operator unsigned int()
{
return static_cast<unsigned int>(get_next(fRngState));
// get_next returns a 64-bit integer, of which the lower 61 bits
return static_cast<unsigned int>(clhep_get_next(fRngState));
// clhep_get_next returns a 64-bit integer, of which the lower 61 bits
// are random and upper 3 bits are zero
}
......
......@@ -79,12 +79,12 @@ myuint iterate_raw_vec(myuint* Y, myuint sumtotOld){
return MOD_MERSENNE(MOD_MERSENNE(sumtot) + (ovflow <<3 ));
}
myuint get_next(rng_state_t* X) {
myuint clhep_get_next(rng_state_t* X) {
return GET_BY_MACRO(X);
}
double get_next_float(rng_state_t* X){
return get_next_float_BY_MACRO(X);
double clhep_get_next_float(rng_state_t* X){
return clhep_get_next_float_BY_MACRO(X);
}
void fill_array(rng_state_t* X, unsigned int n, double *array)
......@@ -167,7 +167,7 @@ rng_state_t* rng_copy(myuint *Y)
/* copy the vector stored at Y, and return pointer to the newly allocated and initialized state.
It is the user's responsibility to make sure that Y is properly allocated with rng_alloc,
then pass Y->V or it can also be an array -- such as myuint Y[N+1] and Y[1]...Y[N] have been set to legal values [0 .. MERSBASE-1]
Partial sums on this new state are recalculated, and counter set to zero, so that when get_next is called,
Partial sums on this new state are recalculated, and counter set to zero, so that when clhep_get_next is called,
it will output the initial vector before any new numbers are produced, call iterate(X) if you want to advance right away */
rng_state_t* X = rng_alloc();
myuint sumtot=0,ovflow=0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment