FairRoot/PandaRoot
Functions
ranlxs.h File Reference

Go to the source code of this file.

Functions

void ranlxs (float r[], int n)
 
void rlxs_init (int level, int seed)
 
int rlxs_size (void)
 
void rlxs_get (int state[])
 
void rlxs_reset (int state[])
 

Function Documentation

void ranlxs ( float  r[],
int  n 
)
Author
Manuel Zambrana zambr.nosp@m.ana@.nosp@m.kph.u.nosp@m.ni-m.nosp@m.ainz..nosp@m.de and Dmitry Khaneftd khane.nosp@m.ftd@.nosp@m.kph.u.nosp@m.ni-m.nosp@m.ainz..nosp@m.de

Mainz, May 2011

Definition at line 566 of file ranlxs.cxx.

References is, n, rlxs_init(), update(), and x.

567 {
568  int k;
569 
570  if (init==0)
571  rlxs_init(0,1);
572 
573  for (k=0;k<n;k++)
574  {
575  is=next[is];
576  if (is==is_old)
577  update();
578  r[k]=one_bit*(float)(x.num[is]);
579  }
580 }
double r
Definition: RiemannTest.C:14
static float one_bit
Definition: ranlxs.cxx:373
int n
static int is_old
Definition: ranlxs.cxx:372
static int init
Definition: ranlxd.cxx:374
static int is
Definition: ranlxs.cxx:372
Double_t x
static void update(void)
Definition: ranlxs.cxx:451
void rlxs_init(int level, int seed)
Definition: ranlxs.cxx:495
static int next[96]
Definition: ranlxs.cxx:372
void rlxs_get ( int  state[])

Definition at line 589 of file ranlxs.cxx.

References vec_t::c1, vec_t::c2, vec_t::c3, vec_t::c4, error(), pr, rlxs_size(), and x.

590 {
591  int k;
592 
593  if (init==0)
594  error(3);
595 
596  state[0]=rlxs_size();
597 
598  for (k=0;k<96;k++)
599  state[k+1]=x.num[k];
600 
601  state[97]=carry.c1;
602  state[98]=carry.c2;
603  state[99]=carry.c3;
604  state[100]=carry.c4;
605 
606  state[101]=pr;
607  state[102]=ir;
608  state[103]=jr;
609  state[104]=is;
610 }
static int ir
Definition: ranlxs.cxx:372
int c2
Definition: ranlxd.cxx:366
int c4
Definition: ranlxd.cxx:366
static int init
Definition: ranlxd.cxx:374
int rlxs_size(void)
Definition: ranlxs.cxx:583
static int is
Definition: ranlxs.cxx:372
int c3
Definition: ranlxd.cxx:366
static void error(int no)
Definition: ranlxs.cxx:417
static int jr
Definition: ranlxs.cxx:372
static vec_t carry
Definition: ranlxs.cxx:374
int c1
Definition: ranlxd.cxx:366
static int pr
Definition: ranlxs.cxx:372
Double_t x
void rlxs_init ( int  level,
int  seed 
)

Definition at line 495 of file ranlxs.cxx.

References vec_t::c1, vec_t::c2, vec_t::c3, vec_t::c4, define_constants(), error(), i, pr, seed, and x.

496 {
497  int i,k,l;
498  int ibit,jbit,xbit[31];
499  int ix,iy;
500 
501  if ((INT_MAX<2147483647)||(FLT_RADIX!=2)||(FLT_MANT_DIG<24))
502  error(0);
503 
505 
506  if (level==0)
507  pr=109;
508  else if (level==1)
509  pr=202;
510  else if (level==2)
511  pr=397;
512  else
513  error(1);
514 
515  i=seed;
516 
517  for (k=0;k<31;k++)
518  {
519  xbit[k]=i%2;
520  i/=2;
521  }
522 
523  if ((seed<=0)||(i!=0))
524  error(2);
525 
526  ibit=0;
527  jbit=18;
528 
529  for (i=0;i<4;i++)
530  {
531  for (k=0;k<24;k++)
532  {
533  ix=0;
534 
535  for (l=0;l<24;l++)
536  {
537  iy=xbit[ibit];
538  ix=2*ix+iy;
539 
540  xbit[ibit]=(xbit[ibit]+xbit[jbit])%2;
541  ibit=(ibit+1)%31;
542  jbit=(jbit+1)%31;
543  }
544 
545  if ((k%4)==i)
546  ix=16777215-ix;
547 
548  x.num[4*k+i]=ix;
549  }
550  }
551 
552  carry.c1=0;
553  carry.c2=0;
554  carry.c3=0;
555  carry.c4=0;
556 
557  ir=0;
558  jr=7;
559  is=95;
560  is_old=0;
561  prm=pr%12;
562  init=1;
563 }
Int_t i
Definition: run_full.C:25
static int prm
Definition: ranlxs.cxx:372
static int ir
Definition: ranlxs.cxx:372
int c2
Definition: ranlxd.cxx:366
static int is_old
Definition: ranlxs.cxx:372
int c4
Definition: ranlxd.cxx:366
static int init
Definition: ranlxd.cxx:374
static int is
Definition: ranlxs.cxx:372
static void define_constants(void)
Definition: ranlxs.cxx:484
int c3
Definition: ranlxd.cxx:366
static void error(int no)
Definition: ranlxs.cxx:417
static int jr
Definition: ranlxs.cxx:372
unsigned int seed
static vec_t carry
Definition: ranlxs.cxx:374
int c1
Definition: ranlxd.cxx:366
static int pr
Definition: ranlxs.cxx:372
Double_t x
void rlxs_reset ( int  state[])

Definition at line 613 of file ranlxs.cxx.

References vec_t::c1, vec_t::c2, vec_t::c3, vec_t::c4, define_constants(), error(), ir, pr, rlxs_size(), and x.

614 {
615  int k;
616 
617  if ((INT_MAX<2147483647)||(FLT_RADIX!=2)||(FLT_MANT_DIG<24))
618  error(4);
619 
621 
622  if (state[0]!=rlxs_size())
623  error(5);
624 
625  for (k=0;k<96;k++)
626  {
627  if ((state[k+1]<0)||(state[k+1]>=167777216))
628  error(5);
629 
630  x.num[k]=state[k+1];
631  }
632 
633  if (((state[97]!=0)&&(state[97]!=1))||
634  ((state[98]!=0)&&(state[98]!=1))||
635  ((state[99]!=0)&&(state[99]!=1))||
636  ((state[100]!=0)&&(state[100]!=1)))
637  error(5);
638 
639  carry.c1=state[97];
640  carry.c2=state[98];
641  carry.c3=state[99];
642  carry.c4=state[100];
643 
644  pr=state[101];
645  ir=state[102];
646  jr=state[103];
647  is=state[104];
648  is_old=8*ir;
649  prm=pr%12;
650  init=1;
651 
652  if (((pr!=109)&&(pr!=202)&&(pr!=397))||
653  (ir<0)||(ir>11)||(jr<0)||(jr>11)||(jr!=((ir+7)%12))||
654  (is<0)||(is>95))
655  error(5);
656 }
static int prm
Definition: ranlxs.cxx:372
static int ir
Definition: ranlxs.cxx:372
int c2
Definition: ranlxd.cxx:366
static int is_old
Definition: ranlxs.cxx:372
int c4
Definition: ranlxd.cxx:366
static int init
Definition: ranlxd.cxx:374
int rlxs_size(void)
Definition: ranlxs.cxx:583
static int is
Definition: ranlxs.cxx:372
static void define_constants(void)
Definition: ranlxs.cxx:484
int c3
Definition: ranlxd.cxx:366
static void error(int no)
Definition: ranlxs.cxx:417
static int jr
Definition: ranlxs.cxx:372
static vec_t carry
Definition: ranlxs.cxx:374
int c1
Definition: ranlxd.cxx:366
static int pr
Definition: ranlxs.cxx:372
Double_t x
int rlxs_size ( void  )

Definition at line 583 of file ranlxs.cxx.

Referenced by rlxs_get(), and rlxs_reset().

584 {
585  return(105);
586 }