MCQMCIntegration  0.1
DigitalNet.h
Go to the documentation of this file.
1 #pragma once
2 #ifndef MCQMC_INTEGRATION_DIGITAL_NET_H
3 #define MCQMC_INTEGRATION_DIGITAL_NET_H
4 
23 #include <cstring>
24 #include <iostream>
25 #include <iomanip>
26 #include <string>
27 #include <cerrno>
28 #include <random>
29 
30 namespace MCQMCIntegration {
34  enum DigitalNetID {
36  SOBOL = 1,
38  NXLW = 3,
40  SOLW = 4
41  };
42 
49  template<typename T>
50  class DigitalNet {
51  public:
52  static const char * getDataPath();
53  static uint32_t getParameterSize();
54  static const std::string getDigitalNetName(uint32_t index);
55  static const std::string getDigitalNetConstruction(uint32_t index);
56  static uint32_t getSMax();
57  static uint32_t getSMin();
58  static uint32_t getMMax();
59  static uint32_t getMMin();
60  private:
61  ~DigitalNet();
62  DigitalNet(int s, int m);
63  T dmy;
64  };
65 
71  template<>
72  class DigitalNet<uint64_t> {
73  private:
74  // First of all, forbid copy and assign.
75  DigitalNet(const DigitalNet<uint64_t>& that);
76  DigitalNet<uint64_t>& operator=(const DigitalNet<uint64_t>&);
77  class Gray {
78  public:
79  Gray();
80  void clear();
81  uint32_t next();
82  int index();
83  private:
84  uint32_t count;
85  uint32_t gray;
86  uint32_t pre;
87  };
88 
89  public:
103  DigitalNet(std::istream& is);
104 
117  DigitalNet(DigitalNetID id, uint32_t s, uint32_t m);
118 
122  ~DigitalNet();
123 
130  uint64_t getBase(int i, int j) const {
131  return base[i * s + j];
132  }
133 
139  double getPoint(int i) const {
140  return point[i];
141  }
142 
147  const double * getPoint() const {
148  return point;
149  }
150 
155  uint32_t getS() const {
156  return s;
157  }
158 
163  uint32_t getM() const {
164  return m;
165  }
166 
171  void showStatus(std::ostream& os);
172 
176  void scramble();
177 
181  void pointInitialize();
182 
186  void nextPoint();
187 
191  void setSeed(uint64_t seed);
192 
197  double getWAFOM() {
198  return wafom;
199  }
200 
205  int64_t getTvalue() {
206  return tvalue;
207  }
208 #if 0
209 
213  static const char * getDataPath();
214 
219  static uint32_t getParameterSize();
220 
225  static const std::string getDigitalNetName(uint32_t index);
226 
231  static const std::string getDigitalNetConstruction(uint32_t index);
232 #endif
233 
237  static uint32_t getSMax();
238 
243  static uint32_t getSMin();
244 
249  static uint32_t getMMax();
250 
255  static uint32_t getMMin();
256  private:
257  void setBase(int i, int j, uint64_t value) {
258  base[i * s + j] = value;
259  }
260  void scramble(int i, int j, int l);
261  uint32_t s;
262  uint32_t m;
263  uint64_t *shift;
264  uint64_t count;
265  double wafom;
266  int64_t tvalue;
267  Gray gray;
268  std::mt19937_64 mt;
269  uint64_t * base;
270  uint64_t * point_base;
271  double * point;
272  };
273 }
274 #endif // MCQMC_INTEGRATION_DIGITAL_NET_H
Sobol Point Set up to dimension 21201.
Definition: DigitalNet.h:36
static uint32_t getMMax()
double getPoint(int i) const
get a component of a point vector.
Definition: DigitalNet.h:139
static const std::string getDigitalNetConstruction(uint32_t index)
double getWAFOM()
get WAFOM value if exist.
Definition: DigitalNet.h:197
Niederreiter-Xing point set of Low WAFOM.
Definition: DigitalNet.h:38
int64_t getTvalue()
get t-value if exist.
Definition: DigitalNet.h:205
uint32_t getS() const
get dimension of digital net.
Definition: DigitalNet.h:155
Sobol point set of Low WAFOM.
Definition: DigitalNet.h:40
static const char * getDataPath()
uint64_t getBase(int i, int j) const
get an element of base matrix of generating point set.
Definition: DigitalNet.h:130
Digital Net class for Quasi Mote-Carlo Method.
Definition: DigitalNet.h:50
Definition: DigitalNet.h:30
static uint32_t getParameterSize()
static uint32_t getSMin()
static uint32_t getMMin()
uint32_t getM() const
get F2 dimension of element of digital net.
Definition: DigitalNet.h:163
static const std::string getDigitalNetName(uint32_t index)
DigitalNetID
ID of pre-defined Digital Net.
Definition: DigitalNet.h:34
Digital Net class for Quasi Mote-Carlo Method.
Definition: DigitalNet.h:72
static uint32_t getSMax()
const double * getPoint() const
get a point vector.
Definition: DigitalNet.h:147