Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
randomNumbers_SFMT.h
Go to the documentation of this file.
1 
14 #ifndef RANDOMNUMBERS_SFMT_INCLUDED
15 #define RANDOMNUMBERS_SFMT_INCLUDED
16 
17 #ifdef USE_SFMTLIB
18 
19 // #define __STDC_CONSTANT_MACROS
20 
21 #include <string>
22 #include <cassert>
23 
24 #include "randomNumbers.h"
25 
26 #include <SFMT.h>
27 
28 #ifdef HAVE_NTL
29 #define ENABLE_SFMT_JUMP
30 #include <SFMT-jump-alt.h>
31 #endif
32 
33 #include "IO/bridgeIO.h"
34 using Bridge::vout;
35 
36 class RandomNumbers_SFMT : public RandomNumbers
37 {
38  static const std::string class_name;
39 
40  public:
41  RandomNumbers_SFMT(const int s);
42  RandomNumbers_SFMT(const std::string& filename) { read_file(filename); }
43 
44  ~RandomNumbers_SFMT() {}
45 
46  double get();
47  void get_block(double *v, const size_t n);
48 
49  void write_file(const std::string& filename);
50  void read_file(const std::string& filename);
51 
52  void reset(unsigned long seed);
53 
54 #ifdef ENABLE_SFMT_JUMP
55  virtual void uniform_lex_global(Field&);
56  virtual void gauss_lex_global(Field&);
57 #endif
58 
59  private:
60 
61  template<typename T>
62  void generate_global_jump(Field& f);
63 
64  sfmt_t m_state;
65 };
66 #endif /* USE_SFMTLIB */
67 #endif /* RANDOMNUMBERS_SFMT_INCLUDED */
BridgeIO vout
Definition: bridgeIO.cpp:495
virtual void uniform_lex_global(Field &)
uniform random number defined on global lattice.
Container of Field-type object.
Definition: field.h:39
virtual void write_file(const std::string &)=0
static const std::string class_name
Definition: randomNumbers.h:39
virtual void gauss_lex_global(Field &)
gaussian random number defined on global lattice.
virtual void reset(unsigned long seed)=0
reset state with new seed.
virtual void read_file(const std::string &)=0
save and load random number status.
Base class of random number generators.
Definition: randomNumbers.h:36