MTToolBox  0.2.10
ReducibleGenerator.hpp
Go to the documentation of this file.
1 #ifndef MTTOOLBOX_REDUCIBLE_GENERATOR_HPP
2 #define MTTOOLBOX_REDUCIBLE_GENERATOR_HPP
3 
30 #include <stdint.h>
31 #include <inttypes.h>
32 #include <NTL/GF2X.h>
34 
35 namespace MTToolBox {
56  template<typename U, typename V = U>
58  : virtual public EquidistributionCalculatable<U, V> {
59  public:
60 
70  virtual ~ReducibleGenerator(){};
71 
85  virtual void setOneBit(int bitPos) = 0;
86 
99  virtual U getParityValue() const = 0;
100 
112  virtual void setParityValue(U parity) = 0;
113 
126  virtual int getMexp() const = 0;
127 
128  };
129 
147  template<typename U, typename V = U>
149  const NTL::GF2X& poly) {
151  rg->setZero();
152  for (int i = 0; i <= deg(poly); i++) {
153  if (coeff(poly, i) != 0) {
154  rg->add(*other);
155  }
156  other->generate();
157  }
158  delete other;
159  }
160 }
161 
162 #endif // MTTOOLBOX_REDUCIBLE_GENERATOR_HPP
virtual void setParityValue(U parity)=0
Set a specified value in the position for parity check.
virtual void setOneBit(int bitPos)=0
set 1 for specified bit and clear all other bits in internal state.
virtual void add(EquidistributionCalculatable< U, V > &that)=0
Add internal state of GF(2)-linear pseudo random number generators.
This class is an Abstract class for calculating dimension of equi-distribution for GF(2)-linear pseud...
Definition: EquidistributionCalculatable.hpp:50
virtual EquidistributionCalculatable< U, V > * clone() const =0
Return copy of myself.
virtual U getParityValue() const =0
Virtual destructor (always required) Returs a value in the position for parity check.
virtual ~ReducibleGenerator()
Virtual destructor (always required)
Definition: ReducibleGenerator.hpp:70
This class is an Abstract class for reducible generator.
Definition: ReducibleGenerator.hpp:57
This class is an Abstract class for calculating dimension of equi-distribution for GF(2)-linear pseud...
void annihilate(EquidistributionCalculatable< U, V > *rg, const NTL::GF2X &poly)
Annihilate internal state of generator by given polynomial.
Definition: ReducibleGenerator.hpp:148
virtual U generate(int outBitLen)=0
output outBitLen from MSB.
virtual int getMexp() const =0
Get Mersenne Exponent which is a exponent part of certified minimum period.
virtual void setZero()=0
Set all zero to internal state.
name space for MTToolBox