Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
-2
View File
@@ -18,9 +18,7 @@ set(G4clhep_HEADERS
include/CLHEP/Random/EngineFactory.h
include/CLHEP/Random/engineIDulong.h
include/CLHEP/Random/JamesRandom.h
include/CLHEP/Random/mixmax_skip_N8.icc
include/CLHEP/Random/mixmax_skip_N17.icc
include/CLHEP/Random/mixmax_skip_N240.icc
include/CLHEP/Random/MixMaxRng.h
include/CLHEP/Random/MTwistEngine.h
include/CLHEP/Random/NonRandomEngine.h
+22 -4
View File
@@ -6,11 +6,29 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-10-13 Gabriele Cosmo (clhep-V11-01-03)
- Synchronised with CLHEP-2.4.7.1.
* Random (L.Garren)
o Added missing shootArray() implementation in RandPoissonQ.
## 2023-09-19 Gabriele Cosmo (clhep-V11-01-02)
- In Random module:
* Fixes to MixMax previous commit to resolve reproducibility issues.
* Removed obsolete MixMax matrix files mixmax_skip_N8.icc and
mixmax_skip_N240.icc.
## 2023-08-16 Gabriele Cosmo (clhep-V11-01-01)
- In Random module:
* Random (K.Savvidy)
o Optimised MixMax performance based on experience learned since 2017.
o Updated MixMax class structure.
## 2022-12-13 Gabriele Cosmo (clhep-V11-01-00)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1
in Random and Evaluator code.
- Fixed cases of C++20 deprecated arithmetics with unnamed enumerations
in Vector classes.
- Synchronised with CLHEP-2.4.6.4.
* Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1
in Random and Evaluator code.
* Fixed cases of C++20 deprecated arithmetics with unnamed enumerations
in Vector classes.
## 2022-10-10 Gabriele Cosmo (clhep-V11-00-08)
- Synchronised with CLHEP-2.4.6.2.
+78 -56
View File
@@ -27,7 +27,9 @@
// http://dx.doi.org/10.1016/j.chaos.2016.05.003
//
// =======================================================================
// Implementation by Konstantin Savvidy - Copyright 2004-2017
// Implementation by Konstantin Savvidy - Copyright 2004-2023
// July 2023 - Updated class structure upon suggestions from Marco Barbone
// September 2023 - fix (re-)initialization from Gabriele Cosmo
// =======================================================================
#ifndef MixMaxRng_h
@@ -45,9 +47,10 @@ namespace CLHEP {
*/
using myID_t = std::uint32_t;
using myuint_t = unsigned long long int;
using myuint_t = std::uint64_t;
class MixMaxRng: public HepRandomEngine {
class alignas(128) MixMaxRng : public HepRandomEngine
{
static const int N = 17;
@@ -63,15 +66,22 @@ public:
MixMaxRng& operator=(const MixMaxRng& rng);
// Copy constructor and assignment operator.
double flat() { return (S.counter<=(N-1)) ? generate(S.counter):iterate(); }
inline double flat()
{
if (counter >= N) iterate();
return INV_M61*static_cast<double>(V[counter++]);
}
// Returns a pseudo random number between 0 and 1
// (excluding the zero: in (0,1] )
// excluding the zero: in (0,1]
// smallest number which it will give is approximately 10^-19
void flatArray (const int size, double* vect);
// Fills the array "vect" of specified size with flat random values.
void setSeed(long seed, int dum=0);
inline void setSeed(long longSeed, int = 0 /* extraSeed */)
{
seed_spbox(theSeed = longSeed);
}
// Sets the state of the algorithm according to seed.
void setSeeds(const long * seeds, int seedNum=0);
@@ -90,12 +100,15 @@ public:
void showStatus() const;
// Dumps the engine status on the screen.
operator double();
inline operator double() { return flat(); }
// Returns same as flat()
operator float();
inline operator float() { return float( flat() ); }
// less precise flat, faster if possible
operator unsigned int();
// 32-bit flat
inline operator unsigned int() { return static_cast<unsigned int>(get_next()); }
// 32-bit flat. clhep_get_next() returns a 64-bit integer, of which
// the lower 61 bits are random and upper 3 bits are zero
virtual std::ostream & put (std::ostream & os) const;
virtual std::istream & get (std::istream & is);
@@ -106,64 +119,79 @@ public:
static std::string engineName();
std::vector<unsigned long> put () const;
bool get (const std::vector<unsigned long> & v);
bool getState (const std::vector<unsigned long> & v);
bool get (const std::vector<unsigned long> & vec);
bool getState (const std::vector<unsigned long> & vec);
private:
static constexpr long long int SPECIAL = ((N==17)? 0 : ((N==240)? 487013230256099140ULL:0) ); // etc...
static constexpr long long int SPECIALMUL= ((N==17)? 36: ((N==240)? 51 :53) ); // etc...
// Note the potential for confusion...
static constexpr long long int SPECIAL = 0;
static constexpr long long int SPECIALMUL= 36;
static constexpr int BITS=61;
static constexpr myuint_t M61=2305843009213693951ULL;
static constexpr double INV_M61=0.43368086899420177360298E-18;
static constexpr unsigned int VECTOR_STATE_SIZE = 2*N+4; // 2N+4 for MIXMAX
#define MIXMAX_MOD_MERSENNE(k) ((((k)) & M61) + (((k)) >> BITS) )
inline myuint_t MIXMAX_MOD_MERSENNE(myuint_t k)
{
return ((((k)) & M61) + (((k)) >> BITS) );
}
static constexpr int rng_get_N();
static constexpr long long int rng_get_SPECIAL();
static constexpr int rng_get_SPECIALMUL();
void seed_uniquestream( myID_t clusterID, myID_t machineID, myID_t runID, myID_t streamID );
void seed_spbox(myuint_t);
void seed_spbox(myuint_t seed);
void print_state() const;
myuint_t precalc();
myuint_t get_next() ;
inline double get_next_float() { return get_next_float_packbits(); }
// Returns a random double with all 52 bits random, in the range (0,1]
myuint_t get_next();
MixMaxRng Branch();
void BranchInplace(int id);
MixMaxRng(myID_t clusterID, myID_t machineID, myID_t runID, myID_t streamID ); // Constructor with four 32-bit seeds
inline void seed64(myuint_t seedval) { seed_uniquestream( 0, 0, (myID_t)(seedval>>32), (myID_t)seedval ); } // seed with one 64-bit seed
double generate(int i);
double iterate();
double get_next_float_packbits();
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#pragma GCC diagnostic ignored "-Wuninitialized"
#endif
inline double convert1double(myuint_t u)
inline void seed64(myuint_t seedval) // seed with one 64-bit seed
{
const double one = 1;
const myuint_t onemask = *(myuint_t*)&one;
myuint_t tmp = (u>>9) | onemask; // bits between 52 and 62 dont affect the result!
double d = *(double*)&tmp;
return d-1.0;
seed_uniquestream( 0, 0, (myID_t)(seedval>>32), (myID_t)seedval );
}
inline void iterate()
{
myuint_t tempP, tempV;
V[0] = ( tempV = sumtot );
myuint_t insumtot = V[0], ovflow = 0; // will keep a running sum of all new elements
tempP = 0; // will keep a partial sum of all old elements
myuint_t tempPO;
tempPO = MULWU(tempP); tempP = modadd(tempP, V[1] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[1] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[2] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[2] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[3] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[3] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[4] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[4] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[5] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[5] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[6] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[6] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[7] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[7] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[8] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[8] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[9] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[9] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[10]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[10] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[11]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[11] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[12]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[12] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[13]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[13] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[14]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[14] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[15]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[15] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
tempPO = MULWU(tempP); tempP = modadd(tempP, V[16]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); V[16] = tempV; insumtot += tempV; if (insumtot < tempV) {++ovflow;}
sumtot = MIXMAX_MOD_MERSENNE(MIXMAX_MOD_MERSENNE(insumtot) + (ovflow <<3 ));
counter=1;
}
void state_init();
inline myuint_t MULWU (myuint_t k)
{
return (( (k)<<(SPECIALMUL) & M61) ^ ( (k) >> (BITS-SPECIALMUL)) );
}
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
myuint_t MOD_MULSPEC(myuint_t k);
myuint_t MULWU(myuint_t k);
void seed_vielbein( unsigned int i); // seeds with the i-th unit vector, i = 0..N-1, for testing only
myuint_t iterate_raw_vec(myuint_t* Y, myuint_t sumtotOld);
myuint_t apply_bigskip(myuint_t* Vout, myuint_t* Vin, myID_t clusterID, myID_t machineID, myID_t runID, myID_t streamID );
myuint_t modadd(myuint_t foo, myuint_t bar);
inline myuint_t modadd(myuint_t xfoo, myuint_t xbar)
{
return MIXMAX_MOD_MERSENNE(xfoo+xbar);
}
#if defined(__x86_64__)
myuint_t mod128(__uint128_t s);
myuint_t fmodmulM61(myuint_t cum, myuint_t a, myuint_t b);
@@ -171,17 +199,11 @@ private:
myuint_t fmodmulM61(myuint_t cum, myuint_t s, myuint_t a);
#endif
private:
// Engine state
struct rng_state_st
{
std::array<myuint_t, N> V;
myuint_t sumtot;
int counter;
};
typedef struct rng_state_st rng_state_t; // struct alias
rng_state_t S;
myuint_t V[N] = {0};
myuint_t sumtot = 0;
int counter = N;
};
} // namespace CLHEP
File diff suppressed because one or more lines are too long
@@ -1,294 +0,0 @@
//
// -*- C++ -*-
//
// -----------------------------------------------------------------------
// MixMax Matrix PseudoRandom Number Generator
// --- MixMax ---
// -----------------------------------------------------------------------
//
// Generator described in:
//
// G.K.Savvidy and N.G.Ter-Arutyunian,
// On the Monte Carlo simulation of physical systems,
// J.Comput.Phys. 97, 566 (1991);
// Preprint EPI-865-16-86, Yerevan, Jan. 1986
// http://dx.doi.org/10.1016/0021-9991(91)90015-D
//
// K.Savvidy
// "The MIXMAX random number generator"
// Comp. Phys. Commun. (2015)
// http://dx.doi.org/10.1016/j.cpc.2015.06.003
//
// K.Savvidy and G.Savvidy
// "Spectrum and Entropy of C-systems. MIXMAX random number generator"
// Chaos, Solitons & Fractals, Volume 91, (2016) pp. 33-38
// http://dx.doi.org/10.1016/j.chaos.2016.05.003
//
// -----------------------------------------------------------------------
/*
skipping matrix for N=8
three-parameter generator with m=2^53+1, s=0
*/
{
{ 788472011673754725 , 504392931461020386 , 2277048297991722020 , 536676515745497838 , 2196712233851697653 , 1212351258795831170 , 1507724523659869703 , 1373203865901861126 }, // x^2^256
{ 301950581079941521 , 942161077174856340 , 1709924881683456502 , 1236895465336323765 , 784131775911916825 , 2171381504524099377 , 69364380913386671 , 440003703207898788 }, // x^2^257
{ 1061315900878560816 , 1873403375992171499 , 1313963976151500367 , 2158461035133408282 , 354177604645659842 , 2201500956310676057 , 1511283231369593517 , 1710537319719334784 }, // x^2^258
{ 484634636820034254 , 1735343306326130046 , 1042617204208658777 , 1315652757806699188 , 1735818965585088031 , 1218025205131984512 , 263142304553001512 , 470504461483486782 }, // x^2^259
{ 105094898054487103 , 1166179934879398052 , 549478403625968529 , 1839539169546034080 , 1238452887272042100 , 1236596576663976697 , 1445126777176767961 , 2149640439599954656 }, // x^2^260
{ 343142614350713751 , 314395841028641361 , 407305795294142756 , 2102588657158640086 , 1994177381383943068 , 2026167339952671947 , 2178141325038374546 , 816875395538941274 }, // x^2^261
{ 11587422315470295 , 1312588512564319541 , 386403590131898615 , 2145406743745439617 , 1066349240680408615 , 2267309013399165408 , 791234776596952162 , 792589579928653197 }, // x^2^262
{ 777479078927516621 , 2203518127143989694 , 2196028283463958179 , 200338838404288377 , 1213770307665192822 , 1525788853799045841 , 2089490761795261036 , 942136585769864863 }, // x^2^263
{ 570706406354035563 , 2069840619049671673 , 1886681621518635595 , 2121926485976227427 , 1554412311824497337 , 1342861213369742264 , 2012088082383689899 , 1300501896141952283 }, // x^2^264
{ 1903360804461297810 , 2288340228194315933 , 1079326604544951471 , 2237448347695899 , 2181324518584330084 , 2140280266535186444 , 542417656612271251 , 573440772770857084 }, // x^2^265
{ 1932841970917172987 , 1827771334219024229 , 454668085749693980 , 1998014804297211539 , 159341797328455925 , 1783493636111498748 , 954150855658202309 , 381412810337890295 }, // x^2^266
{ 690155801527911916 , 1761888270497854982 , 95587394727764982 , 1069365478727371590 , 1408585825863833738 , 1043990648653252601 , 1320248147790458921 , 779190308039445494 }, // x^2^267
{ 683509593562709824 , 1042236153556730011 , 1587675433555744236 , 482064858701518015 , 774759967285602519 , 448550294595192330 , 928869768505175149 , 1532427718805330034 }, // x^2^268
{ 370477751932396939 , 840371969475102457 , 994994557979311450 , 2044481694457093504 , 1510082883968755944 , 561017964992626678 , 702590751919484542 , 1880405961758167320 }, // x^2^269
{ 727158450027905164 , 2085743032321553455 , 321803657954407027 , 1227721296924315855 , 1598689912706975699 , 352206360942618355 , 552632372036414045 , 2177787719418349861 }, // x^2^270
{ 1253745299122668947 , 637906236313436366 , 222120991912088984 , 503164359327056698 , 388027580368455654 , 949760161306465252 , 1617219323354638383 , 843651904641103555 }, // x^2^271
{ 1923911694993693089 , 560226400853857945 , 1936701492307784124 , 1748199052509055462 , 33957820815929422 , 1810345236831329961 , 858456818903359817 , 2118432073451085614 }, // x^2^272
{ 626738496840044047 , 617765167241145410 , 19237994901216891 , 685278562362866025 , 2264701957644881648 , 106101523936561452 , 521258113601299909 , 68254162052654336 }, // x^2^273
{ 1781946046930871721 , 770624478957889713 , 845947492851430452 , 2034770066802226795 , 200233197609134431 , 1452052310627261890 , 199322096220977015 , 1585248688520308006 }, // x^2^274
{ 2002476361393000438 , 1271556603469238878 , 1393993756892785163 , 4467157228062902 , 685060284083312779 , 233186243817914320 , 660587782107231470 , 1822548750327614516 }, // x^2^275
{ 2108244183316339465 , 582727018062128117 , 2085162998220028720 , 563349165385645425 , 669238301542279562 , 1954694382853125018 , 715522867478393688 , 702379801834299277 }, // x^2^276
{ 782068661175253984 , 1109041687542966454 , 1810187125967748368 , 365523157605568924 , 1990092834746784634 , 257393889886211077 , 1326087677690717750 , 1230899109047220834 }, // x^2^277
{ 1536503690895567083 , 504143623332155859 , 524236954269530256 , 462032826384579955 , 2005260516806561034 , 2248121905556192570 , 268671724442147378 , 473383641184363051 }, // x^2^278
{ 834444130431663841 , 744266152109888825 , 590933780561931722 , 1291338777345533204 , 2035011573923734843 , 317501560173085699 , 954895309600585114 , 672499611839848105 }, // x^2^279
{ 837016868976810410 , 839274742387313221 , 780259767852426704 , 1994532761732194548 , 1557969934292207103 , 1231730779027967583 , 912163657464699324 , 475287422407563577 }, // x^2^280
{ 1022880011619604803 , 1459303712499474246 , 816446646841872490 , 1773668771889012570 , 282893474599583284 , 1757089265824882286 , 2132893624529371192 , 1869074345988119025 }, // x^2^281
{ 672306820748123999 , 1395780953839561442 , 1973553681028597819 , 386750240478406131 , 105333081837134537 , 954943652501253988 , 558292504172958569 , 813031505616666431 }, // x^2^282
{ 1339661765865469731 , 1464906065206800824 , 1377143956763059459 , 1296294227285817348 , 26783747229133309 , 15123831758228789 , 1062933074617758702 , 1657039368069105353 }, // x^2^283
{ 1027660519995542204 , 1907446071754164500 , 2178640900219028509 , 2174887705519370029 , 2225206340524580963 , 1050436021061817550 , 769010530701912591 , 69450695637452962 }, // x^2^284
{ 1167579235557417927 , 1004551306610441640 , 2157449925047146098 , 440600533910314509 , 742991741006729837 , 418125732478183320 , 1363614321347923904 , 300078070845461992 }, // x^2^285
{ 2049601951722475133 , 133005337847029238 , 304186971272273025 , 2139661323049973724 , 1770237527238983271 , 699618988239135275 , 1001397389017988899 , 1483706709771154393 }, // x^2^286
{ 1569513252219367166 , 1916994012060755629 , 339273280325758544 , 2277665683914515509 , 1604342142068802990 , 1942422166106754341 , 1107593061812383796 , 1634435832337837414 }, // x^2^287
{ 210706878669676227 , 635175214043284086 , 776917991235898803 , 356281689287799394 , 1425905093387722203 , 1857750059153498584 , 1392947404314050147 , 2182961550597679862 }, // x^2^288
{ 1199005391983043471 , 404472206821238006 , 666238670132343789 , 1481356723241855267 , 1231496648796143372 , 1838219270583231503 , 1521036124956777126 , 84337266428046576 }, // x^2^289
{ 1830555445836500332 , 812428396167972179 , 568755150627175700 , 49966429017936543 , 2049600540457279099 , 1268317544880075939 , 777599317727164935 , 1183780428364360568 }, // x^2^290
{ 1133458770227416151 , 1844398892304992046 , 970929079461602910 , 1662108249215799052 , 478828629658121173 , 1538495058922000417 , 1311906645728583872 , 51769387915209644 }, // x^2^291
{ 369578230448236233 , 782029836481090454 , 144995705299552657 , 1524199868270218670 , 488217669629577701 , 1587119896596386118 , 1425190565259289630 , 826359071168357659 }, // x^2^292
{ 2019136696728127016 , 1048649148810883230 , 2004749949593011938 , 810942544842237741 , 1213043404158359968 , 1342796069439195349 , 369708213807778039 , 1472748220298669363 }, // x^2^293
{ 2177083798302496430 , 1503796256140782680 , 2238358145333550683 , 203593728399275042 , 205703753929364380 , 1681042914305437288 , 2062242024433876039 , 293501595822231643 }, // x^2^294
{ 89846022262964187 , 881926222753186517 , 406877599522224183 , 634246809320589194 , 1870825586685077630 , 462019898379233272 , 1933051117396846356 , 1449023606237867375 }, // x^2^295
{ 3446696032160400 , 1161864821806539589 , 964808837353475954 , 546939397855790115 , 907722459758190488 , 962757726761320470 , 1285815466625699166 , 1528430426485367847 }, // x^2^296
{ 1100535663455617606 , 151561917972605849 , 1430340534255315618 , 602378195013145983 , 1526020505064407654 , 433642186903420258 , 1458426016194621281 , 369997457324993082 }, // x^2^297
{ 1044572281354841124 , 609487167355401921 , 715055404894913111 , 1805515509832322624 , 789834738390336644 , 1383034007732524099 , 1496613287887401152 , 886019072466742632 }, // x^2^298
{ 37819714311792148 , 2054786481407342613 , 1914956661080594693 , 1940497164481456358 , 965922306316775730 , 1631436093620104150 , 1713873682350301249 , 1391415491535867529 }, // x^2^299
{ 708495849912990857 , 571708336170966345 , 1880327619849146079 , 1448148826196249782 , 124570492848568181 , 597347942522208170 , 420222381745859474 , 560583396340484075 }, // x^2^300
{ 1550963433810696679 , 145069277966935686 , 1629339925940844247 , 1780563188637252160 , 1106128532322376946 , 231652147891733394 , 2011173486555346539 , 1555515926748290067 }, // x^2^301
{ 635364520808647345 , 1458100457503478471 , 1155792098374175261 , 1202746080177125263 , 399756859533527955 , 518256347279472300 , 1596495908865940726 , 155073836698060827 }, // x^2^302
{ 625845535448002256 , 1103868466048792762 , 4774591603328801 , 2070705472073003365 , 1154377422221763402 , 1282202665473504057 , 554731256752231813 , 1227474830096266635 }, // x^2^303
{ 876744482754218306 , 868276539506925197 , 829864219155081038 , 1969171369611387053 , 1945617946829525712 , 1840299847054821149 , 2293590501601180619 , 886202450232538758 }, // x^2^304
{ 1002658805586069749 , 1951318244588682007 , 315126823664272784 , 1280030551904844190 , 775240578777000869 , 1684343105437572569 , 978506963215340432 , 637650574693518384 }, // x^2^305
{ 979432457956603999 , 1260530652983115482 , 1946701112549761554 , 131010500956804676 , 1506696341331438266 , 746823145128473385 , 1656790250637014085 , 324268558051174183 }, // x^2^306
{ 351151469113138787 , 140308302629015561 , 2137383103334280244 , 1728659755380072682 , 962199643632040481 , 1197298249640415717 , 1038738309744980027 , 665933806758430945 }, // x^2^307
{ 567872053582786618 , 576583701704935966 , 400190914689144093 , 1000114246576758781 , 59658785149987502 , 1876321531663714521 , 587071714224144245 , 1570961360266607321 }, // x^2^308
{ 1880794593726127948 , 1472822173003515236 , 39394489282919262 , 1797956414062729466 , 2022248583473828177 , 1034142978823269584 , 475319275026578831 , 268560799076533340 }, // x^2^309
{ 428959846958695691 , 873827817733352275 , 967974244628146114 , 379757671514435698 , 1657453105703951272 , 1178249096746908050 , 1544833596922417858 , 1226728701647851869 }, // x^2^310
{ 749115335594391473 , 165990191250191116 , 638293485960375803 , 1485793551339244846 , 326395651213318577 , 1241228968737542153 , 1306590561651809509 , 1262671243044191015 }, // x^2^311
{ 2237497971177297230 , 925843085457910427 , 1372168680037608587 , 1729925345006977623 , 1157872351743549918 , 205312857472775018 , 1397050525145413726 , 1791160569977470168 }, // x^2^312
{ 2235240444070219979 , 443212627747770631 , 642911254630239763 , 537775576672600532 , 619783443718011281 , 1451065064137832426 , 2040184580267611651 , 1939863716465189591 }, // x^2^313
{ 908678705050933036 , 1591242364863898049 , 1834632839234433882 , 358861541042313179 , 1602792196645577517 , 621809784014233788 , 220157875365495388 , 136872972425544411 }, // x^2^314
{ 1230849990991258203 , 423652695451705646 , 769617740673346473 , 859717384814713761 , 1223733192958349783 , 929363982417419596 , 2263094111123397933 , 1854443195695139601 }, // x^2^315
{ 1156893085045594838 , 1388783712000510730 , 2088112935468358575 , 545336826223343096 , 1439034209581278105 , 279801622808440468 , 2152771379742047648 , 207221331995086342 }, // x^2^316
{ 1498402897145517819 , 1941267259059958728 , 270365707143490596 , 1212566654420311341 , 993382973533279627 , 1448525898637405197 , 1225148411247171749 , 211486664223965307 }, // x^2^317
{ 86088540808859243 , 1194375216919362501 , 2081057485419999651 , 2103299876302453116 , 152425588435974314 , 701667713217197173 , 1048555768172131473 , 2103277142094652231 }, // x^2^318
{ 1855356366424952210 , 1081691332597436464 , 609941249894072913 , 986792017441346181 , 289373896438088252 , 470376658545800600 , 1117375579392367641 , 1935625758340632926 }, // x^2^319
{ 1170050089957867933 , 1308686772456869298 , 1674906313765571608 , 1464326731050173676 , 40497119027202016 , 1442593023742107967 , 1100942177931282831 , 1460024199156889536 }, // x^2^320
{ 1593324372635135333 , 1751124220276161674 , 1921835203354336412 , 1237664643534502483 , 1322103835966951187 , 1658312460368229755 , 1537664227157675781 , 498445623124875660 }, // x^2^321
{ 1515927140763007881 , 627289680129171564 , 329969347928093767 , 1226876755200911016 , 1125252537457916397 , 2263913901441709448 , 1854011590937779238 , 1470923382375387346 }, // x^2^322
{ 1667320094812495012 , 1385101183505454386 , 1781137568039538835 , 282896000930313637 , 254449706969779138 , 232195004974727664 , 788129385157539908 , 173640545296296723 }, // x^2^323
{ 1025935590673211777 , 1068021612873242937 , 756075084827465992 , 2053699902553183422 , 1878574338078405571 , 1784483770701900383 , 24423148530270471 , 1417344168788009387 }, // x^2^324
{ 1153801351773457887 , 1845544577903742230 , 297727241144859813 , 176755814742023357 , 431437456411004018 , 1577170582795022613 , 242927191126292217 , 649002295735752568 }, // x^2^325
{ 1687195288663497941 , 490947911518336100 , 344530515134218494 , 735620802136881566 , 1858626666800894353 , 517616270162278233 , 1187831803267794970 , 802344586470548574 }, // x^2^326
{ 591761506437429396 , 2284919856729957422 , 2062745832552913508 , 599245274943010194 , 214355454017472712 , 2288175073561083074 , 1914975698503949054 , 2246689342887056995 }, // x^2^327
{ 118006265548731945 , 58024496342916194 , 1173948173914037831 , 1459672590572365387 , 8106269035442777 , 65489039967941369 , 2154450358757882263 , 13667171181254595 }, // x^2^328
{ 178732043725977272 , 781254935208702311 , 1340396333474937182 , 1236603092600645616 , 2141079809370338796 , 208963248081834137 , 146915832059980380 , 1004968557515270642 }, // x^2^329
{ 1714938032014376334 , 34911693439117236 , 461917198749199349 , 882725469526879881 , 2098359896663840801 , 1036165144151865703 , 589532674986917988 , 479021353453889568 }, // x^2^330
{ 1285279925438585209 , 918083833538130378 , 444198560296576474 , 2159929925104625787 , 1728442166996200907 , 1267351811392324441 , 300065718623418119 , 966750349179313465 }, // x^2^331
{ 691725965600999810 , 1198903862620854377 , 1054023539523064816 , 1730769030252351567 , 847557927746600260 , 1744623726004990111 , 1728028892131548567 , 1527543417026037449 }, // x^2^332
{ 409421278860982988 , 997152943070286925 , 20113035122389204 , 2124073936359239181 , 689641531534285085 , 837955831482216973 , 764871009458889678 , 237477127484895051 }, // x^2^333
{ 1982954613247518948 , 402525052522767365 , 933337358422926678 , 493080854378288479 , 440525440695315742 , 403003028386149431 , 697670125655367094 , 170964525981186562 }, // x^2^334
{ 529398608714192567 , 596163766759723405 , 1693861938709526376 , 1944585668867654756 , 1812682954769967560 , 60767399965245612 , 815166115962344167 , 563969885916290380 }, // x^2^335
{ 1031187372526524708 , 1180625910437919643 , 2265520763828990194 , 734290616121570989 , 1798360203053677331 , 513918809740571316 , 1111845956351982313 , 496292905109351318 }, // x^2^336
{ 597139642668139236 , 602335229477270350 , 2026181378829117602 , 346834015572578793 , 1160789964134140335 , 1301839414607152236 , 2023907284977916784 , 212348413306575710 }, // x^2^337
{ 1345655855818044387 , 2034440074737180979 , 1853737556174568843 , 239876295577697304 , 410191818934605386 , 1057480181623603096 , 751583228751027774 , 2164161283235078589 }, // x^2^338
{ 782916240087880616 , 632461621735433608 , 554302637570851993 , 646827976196586488 , 984936791191038328 , 189101705843674879 , 1231562930684236637 , 1297866436871439442 }, // x^2^339
{ 542729751238409888 , 114743443058483761 , 446923874175439190 , 1784413303031332267 , 2155207668460791239 , 1216793859143235269 , 755758137527846441 , 1113251030217301689 }, // x^2^340
{ 1974252091627510392 , 969837876315426579 , 1166645537845176077 , 58837961050277390 , 2215039252761715644 , 1792388646719314587 , 931827086005293683 , 2052759443345265748 }, // x^2^341
{ 1957672635879634849 , 157850341324012958 , 1996189225711295944 , 770677230845634472 , 685295457133592675 , 990906427152295805 , 1489773162377938460 , 1493792842242691854 }, // x^2^342
{ 335178352541380841 , 2080753030175535839 , 1980993384319476437 , 1922341725340555314 , 1801854611701891525 , 1050636885479441377 , 1139320506336756471 , 1807421491907884501 }, // x^2^343
{ 1410693392538517153 , 1734510559237669829 , 635977723417359771 , 117417534576330953 , 581949335702342201 , 921443320968790464 , 2013382175921627265 , 418068097259388303 }, // x^2^344
{ 2006799017678649179 , 291508748634401467 , 1575246852841118587 , 1296651463173792894 , 427683393014212471 , 1730251205926493162 , 1142975105007871390 , 654616289055181196 }, // x^2^345
{ 1310482812890598840 , 1568271209316293982 , 1910822376851082511 , 145332006035575243 , 2083641620344128542 , 305641243824259155 , 931699357032097273 , 1358163282973807602 }, // x^2^346
{ 203591671914458344 , 150640315994823731 , 1210104001019263804 , 1137617598292666595 , 518788118161161048 , 427427087034864633 , 2267425996942054624 , 1099166158796073922 }, // x^2^347
{ 1862849125627532663 , 848558785635718635 , 393472121514472078 , 1503946637617229192 , 251773912133193647 , 1537276995784412057 , 97807326675627886 , 220480179290806390 }, // x^2^348
{ 2030722849231430296 , 925386852951109106 , 2258493939731347427 , 325355008890701175 , 2211934110935234304 , 2100695251205789805 , 79792526001013458 , 2016383789830271786 }, // x^2^349
{ 1673355124255496233 , 605829622903505464 , 1228542874099034520 , 1015802631014783927 , 1733494931859994227 , 1788838665983109057 , 1983390263525924139 , 1279621456293354913 }, // x^2^350
{ 375355249010406023 , 2226360444545513540 , 1601485935029158854 , 775307048261886844 , 1575230599988169482 , 507568577394075327 , 472550439018554047 , 1573416880779995280 }, // x^2^351
{ 1793604322340719497 , 900876283313101202 , 1106634015704688071 , 623388134442470073 , 756750847034786579 , 472358887721577332 , 240998031138313601 , 1212381458468059241 }, // x^2^352
{ 1048596494083818008 , 45192207447474877 , 1764953537532898171 , 583469345207475545 , 868521831479355323 , 1712689121558799082 , 2098493070064932090 , 11903476140390649 }, // x^2^353
{ 1334367269847445617 , 1032625389531499584 , 1346355460833246464 , 1341223378415525065 , 1652514590227965141 , 853738600007198831 , 622763044225564546 , 751613101459281337 }, // x^2^354
{ 1346536569485232478 , 619157040998454361 , 341775769765630858 , 1545361644444920171 , 1997753181309741482 , 852535551069983768 , 2201772957889224940 , 1747479239683846996 }, // x^2^355
{ 881821856749842931 , 33675046554478555 , 441043258144540262 , 1864107211002315878 , 213663804468606377 , 779518916286681744 , 1657015176251964128 , 1234000577072772928 }, // x^2^356
{ 1629037232137607269 , 1568038047649633792 , 1411465989439022663 , 389455395058842604 , 554125259932565321 , 1605109836130735684 , 1642378583819350575 , 1337404045649734167 }, // x^2^357
{ 1928692022246218227 , 1709839397705900172 , 700630607698486301 , 1464616600744793604 , 698264318572727526 , 972092360804013549 , 2049081733964128465 , 2198229595803038387 }, // x^2^358
{ 1880654348547257558 , 1476705685714280205 , 1358445217050910742 , 2111185621663774036 , 1636739834133894487 , 910512677983536376 , 66845511675705871 , 1695023028547036474 }, // x^2^359
{ 111257500244176937 , 1164749420337806778 , 1166974332894526781 , 520872417434967374 , 696274744247027286 , 348013895310105062 , 1324487086784519028 , 1182067459981085649 }, // x^2^360
{ 880019563591625081 , 479309460423160560 , 2270345422042307745 , 1531020453913273139 , 532210261030539504 , 2015761889228124393 , 1438689111032339473 , 833421303749228763 }, // x^2^361
{ 420191162525030866 , 1782561089611052100 , 1478807302767478272 , 1486511393311314542 , 621073904919073855 , 2293504309385886754 , 486980369413926753 , 942401719860595424 }, // x^2^362
{ 1190526561300061469 , 2047316462525294846 , 903824918206430997 , 2295426177377901481 , 1252846238113564593 , 407407998615644808 , 1016356949973556458 , 674141426966719219 }, // x^2^363
{ 761623622570000269 , 1439332434886704951 , 738484131846911685 , 1874411635027107644 , 1939211601959319344 , 1349991128048938045 , 827906853422423950 , 1112511745996420238 }, // x^2^364
{ 2299311859375313539 , 811412470951134827 , 1824477644275216429 , 609286759079343113 , 1668815854850357083 , 1853024803395785531 , 342628901679334892 , 656885820575581689 }, // x^2^365
{ 1968768200502759654 , 2207697622632873672 , 333877204250571240 , 1825003721596803816 , 231274068436011404 , 67864162816683970 , 920739987917013327 , 364997089787786804 }, // x^2^366
{ 1600228928238612241 , 1891355996681428693 , 345506069435244583 , 831623917991345360 , 820753905739539892 , 291219051536293705 , 996522653777018463 , 690836988882320843 }, // x^2^367
{ 2128433195302917443 , 2258551908270133147 , 1944900359985814344 , 755301651871260987 , 2249244053224715807 , 213183467510840932 , 1422154421101518676 , 2143561716009442592 }, // x^2^368
{ 2111630590765421088 , 1742338438433621185 , 1978061232478682889 , 1384461294248544657 , 382413156417648080 , 1513000543034520343 , 496610357000920224 , 170540336394993161 }, // x^2^369
{ 953710384775816150 , 373241079978324282 , 1875300218109942167 , 531374055445910451 , 1071933530880445583 , 2304091651267022678 , 583390025362979170 , 1650108637804634335 }, // x^2^370
{ 38796330778627240 , 1977624500092462310 , 1703944693047603150 , 581151159177297678 , 1565446978680877201 , 2055778084833536373 , 387442693965974364 , 726412997754586449 }, // x^2^371
{ 1701106276069394637 , 1719631306650712702 , 2239104795287078402 , 2004903026767889135 , 867541551723344138 , 1287148152547739714 , 1887416701637869198 , 784675606938273303 }, // x^2^372
{ 1032520486976550776 , 2222277274994263300 , 1203837084685370518 , 295188581138663945 , 1050215667112938784 , 1195285596118246042 , 1855064450188421661 , 925307790505202807 }, // x^2^373
{ 367663880908551601 , 1492063196922845577 , 108612048337902984 , 2244994784910484207 , 2169070514612413282 , 1657441148007580707 , 675484927308642058 , 1557511281364479375 }, // x^2^374
{ 1151413190006835589 , 1166962135325582395 , 2140394835161550851 , 2167104367162208320 , 499956738357355178 , 122105980873608028 , 915356535482190113 , 1225817883376984995 }, // x^2^375
{ 62244764369956530 , 1327648037711645269 , 2126431038102298884 , 89579537089883062 , 689716767095500290 , 86988304153185779 , 2303367798596805069 , 1061566824501406144 }, // x^2^376
{ 1044213527311444176 , 1418635417665178907 , 2007793743021922535 , 1963628267021972080 , 356484661260541427 , 1466730203022742615 , 623283712530571036 , 1783310515116981278 }, // x^2^377
{ 358373709407137905 , 1669217844135429430 , 428340359224799016 , 726809592233492551 , 617152454892179694 , 605641735675631286 , 1200504458695016284 , 932250544422303943 }, // x^2^378
{ 1370040590608919099 , 183625989161271350 , 1513616498293220438 , 1227551255888787812 , 1689871591401186155 , 2050481541516856363 , 277285552999796675 , 2079809588669498313 }, // x^2^379
{ 1078203798498297750 , 265299228133483673 , 891856830230117422 , 1609854933010423233 , 1254100114423142214 , 2100516443474013609 , 653141299032951864 , 700386224544195090 }, // x^2^380
{ 2121154161611385943 , 1476944420325420857 , 483658609816674658 , 2032625465327924991 , 1721001254022682833 , 257037507690493914 , 371371286689212236 , 1797172563593044590 }, // x^2^381
{ 1280087093081453195 , 55429523695727980 , 1669149905620727629 , 781671458488614863 , 1011332931464394757 , 2065298633225451797 , 773182386785959752 , 1610397119075319054 }, // x^2^382
{ 2093229000156826454 , 48633118872508413 , 60670634117803698 , 766861511288322660 , 1325320551222339063 , 1794963613148919766 , 608045453287855300 , 2034742057965522172 } // x^2^383
};
+108 -262
View File
@@ -27,7 +27,9 @@
// http://dx.doi.org/10.1016/j.chaos.2016.05.003
//
// =======================================================================
// Implementation by Konstantin Savvidy - Copyright 2004-2017
// Implementation by Konstantin Savvidy - Copyright 2004-2023
// July 2023 - Updated class structure upon suggestions from Marco Barbone
// September 2023 - fix (re-)initialization from Gabriele Cosmo
// =======================================================================
#include "CLHEP/Random/Random.h"
@@ -37,6 +39,7 @@
#include <atomic>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <string.h> // for strcmp
#include <vector>
@@ -79,9 +82,9 @@ MixMaxRng::~MixMaxRng()
MixMaxRng::MixMaxRng(const MixMaxRng& rng)
: HepRandomEngine(rng)
{
S.V = rng.S.V;
S.sumtot= rng.S.sumtot;
S.counter= rng.S.counter;
std::copy(rng.V, rng.V+N, V);
sumtot= rng.sumtot;
counter= rng.counter;
}
MixMaxRng& MixMaxRng::operator=(const MixMaxRng& rng)
@@ -94,9 +97,9 @@ MixMaxRng& MixMaxRng::operator=(const MixMaxRng& rng)
//
HepRandomEngine::operator=(rng);
S.V = rng.S.V;
S.sumtot= rng.S.sumtot;
S.counter= rng.S.counter;
std::copy(rng.V, rng.V+N, V);
sumtot= rng.sumtot;
counter= rng.counter;
return *this;
}
@@ -110,13 +113,13 @@ void MixMaxRng::saveStatus( const char filename[] ) const
int j;
fprintf(fh, "mixmax state, file version 1.0\n" );
fprintf(fh, "N=%u; V[N]={", rng_get_N() );
for (j=0; (j< (rng_get_N()-1) ); j++) {
fprintf(fh, "%llu, ", S.V[j] );
for (j=0; (j< (rng_get_N()-1) ); ++j) {
fprintf(fh, "%llu, ", (unsigned long long)V[j] );
}
fprintf(fh, "%llu", S.V[rng_get_N()-1] );
fprintf(fh, "%llu", (unsigned long long)V[rng_get_N()-1] );
fprintf(fh, "}; " );
fprintf(fh, "counter=%u; ", S.counter );
fprintf(fh, "sumtot=%llu;\n", S.sumtot );
fprintf(fh, "counter=%u; ", counter );
fprintf(fh, "sumtot=%llu;\n", (unsigned long long)sumtot );
fclose(fh);
}
}
@@ -141,42 +144,41 @@ void MixMaxRng::restoreStatus( const char filename[] )
myuint_t vecVal;
//printf("mixmax -> read_state: starting to read state from file\n");
if (!fscanf(fin, "%llu", &S.V[0]) )
if (!fscanf(fin, "%llu", (unsigned long long*) &V[0]) )
{
fprintf(stderr, "mixmax -> read_state: error reading file %s\n", filename);
throw std::runtime_error("Error in reading state file");
}
int i;
for( i = 1; i < rng_get_N(); i++)
for (int i = 1; i < rng_get_N(); ++i)
{
if (!fscanf(fin, ", %llu", &vecVal) )
if (!fscanf(fin, ", %llu", (unsigned long long*) &vecVal) )
{
fprintf(stderr, "mixmax -> read_state: error reading vector component i=%d from file %s\n", i, filename);
throw std::runtime_error("Error in reading state file");
}
if( vecVal <= MixMaxRng::M61 )
if( vecVal <= MixMaxRng::M61 )
{
S.V[i] = vecVal;
V[i] = vecVal;
}
else
{
fprintf(stderr, "mixmax -> read_state: Invalid state vector value= %llu"
" ( must be less than %llu ) "
" obtained from reading file %s\n"
, vecVal, MixMaxRng::M61, filename);
, (unsigned long long)vecVal, (unsigned long long)MixMaxRng::M61, filename);
}
}
int counter;
if (!fscanf( fin, "}; counter=%i; ", &counter))
int incounter;
if (!fscanf( fin, "}; counter=%i; ", &incounter))
{
fprintf(stderr, "mixmax -> read_state: error reading counter from file %s\n", filename);
throw std::runtime_error("Error in reading state file");
}
if( counter <= rng_get_N() )
if( incounter <= rng_get_N() )
{
S.counter= counter;
counter = incounter;
}
else
{
@@ -186,14 +188,14 @@ void MixMaxRng::restoreStatus( const char filename[] )
throw std::runtime_error("Error in reading state counter");
}
precalc();
myuint_t sumtot;
if (!fscanf( fin, "sumtot=%llu\n", &sumtot))
myuint_t insumtot;
if (!fscanf( fin, "sumtot=%llu\n", (unsigned long long*) &insumtot))
{
fprintf(stderr, "mixmax -> read_state: error reading checksum from file %s\n", filename);
throw std::runtime_error("Error in reading state file");
}
if (S.sumtot != sumtot)
if (sumtot != insumtot)
{
fprintf(stderr, "mixmax -> checksum error while reading state from file %s - corrupted?\n", filename);
throw std::runtime_error("Error in reading state checksum");
@@ -211,13 +213,6 @@ void MixMaxRng::showStatus() const
std::cout << "---------------------------------------" << std::endl;
}
void MixMaxRng::setSeed(long longSeed, int /* extraSeed */)
{
//seed_uniquestream(0,0,0,longSeed);
theSeed = longSeed;
seed_spbox(longSeed);
}
// Preferred Seeding method
// the values of 'Seeds' must be valid 32-bit integers
// Higher order bits will be ignored!!
@@ -259,93 +254,11 @@ constexpr int MixMaxRng::rng_get_N()
return N;
}
constexpr long long int MixMaxRng::rng_get_SPECIAL()
{
return SPECIAL;
}
constexpr int MixMaxRng::rng_get_SPECIALMUL()
{
return SPECIALMUL;
}
double MixMaxRng::generate(int i)
{
S.counter++;
#if defined(__clang__) || defined(__llvm__)
return INV_M61*static_cast<double>(S.V[i]);
#elif defined(__GNUC__) && (__GNUC__ < 7) && (!defined(__ICC)) && defined(__x86_64__) && defined(__SSE2_MATH__)
int64_t Z=S.V[i];
double F=0.0;
//#warning Using the inline assembler
/* using SSE inline assemly to zero the xmm register, just before int64 -> double conversion,
not necessary in GCC-5 or better, but huge penalty on earlier compilers
*/
__asm__ __volatile__( "pxor %0, %0;"
"cvtsi2sdq %1, %0;"
:"=x"(F)
:"r"(Z)
);
return F*INV_M61;
#else
//#warning other method
return convert1double(S.V[i]); //get_next_float_packbits();
#endif
}
double MixMaxRng::iterate()
{
myuint_t* Y=S.V.data();
myuint_t tempP, tempV;
Y[0] = ( tempV = S.sumtot);
myuint_t sumtot = Y[0], ovflow = 0; // will keep a running sum of all new elements
tempP = 0; // will keep a partial sum of all old elements
myuint_t tempPO;
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[1] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[1] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[2] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[2] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[3] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[3] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[4] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[4] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[5] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[5] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[6] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[6] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[7] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[7] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[8] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[8] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[9] ); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[9] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[10]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[10] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[11]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[11] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[12]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[12] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[13]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[13] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[14]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[14] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[15]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[15] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
tempPO = MULWU(tempP); tempP = modadd(tempP, Y[16]); tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); Y[16] = tempV; sumtot += tempV; if (sumtot < tempV) {ovflow++;};
S.sumtot = MIXMAX_MOD_MERSENNE(MIXMAX_MOD_MERSENNE(sumtot) + (ovflow <<3 ));
S.counter=2;
return double(S.V[1])*INV_M61;
}
void MixMaxRng::flatArray(const int size, double* vect )
{
// fill_array( S, size, arrayDbl );
for (int i=0; i<size; ++i) { vect[i] = flat(); }
}
MixMaxRng::operator double()
{
return flat();
}
MixMaxRng::operator float()
{
return float( flat() );
}
MixMaxRng::operator unsigned int()
{
return static_cast<unsigned int>(get_next());
// clhep_get_next returns a 64-bit integer, of which the lower 61 bits
// are random and upper 3 bits are zero
}
std::ostream & MixMaxRng::put ( std::ostream& os ) const
{
char beginMarker[] = "MixMaxRng-begin";
@@ -355,10 +268,10 @@ std::ostream & MixMaxRng::put ( std::ostream& os ) const
os << beginMarker << " ";
os << theSeed << "\n";
for (int i=0; i<rng_get_N(); ++i) {
os << S.V[i] << "\n";
os << V[i] << "\n";
}
os << S.counter << "\n";
os << S.sumtot << "\n";
os << counter << "\n";
os << sumtot << "\n";
os << endMarker << "\n";
os.precision(pr);
return os;
@@ -366,19 +279,19 @@ std::ostream & MixMaxRng::put ( std::ostream& os ) const
std::vector<unsigned long> MixMaxRng::put () const
{
std::vector<unsigned long> v;
v.push_back (engineIDulong<MixMaxRng>());
std::vector<unsigned long> vec;
vec.push_back (engineIDulong<MixMaxRng>());
for (int i=0; i<rng_get_N(); ++i)
{
v.push_back(static_cast<unsigned long>(S.V[i] & MASK32));
vec.push_back(static_cast<unsigned long>(V[i] & MASK32));
// little-ended order on all platforms
v.push_back(static_cast<unsigned long>(S.V[i] >> 32 ));
vec.push_back(static_cast<unsigned long>(V[i] >> 32 ));
// pack uint64 into a data structure which is 32-bit on some platforms
}
v.push_back(static_cast<unsigned long>(S.counter));
v.push_back(static_cast<unsigned long>(S.sumtot & MASK32));
v.push_back(static_cast<unsigned long>(S.sumtot >> 32));
return v;
vec.push_back(static_cast<unsigned long>(counter));
vec.push_back(static_cast<unsigned long>(sumtot & MASK32));
vec.push_back(static_cast<unsigned long>(sumtot >> 32));
return vec;
}
std::istream & MixMaxRng::get ( std::istream& is)
@@ -408,8 +321,8 @@ std::istream & MixMaxRng::getState ( std::istream& is )
{
char endMarker[MarkerLen];
is >> theSeed;
for (int i=0; i<rng_get_N(); ++i) is >> S.V[i];
is >> S.counter;
for (int i=0; i<rng_get_N(); ++i) is >> V[i];
is >> counter;
myuint_t checksum;
is >> checksum;
is >> std::ws;
@@ -421,14 +334,14 @@ std::istream & MixMaxRng::getState ( std::istream& is )
<< "\nInput stream is probably mispositioned now.\n";
return is;
}
if ( S.counter < 0 || S.counter > rng_get_N() ) {
if ( counter < 0 || counter > rng_get_N() ) {
std::cerr << "\nMixMaxRng::getState(): "
<< "vector read wrong value of counter from file!"
<< "\nInput stream is probably mispositioned now.\n";
return is;
}
precalc();
if ( checksum != S.sumtot) {
if ( checksum != sumtot) {
std::cerr << "\nMixMaxRng::getState(): "
<< "checksum disagrees with value stored in file!"
<< "\nInput stream is probably mispositioned now.\n";
@@ -437,31 +350,32 @@ std::istream & MixMaxRng::getState ( std::istream& is )
return is;
}
bool MixMaxRng::get (const std::vector<unsigned long> & v)
bool MixMaxRng::get (const std::vector<unsigned long> & vec)
{
if ((v[0] & 0xffffffffUL) != engineIDulong<MixMaxRng>()) {
if ((vec[0] & 0xffffffffUL) != engineIDulong<MixMaxRng>())
{
std::cerr <<
"\nMixMaxRng::get(): vector has wrong ID word - state unchanged\n";
return false;
}
return getState(v);
return getState(vec);
}
bool MixMaxRng::getState (const std::vector<unsigned long> & v)
bool MixMaxRng::getState (const std::vector<unsigned long> & vec)
{
if (v.size() != VECTOR_STATE_SIZE ) {
if (vec.size() != VECTOR_STATE_SIZE ) {
std::cerr <<
"\nMixMaxRng::getState(): vector has wrong length - state unchanged\n";
return false;
}
for (int i=1; i<2*rng_get_N() ; i=i+2) {
S.V[i/2]= ( (v[i] & MASK32) | ( (myuint_t)(v[i+1]) << 32 ) );
V[i/2]= ( (vec[i] & MASK32) | ( (myuint_t)(vec[i+1]) << 32 ) );
// unpack from a data structure which is 32-bit on some platforms
}
S.counter = (int)v[2*rng_get_N()+1];
counter = (int)vec[2*rng_get_N()+1];
precalc();
if ( ( (v[2*rng_get_N()+2] & MASK32)
| ( (myuint_t)(v[2*rng_get_N()+3]) << 32 ) ) != S.sumtot) {
if ( ( (vec[2*rng_get_N()+2] & MASK32)
| ( (myuint_t)(vec[2*rng_get_N()+3]) << 32 ) ) != sumtot) {
std::cerr << "\nMixMaxRng::getState(): vector has wrong checksum!"
<< "\nInput vector is probably mispositioned now.\n";
return false;
@@ -469,131 +383,84 @@ bool MixMaxRng::getState (const std::vector<unsigned long> & v)
return true;
}
myuint_t MixMaxRng ::MOD_MULSPEC(myuint_t k)
{
switch (N)
{
case 17:
return 0;
break;
case 8:
return 0;
break;
case 240:
return fmodmulM61( 0, SPECIAL , (k) );
break;
default:
std::cerr << "MIXMAX ERROR: " << "Disallowed value of parameter N\n";
std::terminate();
break;
}
}
myuint_t MixMaxRng::MULWU (myuint_t k)
{
return (( (k)<<(SPECIALMUL) & M61) ^ ( (k) >> (BITS-SPECIALMUL)) );
}
myuint_t MixMaxRng::iterate_raw_vec(myuint_t* Y, myuint_t sumtotOld)
{
// operates with a raw vector, uses known sum of elements of Y
int i;
myuint_t tempP, tempV;
Y[0] = ( tempV = sumtotOld);
myuint_t sumtot = Y[0], ovflow = 0; // will keep a running sum of all new elements
myuint_t insumtot = Y[0], ovflow = 0; // will keep a running sum of all new elements
tempP = 0; // will keep a partial sum of all old elements
for (i=1; (i<N); i++)
for (int i=1; (i<N); ++i)
{
myuint_t tempPO = MULWU(tempP);
tempP = modadd(tempP, Y[i]);
tempV = MIXMAX_MOD_MERSENNE(tempV+tempP+tempPO); // new Y[i] = old Y[i] + old partial * m
Y[i] = tempV;
sumtot += tempV; if (sumtot < tempV) {ovflow++;}
insumtot += tempV; if (insumtot < tempV) {++ovflow;}
}
return MIXMAX_MOD_MERSENNE(MIXMAX_MOD_MERSENNE(sumtot) + (ovflow <<3 ));
return MIXMAX_MOD_MERSENNE(MIXMAX_MOD_MERSENNE(insumtot) + (ovflow <<3 ));
}
myuint_t MixMaxRng::get_next()
{
int i;
i=S.counter;
int i = counter;
if ((i<=(N-1)) )
{
S.counter++;
return S.V[i];
++counter;
return V[i];
}
else
{
S.sumtot = iterate_raw_vec(S.V.data(), S.sumtot);
S.counter=2;
return S.V[1];
sumtot = iterate_raw_vec(V, sumtot);
counter=2;
return V[1];
}
}
myuint_t MixMaxRng::precalc()
{
int i;
myuint_t temp;
temp = 0;
for (i=0; i < N; i++){
temp = MIXMAX_MOD_MERSENNE(temp + S.V[i]);
}
S.sumtot = temp;
myuint_t temp = 0;
for (int i=0; i < N; ++i) { temp = MIXMAX_MOD_MERSENNE(temp + V[i]); }
sumtot = temp;
return temp;
}
double MixMaxRng::get_next_float_packbits()
{
myuint_t Z=get_next();
return convert1double(Z);
}
void MixMaxRng::seed_vielbein(unsigned int index)
void MixMaxRng::state_init()
{
int i;
if (index<N)
{
for (i=0; i < N; i++){
S.V[i] = 0;
}
S.V[index] = 1;
}
else
{
std::terminate();
}
S.counter = N; // set the counter to N if iteration should happen right away
S.sumtot = 1;
for (int i=1; i < N; ++i) { V[i] = 0; }
V[0] = 1;
counter = N; // set the counter to N if iteration should happen right away
sumtot = 1;
}
void MixMaxRng::seed_spbox(myuint_t seed)
{
// a 64-bit LCG from Knuth line 26, in combination with a bit swap is used to seed
if (seed == 0)
throw std::runtime_error("try seeding with nonzero seed next time");
const myuint_t MULT64=6364136223846793005ULL;
int i;
myuint_t sumtot=0,ovflow=0;
if (seed == 0) throw std::runtime_error("try seeding with nonzero seed next time");
sumtot = 0;
myuint_t l = seed;
for (i=0; i < N; i++){
for (int i=0; i < N; ++i)
{
l*=MULT64; l = (l << 32) ^ (l>>32);
S.V[i] = l & M61;
sumtot += S.V[(i)]; if (sumtot < S.V[(i)]) {ovflow++;}
V[i] = l & M61;
sumtot = MIXMAX_MOD_MERSENNE(sumtot + V[(i)]);
}
S.counter = N; // set the counter to N if iteration should happen right away
S.sumtot = MIXMAX_MOD_MERSENNE(MIXMAX_MOD_MERSENNE(sumtot) + (ovflow <<3 ));
counter = N; // set the counter to N if iteration should happen right away
}
void MixMaxRng::seed_uniquestream( myID_t clusterID, myID_t machineID, myID_t runID, myID_t streamID )
{
seed_vielbein(0);
S.sumtot = apply_bigskip(S.V.data(), S.V.data(), clusterID, machineID, runID, streamID );
S.counter = 1;
state_init();
sumtot = apply_bigskip(V, V, clusterID, machineID, runID, streamID );
counter = 1;
}
myuint_t MixMaxRng::apply_bigskip( myuint_t* Vout, myuint_t* Vin, myID_t clusterID, myID_t machineID, myID_t runID, myID_t streamID )
@@ -608,7 +475,7 @@ myuint_t MixMaxRng::apply_bigskip( myuint_t* Vout, myuint_t* Vin, myID_t cluster
(this is good enough : a single CPU will not exceed this in the lifetime of the universe, 10^19 sec,
even if it had a clock cycle of Planch time, 10^44 Hz )
Caution: never apply this to a derived vector, just choose some mother vector Vin, for example the unit vector by seed_vielbein(X,0),
Caution: never apply this to a derived vector, just choose some mother vector Vin, for example the unit vector by state_init(),
and use it in all your runs, just change runID to get completely nonoverlapping streams of random numbers on a different day.
clusterID and machineID are provided for the benefit of large organizations who wish to ensure that a simulation
@@ -623,7 +490,7 @@ myuint_t MixMaxRng::apply_bigskip( myuint_t* Vout, myuint_t* Vin, myID_t cluster
;
const myuint_t* skipMat[128];
for (int i=0; i<128; i++) { skipMat[i] = skipMat17[i];}
for (int i=0; i<128; ++i) { skipMat[i] = skipMat17[i]; }
myID_t IDvec[4] = {streamID, runID, machineID, clusterID};
int r,i,j, IDindex;
@@ -631,10 +498,10 @@ myuint_t MixMaxRng::apply_bigskip( myuint_t* Vout, myuint_t* Vin, myID_t cluster
myuint_t Y[N], cum[N];
myuint_t coeff;
myuint_t* rowPtr;
myuint_t sumtot=0;
myuint_t insumtot=0;
for (i=0; i<N; i++) { Y[i] = Vin[i]; sumtot = modadd( sumtot, Vin[i]); } ;
for (IDindex=0; IDindex<4; IDindex++)
for (i=0; i<N; ++i) { Y[i] = Vin[i]; insumtot = modadd( insumtot, Vin[i]); }
for (IDindex=0; IDindex<4; ++IDindex)
{ // go from lower order to higher order ID
id=IDvec[IDindex];
//printf("now doing ID at level %d, with ID = %d\n", IDindex, id);
@@ -644,26 +511,26 @@ myuint_t MixMaxRng::apply_bigskip( myuint_t* Vout, myuint_t* Vin, myID_t cluster
if (id & 1)
{
rowPtr = (myuint_t*)skipMat[r + IDindex*8*sizeof(myID_t)];
for (i=0; i<N; i++){ cum[i] = 0; }
for (j=0; j<N; j++)
for (i=0; i<N; ++i){ cum[i] = 0; }
for (j=0; j<N; ++j)
{ // j is lag, enumerates terms of the poly
// for zero lag Y is already given
coeff = rowPtr[j]; // same coeff for all i
for (i =0; i<N; i++){
for (i =0; i<N; ++i){
cum[i] = fmodmulM61( cum[i], coeff , Y[i] ) ;
}
sumtot = iterate_raw_vec(Y, sumtot);
insumtot = iterate_raw_vec(Y, insumtot);
}
sumtot=0;
for (i=0; i<N; i++){ Y[i] = cum[i]; sumtot = modadd( sumtot, cum[i]); } ;
insumtot=0;
for (i=0; i<N; ++i){ Y[i] = cum[i]; insumtot = modadd( insumtot, cum[i]); } ;
}
id = (id >> 1); r++; // bring up the r-th bit in the ID
id = (id >> 1); ++r; // bring up the r-th bit in the ID
}
}
sumtot=0;
for (i=0; i<N; i++){ Vout[i] = Y[i]; sumtot = modadd( sumtot, Y[i]); }
insumtot=0;
for (i=0; i<N; ++i){ Vout[i] = Y[i]; insumtot = modadd( insumtot, Y[i]); }
// returns sumtot, and copy the vector over to Vout
return (sumtot) ;
return insumtot;
}
#if defined(__x86_64__)
@@ -696,41 +563,20 @@ myuint_t MixMaxRng::apply_bigskip( myuint_t* Vout, myuint_t* Vin, myID_t cluster
}
#endif
myuint_t MixMaxRng::modadd(myuint_t foo, myuint_t bar)
{
#if defined(__x86_64__) && defined(__GNUC__) && (!defined(__ICC))
//#warning Using assembler routine in modadd
myuint_t out;
/* Assembler trick suggested by Andrzej Görlich */
__asm__ ("addq %2, %0; "
"btrq $61, %0; "
"adcq $0, %0; "
:"=r"(out)
:"0"(foo), "r"(bar)
);
return out;
#else
return MIXMAX_MOD_MERSENNE(foo+bar);
#endif
}
void MixMaxRng::print_state() const
{
int j;
std::cout << "mixmax state, file version 1.0\n";
std::cout << "N=" << rng_get_N() << "; V[N]={";
for (j=0; (j< (rng_get_N()-1) ); j++) {
std::cout << S.V[j] << ", ";
}
std::cout << S.V[rng_get_N()-1];
for (int j=0; (j< (rng_get_N()-1) ); ++j) { std::cout << V[j] << ", "; }
std::cout << V[rng_get_N()-1];
std::cout << "}; ";
std::cout << "counter= " << S.counter;
std::cout << "sumtot= " << S.sumtot << "\n";
std::cout << "counter= " << counter;
std::cout << "sumtot= " << sumtot << "\n";
}
MixMaxRng MixMaxRng::Branch()
{
S.sumtot = iterate_raw_vec(S.V.data(), S.sumtot); S.counter = 1;
sumtot = iterate_raw_vec(V, sumtot); counter = 1;
MixMaxRng tmp=*this;
tmp.BranchInplace(0); // daughter id
return tmp;
@@ -741,11 +587,11 @@ void MixMaxRng::BranchInplace(int id)
// Dont forget to iterate the mother, when branching the daughter, or else will have collisions!
// a 64-bit LCG from Knuth line 26, is used to mangle a vector component
constexpr myuint_t MULT64=6364136223846793005ULL;
myuint_t tmp=S.V[id];
S.V[1] *= MULT64; S.V[id] &= M61;
S.sumtot = MIXMAX_MOD_MERSENNE( S.sumtot + S.V[id] - tmp + M61);
S.sumtot = iterate_raw_vec(S.V.data(), S.sumtot);// printf("iterating!\n");
S.counter = 1;
myuint_t tmp=V[id];
V[1] *= MULT64; V[id] &= M61;
sumtot = MIXMAX_MOD_MERSENNE( sumtot + V[id] - tmp + M61);
sumtot = iterate_raw_vec(V, sumtot);
counter = 1;
}
} // namespace CLHEP
+7 -1
View File
@@ -28,7 +28,7 @@
// M Fischler - put/get to/from streams uses pairs of ulongs when
// + storing doubles avoid problems with precision
// 4/14/05
// M Fisculer - Modified use of shoot (mean) instead of
// M Fischler - Modified use of shoot (mean) instead of
// shoot(getLocalEngine(), mean) when fire(mean) is called.
// This flaw was causing bad "cross-talk" between modules
// in CMS, where one used its own engine, and the other
@@ -179,6 +179,12 @@ void RandPoissonQ::shootArray(const int size, long* vect, double m) {
// But since those are cached anyway, not much time would be saved.
}
void RandPoissonQ::shootArray(HepRandomEngine* anEngine, const int size,
long* vect, double m1) {
for( long* v = vect; v != vect + size; ++v )
*v = shoot(anEngine,m1);
}
void RandPoissonQ::fireArray(const int size, long* vect, double m) {
for( long* v = vect; v != vect + size; ++v )
*v = fire( m );
+10
View File
@@ -6,6 +6,16 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-11-09 Guy Barrand (g4tools-V11-01-06)
- tools/wroot/file: in the constructor, for the streaming of the root directory, take into account the streaming of what would be
the fUUID (a TUUID in ROOT) field of the TDirectory version 4. This permits to fix the "G4AnalysisManager creates ROOT files
that are not updateable" issue described in bugzilla problem 2570.
- tools/version: pass to 6.3.0.
## 2023-07-03 Guy Barrand (g4tools-V11-01-05)
- toolx/Xt/session: quiet Coverity CID=104821: in copy constructor, initialise m_app_owner(false).
- tools/version: pass to 6.2.1.
## 2023-06-15 Gabriele Cosmo (g4tools-V11-01-04)
- Fixed compilation warning for implicit type conversions on macOS/XCode 14.1
in toolsx/Xt/zb_viewer.
+11
View File
@@ -1,3 +1,14 @@
6.3.0:
- tools/wroot/file: in the constructor, for the streaming of the root directory, take into account the streaming of what would be
the fUUID (a TUUID in ROOT) field of the TDirectory version 4. This permits to fix the "G4AnalysisManager creates ROOT files
that are not updateable" issue described in bugzilla problem 2570.
- tools/version: pass to 6.3.0.
6.2.1:
- toolx/Xt/session: quiet Coverity CID=104821: in copy constructor, initialise m_app_owner(false).
- toolx/Xt/zb_viewer: Fixed compilation warning for implicit type conversions on macOS/XCode 14.1.
- tools/version: pass to 6.2.1.
6.2.0:
- toolx/Qt: zb_viewer, pixwin, session, s2q: have a Qt viewer for the tools/zbuffer rendering.
- toolx/Xt: zb_viewer, ImageArea, session: have a Xt viewer for the tools/zbuffer rendering.
+4 -4
View File
@@ -5,13 +5,13 @@
#define tools_version
#define TOOLS_MAJOR_VERSION 6
#define TOOLS_MINOR_VERSION 2
#define TOOLS_MINOR_VERSION 3
#define TOOLS_PATCH_VERSION 0
#define TOOLS_VERSION "6.2.0"
#define TOOLS_VERSION_VRP "v6r2p0"
#define TOOLS_VERSION "6.3.0"
#define TOOLS_VERSION_VRP "v6r3p0"
namespace tools {
inline unsigned int version() {return 60200;}
inline unsigned int version() {return 60300;}
}
#endif
+12 -1
View File
@@ -278,6 +278,12 @@ public:
key::std_string_record_size(m_path) +
key::std_string_record_size(m_title);
uint32 nbytes = namelen + m_root_directory.record_size();
//TUUID version 1:
nbytes += sizeof(unsigned int);
nbytes += 2*sizeof(unsigned short);
nbytes += 8*sizeof(unsigned char);
wroot::key key(m_out,*this,0,m_path,m_title,"TFile",nbytes); // It does a (*this).set_END().
// m_nbytes_name = start point of directory info from key head.
@@ -297,7 +303,12 @@ public:
wbuf wb(m_out,byte_swap(),key.eob(),pos);
if(!wb.write(m_path)) return;
if(!wb.write(m_title)) return;
if(!m_root_directory.to_buffer(wb)) return;}
if(!m_root_directory.to_buffer(wb)) return;
//TUUID version 1:
if(!wb.write((unsigned int)0)) return;
if(!wb.write((unsigned short)0)) return;
if(!wb.write((unsigned short)0)) return;
{for(size_t count=0;count<8;count++) if(!wb.write((unsigned char)0)) return;}}
if(m_verbose) {
m_out << "tools::wroot::file::file :"
+1 -1
View File
@@ -44,7 +44,7 @@ public:
}
protected:
session(const session& a_from)
:m_out(a_from.m_out),m_app_context(0),m_app_widget(0)
:m_out(a_from.m_out),m_app_context(0),m_app_widget(0),m_app_owner(false)
{}
session& operator=(const session&){return *this;}
public:
-40
View File
@@ -1,40 +0,0 @@
---
Checks: "-*,\
google-readability-casting,\
misc-*,\
-misc-incorrect-roundings,\
-misc-macro-parentheses,\
-misc-misplaced-widening-cast,\
-misc-static-assert,\
modernize-*,\
-modernize-deprecated-headers,\
-modernize-pass-by-value,\
-modernize-raw-string-literal,\
-modernize-return-braced-init-list,\
-modernize-use-auto,\
-modernize-use-default-member-init,\
-modernize-use-emplace,\
-modernize-use-equals-default,\
-modernize-use-equals-delete,\
-modernize-use-noexcept,\
-modernize-use-transparent-functors,\
-modernize-use-using,\
performance-*,\
-performance-inefficient-string-concatenation,\
readability-*,\
-readability-function-size,\
-readability-identifier-naming,\
-readability-implicit-bool-cast,\
-readability-inconsistent-declaration-parameter-name,\
-readability-named-parameter,\
-readability-redundant-declaration,\
-readability-redundant-member-init,\
-readability-simplify-boolean-expr,\
"
HeaderFilterRegex: 'source/[^/]*\.(hh|cc)$'
CheckOptions:
- key: readability-braces-around-statements.ShortStatementLines
value: '2'
- key: readability-implicit-bool-conversion.AllowPointerConditions
value: '1'
...
+4
View File
@@ -6,6 +6,10 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-10-11 Ben Morgan (ptl-V11-01-00)
- Disable optimization of ThreadPool::execute_thread on Apple/Intel/AppleClang builds
- Workaround for Bugzilla 2564
## 2022-11-18 Gabriele Cosmo (ptl-V11-00-05)
- More compilation warnings fixes for implicit type conversions.
+4
View File
@@ -764,6 +764,10 @@ ThreadPool::get_valid_queue(task_queue_t*& _queue) const
}
//======================================================================================//
// Temporary workaround for shared_ptr constructor GPFLT on Intel Macs and Clang 15
#if defined (__APPLE__) && defined(__amd64) && defined(__clang__)
[[clang::optnone]]
#endif
void
ThreadPool::execute_thread(VUserTaskQueue* _task_queue)
{