/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/Phokhara/Phokhara-00-00-14/Phokhara/ranlxd.h File Reference

Go to the source code of this file.

Functions

void ranlxd (double r[], int n)
void rlxd_init (int level, int seed)
int rlxd_size (void)
void rlxd_get (int state[])
void rlxd_reset (int state[])


Function Documentation

void ranlxd ( double  r[],
int  n 
)

Definition at line 563 of file ranlxd.c.

References rlxd_init(), update(), and x.

00564 {
00565    int k;
00566 
00567    if (init==0)
00568       rlxd_init(0,1);
00569 
00570    for (k=0;k<n;k++) 
00571    {
00572       is=next[is];
00573       if (is==is_old)
00574          update();
00575       r[k]=one_bit*((double)(x.num[is+4])+one_bit*(double)(x.num[is]));      
00576    }
00577 }

void rlxd_get ( int  state[]  ) 

Definition at line 586 of file ranlxd.c.

References vec_t::c1, vec_t::c2, vec_t::c3, vec_t::c4, carry, ers::error, pr, rlxd_size(), and x.

00587 {
00588    int k;
00589 
00590    if (init==0)
00591       error(3);
00592 
00593    state[0]=rlxd_size();
00594 
00595    for (k=0;k<96;k++)
00596       state[k+1]=x.num[k];
00597 
00598    state[97]=carry.c1;
00599    state[98]=carry.c2;
00600    state[99]=carry.c3;
00601    state[100]=carry.c4;
00602 
00603    state[101]=pr;
00604    state[102]=ir;
00605    state[103]=jr;
00606    state[104]=is;
00607 }

void rlxd_init ( int  level,
int  seed 
)

Definition at line 493 of file ranlxd.c.

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

00494 {
00495    int i,k,l;
00496    int ibit,jbit,xbit[31];
00497    int ix,iy;
00498 
00499    if ((INT_MAX<2147483647)||(FLT_RADIX!=2)||(FLT_MANT_DIG<24)||
00500        (DBL_MANT_DIG<48))
00501       error(0);
00502 
00503    define_constants();
00504    
00505    if (level==1)
00506       pr=202;
00507    else if (level==2)
00508       pr=397;
00509    else
00510       error(1);
00511    
00512    i=seed;
00513 
00514    for (k=0;k<31;k++) 
00515    {
00516       xbit[k]=i%2;
00517       i/=2;
00518    }
00519 
00520    if ((seed<=0)||(i!=0))
00521       error(2);
00522 
00523    ibit=0;
00524    jbit=18;
00525 
00526    for (i=0;i<4;i++)
00527    {
00528       for (k=0;k<24;k++)
00529       {
00530          ix=0;
00531 
00532          for (l=0;l<24;l++) 
00533          {
00534             iy=xbit[ibit];
00535             ix=2*ix+iy;
00536          
00537             xbit[ibit]=(xbit[ibit]+xbit[jbit])%2;
00538             ibit=(ibit+1)%31;
00539             jbit=(jbit+1)%31;
00540          }
00541 
00542          if ((k%4)!=i)
00543             ix=16777215-ix;
00544 
00545          x.num[4*k+i]=ix;
00546       }
00547    }
00548 
00549    carry.c1=0;
00550    carry.c2=0;
00551    carry.c3=0;
00552    carry.c4=0;
00553 
00554    ir=0;
00555    jr=7;
00556    is=91;
00557    is_old=0;
00558    prm=pr%12;
00559    init=1;
00560 }

void rlxd_reset ( int  state[]  ) 

Definition at line 610 of file ranlxd.c.

References vec_t::c1, vec_t::c2, vec_t::c3, vec_t::c4, carry, define_constants(), ers::error, pr, rlxd_size(), and x.

00611 {
00612    int k;
00613 
00614    if ((INT_MAX<2147483647)||(FLT_RADIX!=2)||(FLT_MANT_DIG<24)||
00615        (DBL_MANT_DIG<48))
00616       error(4);
00617 
00618    define_constants();
00619 
00620    if (state[0]!=rlxd_size())
00621       error(5);
00622 
00623    for (k=0;k<96;k++)
00624    {
00625       if ((state[k+1]<0)||(state[k+1]>=167777216))
00626          error(5);
00627 
00628       x.num[k]=state[k+1];
00629    }
00630 
00631    if (((state[97]!=0)&&(state[97]!=1))||
00632        ((state[98]!=0)&&(state[98]!=1))||
00633        ((state[99]!=0)&&(state[99]!=1))||
00634        ((state[100]!=0)&&(state[100]!=1)))
00635       error(5);
00636    
00637    carry.c1=state[97];
00638    carry.c2=state[98];
00639    carry.c3=state[99];
00640    carry.c4=state[100];
00641 
00642    pr=state[101];
00643    ir=state[102];
00644    jr=state[103];
00645    is=state[104];
00646    is_old=8*ir;
00647    prm=pr%12;
00648    init=1;
00649    
00650    if (((pr!=202)&&(pr!=397))||
00651        (ir<0)||(ir>11)||(jr<0)||(jr>11)||(jr!=((ir+7)%12))||
00652        (is<0)||(is>91))
00653       error(5);
00654 }

int rlxd_size ( void   ) 

Definition at line 580 of file ranlxd.c.

00581 {
00582    return(105);
00583 }


Generated on Tue Nov 29 23:16:02 2016 for BOSS_7.0.2 by  doxygen 1.4.7