53 if(!_coefsCalculated) {
54 calculateCoefs(MaxDimension);
55 _coefsCalculated=
kTRUE;
58 _nextq=
new Int_t[MaxDimension];
78 for(
Int_t dim= 0; dim < MaxDimension; dim++) _nextq[dim]= 0;
92 for(dim=0; dim < dimension; dim++) {
93 vector[dim] = _nextq[dim] * recip;
114 for(dim=0; dim<dimension; dim++) {
115 _nextq[dim] ^= _cj[
r][dim];
128 int ci[NBits][NBits];
129 int v[NBits+MaxDegree+1];
133 for(i_dim=0; i_dim<dimension; i_dim++) {
135 const int poly_index = i_dim + 1;
154 int px_degree = _polyDegree[poly_index];
157 for(k=0; k<=px_degree; k++) {
158 px[k] = _primitivePoly[poly_index][k];
163 for(j=0; j<NBits; j++) {
168 if(u == 0) calculateV(px, px_degree, pb, &pb_degree, v, NBits+MaxDegree);
176 for(r=0; r<NBits; r++) {
182 if(u == px_degree) u = 0;
189 for(r=0; r<NBits; r++) {
191 for(j=0; j<NBits; j++) {
192 term = 2*term + ci[
r][j];
194 _cj[
r][i_dim] = term;
205 int pb[],
int * pb_degree,
int v[],
int maxv)
207 const int nonzero_element = 1;
208 const int arbitrary_element = 1;
216 int bigm = *pb_degree;
220 for(k=0; k<=MaxDegree; k++) {
228 polyMultiply(px, px_degree, pb, *pb_degree, pb, pb_degree);
247 for(r=0; r<kj; r++) {
254 for(r=kj+1; r<
m; r++) {
255 v[
r] = arbitrary_element;
261 int term = sub(0, ph[kj]);
263 for(r=kj+1; r<bigm; r++) {
264 v[
r] = arbitrary_element;
269 term = sub(term, mul(ph[r], v[r]));
273 v[bigm] = add(nonzero_element, term);
275 for(r=bigm+1; r<
m; r++) {
276 v[
r] = arbitrary_element;
283 for(r=0; r<=maxv-
m; r++) {
286 term = sub(term, mul(pb[k], v[r+k]));
297 int pb_degree,
int pc[],
int * pc_degree)
301 int pt_degree = pa_degree + pb_degree;
303 for(k=0; k<=pt_degree; k++) {
305 for(j=0; j<=k; j++) {
306 const int conv_term = mul(pa[k-j], pb[j]);
307 term = add(term, conv_term);
312 for(k=0; k<=pt_degree; k++) {
315 for(k=pt_degree+1; k<=MaxDegree; k++) {
319 *pc_degree = pt_degree;
338 { 1, 0, 0, 0, 0, 0 },
339 { 0, 1, 0, 0, 0, 0 },
340 { 1, 1, 0, 0, 0, 0 },
341 { 1, 1, 1, 0, 0, 0 },
342 { 1, 1, 0, 1, 0, 0 },
343 { 1, 0, 1, 1, 0, 0 },
344 { 1, 1, 0, 0, 1, 0 },
345 { 1, 0, 0, 1, 1, 0 },
346 { 1, 1, 1, 1, 1, 0 },
347 { 1, 0, 1, 0, 0, 1 },
348 { 1, 0, 0, 1, 0, 1 },
349 { 1, 1, 1, 1, 0, 1 },
359 0, 1, 1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5
static const Int_t _polyDegree[MaxDimension+1]
ClassImp(RooQuasiRandomGenerator)
static const Int_t _primitivePoly[MaxDimension+1][MaxPrimitiveDegree+1]
RooQuasiRandomGenerator()
Perform one-time initialization of our static coefficient array if necessary and initialize our works...
virtual ~RooQuasiRandomGenerator()
Destructor.
Bool_t generate(UInt_t dimension, Double_t vector[])
Generate the next number in the sequence for the specified dimension.
static Bool_t _coefsCalculated
void reset()
Reset the workspace to its initial state.
Mother of all ROOT objects.
void polyMultiply(const int pa[], int pa_degree, const int pb[], int pb_degree, int pc[], int *pc_degree)
Internal function.
static Int_t _cj[NBits][MaxDimension]
void calculateV(const int px[], int px_degree, int pb[], int *pb_degree, int v[], int maxv)
Internal function.
void calculateCoefs(UInt_t dimension)
Calculate the coefficients for the given number of dimensions.