29 #ifndef CLHEP_MIXMAX_H_
30 #define CLHEP_MIXMAX_H_ 1
35 #define USE_INLINE_ASM YES
53 typedef unsigned long long int myuint;
110 myuint
apply_bigskip(myuint* Vout, myuint* Vin, myID_t clusterID, myID_t machineID, myID_t runID, myID_t streamID );
119 #define M61 2305843009213693951ULL
125 #define MERSBASE M61 //xSUFF(M61)
126 #define MOD_PAYNE(k) ((((k)) & MERSBASE) + (((k)) >> BITS) ) // slightly faster than my old way, ok for addition
127 #define MOD_REM(k) ((k) % MERSBASE ) // latest Intel CPU is supposed to do this in one CPU cycle, but on my machines it seems to be 20% slower than the best tricks
128 #define MOD_MERSENNE(k) MOD_PAYNE(k)
130 #define INV_MERSBASE (0.43368086899420177360298E-18L)
141 #define SPECIALMUL 36 // m=2^36+1
167 #ifndef __MIXMAX_C // c++ can put code into header files, why cant we? (with the inline declaration, should be safe from duplicate-symbol error)
169 #define get_next(X) GET_BY_MACRO(X)
170 #define get_next_float(X) get_next_float_BY_MACRO(X)
191 #if defined(__x86_64__) && defined(__SSE__) && defined(__AVX__) && defined(USE_INLINE_ASM)
193 __asm__ __volatile__(
"pxor %0, %0;"
208 #define ARRAY_INDEX_OUT_OF_BOUNDS 0xFF01
209 #define SEED_WAS_ZERO 0xFF02
210 #define ERROR_READING_STATE_FILE 0xFF03
211 #define ERROR_READING_STATE_COUNTER 0xFF04
212 #define ERROR_READING_STATE_CHECKSUM 0xFF05
220 #ifdef HOOKUP_GSL // if you need to use mixmax through GSL, pass -DHOOKUP_GSL=1 to the compiler
222 #include <gsl/gsl_rng.h>
223 unsigned long gsl_get_next(
void *vstate);
224 double gsl_get_next_float(
void *vstate);
225 void seed_for_gsl(
void *vstate,
unsigned long seed);
227 static const gsl_rng_type mixmax_type =
237 unsigned long gsl_get_next(
void *vstate) {
242 double gsl_get_next_float(
void *vstate) {
247 void seed_for_gsl(
void *vstate,
unsigned long seed){
252 const gsl_rng_type *gsl_rng_ran3 = &mixmax_type;
259 #endif // closing CLHEP_MIXMAX_H_
void print_state(rng_state_t *X)
myuint GET_BY_MACRO(rng_state_t *X)
myuint get_next(rng_state_t *X)
std::vector< ExP01TrackerHit * > a
void seed_vielbein(rng_state_t *X, unsigned int i)
int rng_free(rng_state_t *X)
myuint fmodmulM61(myuint cum, myuint s, myuint a)
void seed_uniquestream(rng_state_t *X, myID_t clusterID, myID_t machineID, myID_t runID, myID_t streamID)
int iterate(rng_state_t *X)
void seed_spbox(rng_state_t *X, myuint seed)
myuint modmulM61(myuint s, myuint a)
double get_next_float(rng_state_t *X)
rng_state_t * rng_alloc()
rng_state_t * rng_copy(myuint *Y)
myuint apply_bigskip(myuint *Vout, myuint *Vin, myID_t clusterID, myID_t machineID, myID_t runID, myID_t streamID)
myuint iterate_raw_vec(myuint *Y, myuint sumtotOld)
void iterate_and_fill_array(rng_state_t *X, double *array)
void branch_inplace(rng_state_t *Xin, myID_t *ID)
static constexpr double bar
myuint precalc(rng_state_t *X)
myuint modadd(myuint foo, myuint bar)
void fill_array(rng_state_t *X, unsigned int n, double *array)
double get_next_float_BY_MACRO(rng_state_t *X)
void read_state(rng_state_t *X, const char filename[])
struct rng_state_st rng_state_t