CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

RandomObjects/CLHEP/Random/Hurd288Engine.h
Go to the documentation of this file.
1 // $Id: Hurd288Engine.h,v 1.5 2010/06/16 17:24:53 garren Exp $
2 // -*- C++ -*-
3 //
4 // -----------------------------------------------------------------------
5 // HEP Random
6 // --- Hurd288Engine ---
7 // class header file
8 // -----------------------------------------------------------------------
9 // The starting point for the Hurd Random algorithm is the paper in
10 // IEEE Transactions on Computers c23, 2 Feb 1974. The algorithm is
11 // essentially a series of 32 interconnected b-bit registers. The basic
12 // property is that at each step, bit 1 becomes bit 0, bit 2 the new bit 1,
13 // bit b the new bit b-1. This is modified so that the new bit b0 is the old
14 // bit b1 XOR'd with some bit b-d from the previous bit register. The values
15 // of d can be chosen so as to generate a primitive polynomial, a maximal
16 // length sequence through all bit patterns except the zero pattern.
17 //
18 // This generator, Hurd288, use values based upon Table I of the afore-
19 // mentioned paper, such that we have 288 total bits, representing 32
20 // 9-bit registers (actually implemented as an array of 9 32-bit words)
21 // =======================================================================
22 // 07-23-98 KLS Initial draft started
23 // Ken Smith - Added conversion operators: 6th Aug 1998
24 // Mark Fischler - methods for distrib. instacne save/restore 12/8/04
25 // Mark Fischler - methods for anonymous save/restore 12/27/04
26 // =======================================================================
27 
28 #ifndef Hurd288Engine_h
29 #define Hurd288Engine_h
30 
31 #include "CLHEP/Random/defs.h"
32 #include "CLHEP/Random/RandomEngine.h"
33 
34 namespace CLHEP {
35 
40 class Hurd288Engine: public HepRandomEngine {
41 
42 public:
43 
44  Hurd288Engine();
45  Hurd288Engine( std::istream &is );
46  Hurd288Engine( long seed );
47  Hurd288Engine( int rowIndex, int colIndex );
48  virtual ~Hurd288Engine();
49  // Constructors and destructor.
50 
51  double flat();
52  // Returns a pseudo random number between 0 and 1
53 
54  void flatArray( const int size, double* vect );
55  // Fills the array "vect" of specified size with flat random values.
56 
57  void setSeed( long seed, int );
58  // Sets the state of the algorithm according to seed.
59 
60  void setSeeds( const long* seeds, int );
61  // Sets the state of the algorithm according to the zero-terminated
62  // array of seeds.
63 
64  void saveStatus( const char filename[] = "Hurd288Engine.conf" ) const;
65  // Saves on named file the current engine status
66 
67  void restoreStatus( const char filename[] = "Hurd288Engine.conf" );
68  // Reads from named file the last saved engine status
69  // and restores it.
70 
71  void showStatus() const;
72  // Dumps the engine status on the screen
73 
74  operator float(); // flat value, without worrying about filling bits
75  operator unsigned int(); // 32-bit flat value, quickest of all
76 
77  virtual std::ostream & put (std::ostream & os) const;
78  virtual std::istream & get (std::istream & is);
79  static std::string beginTag ( );
80  virtual std::istream & getState ( std::istream & is );
81 
82  std::string name() const;
83  static std::string engineName() {return "Hurd288Engine";}
84 
85  std::vector<unsigned long> put () const;
86  bool get (const std::vector<unsigned long> & v);
87  bool getState (const std::vector<unsigned long> & v);
88 
89  static const unsigned int VECTOR_STATE_SIZE = 11;
90 
91 private:
92  static int numEngines;
93  static int maxIndex;
94 
95  void advance();
96 
97  int wordIndex;
98  unsigned int words[9];
99 
100 }; // Hurd288Engine
101 
102 } // namespace CLHEP
103 
104 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
105 // backwards compatibility will be enabled ONLY in CLHEP 1.9
106 using namespace CLHEP;
107 #endif
108 
109 #endif // Hurd288Engine_h
CLHEP::Hurd288Engine::engineName
static std::string engineName()
Definition: RandomObjects/CLHEP/Random/Hurd288Engine.h:83
CLHEP::Hurd288Engine::flat
double flat()
Definition: Hurd288Engine.cc:150
CLHEP::Hurd288Engine::~Hurd288Engine
virtual ~Hurd288Engine()
Definition: Hurd288Engine.cc:112
is
HepRotation and so forth isNear() norm2() rectify() static Rotation row1 row4(To avoid bloat in the code pulled in for programs which don 't use all these features, we split the implementation .cc files. Only isNear() goes into the original Rotation.cc) --------------------------------------- HepAxisAngle and HepEulerAngles classes --------------------------------------- These classes are very useful and simple structures for holding the result of a nice intuituve decomposition of a rotation there is no longer much content in the distinct ZOOM PhysicsVectors library The only content left in the library is the object files representing the various Exception objects When we build the CLHEP classes for the ZOOM we will set up so as to use ZOOM SpaceVector is(but we can disable namespace usage and most of our users do so at this point). What I do is leave Hep3Vector in the global namespace
CLHEP::Hurd288Engine::flatArray
void flatArray(const int size, double *vect)
Definition: Hurd288Engine.cc:165
CLHEP::Hurd288Engine::setSeeds
void setSeeds(const long *seeds, int)
Definition: Hurd288Engine.cc:178
CLHEP::Hurd288Engine::Hurd288Engine
Hurd288Engine()
Definition: Hurd288Engine.cc:64
size
user code seldom needs to call this function directly ZMerrno whether or not they are still recorded ZMerrno size() Return the(integer) number of ZMthrow 'n exceptions currently recorded. 5) ZMerrno.clear() Set an internal counter to zero. This counter is available(see next function) to user code to track ZMthrow 'n exceptions that have occurred during any arbitrary time interval. 6) ZMerrno.countSinceCleared() Return the(integer) number of ZMthrow 'n exceptions that have been recorded via ZMerrno.write()
CLHEP::Hurd288Engine::restoreStatus
void restoreStatus(const char filename[]="Hurd288Engine.conf")
Definition: Hurd288Engine.cc:212
CLHEP::Hurd288Engine::saveStatus
void saveStatus(const char filename[]="Hurd288Engine.conf") const
Definition: Hurd288Engine.cc:183
CLHEP
Definition: ClhepVersion.h:13
CLHEP::Hurd288Engine::put
std::vector< unsigned long > put() const
Definition: Hurd288Engine.cc:298
v
they are gone ZOOM Features Discontinued The following features of the ZOOM package were felt to be extreme overkill These have been after checking that no existing user code was utilizing as in SpaceVector v
Definition: keyMergeIssues.doc:324
CLHEP::Hurd288Engine::get
virtual std::istream & get(std::istream &is)
Definition: Hurd288Engine.cc:309
CLHEP::Hurd288Engine::VECTOR_STATE_SIZE
static const unsigned int VECTOR_STATE_SIZE
Definition: Matrix/CLHEP/Random/Hurd288Engine.h:89
seeds
Technical Maintenance Note for CLHEP Random Consequences of seeding JamesRandom with positive seed values greater than In the source code JamesRandom The usual way of seeding a generator is via the default which makes use of the table of seeds(with some trickery to ensure that the values won 't repeat after the table rows are exhausted). The trickery preserves the fact that sees are never negative(because the table values are never negative
CLHEP::Hurd288Engine::setSeed
void setSeed(long seed, int)
Definition: Hurd288Engine.cc:171
CLHEP::Hurd288Engine::name
std::string name() const
Definition: Hurd288Engine.cc:50
CLHEP::Hurd288Engine::showStatus
void showStatus() const
Definition: Hurd288Engine.cc:249
CLHEP::Hurd288Engine::beginTag
static std::string beginTag()
Definition: Hurd288Engine.cc:326
CLHEP::Hurd288Engine::getState
virtual std::istream & getState(std::istream &is)
Definition: Hurd288Engine.cc:330