/*Following the functions simulates the caches*/
void direct(Cache modify, size_t addMe){
	modify->memory_access++;
	/*get the necessary bits for each tag, index, block*/
	long long boff=extract(modify->HMblock,0, addMe);
	long long index1=extract(modify->HMindex,modify->HMblock, addMe);
	long long tag1=extract(modify->HMtag,modify->HMindex, addMe);
	long long index=index1 % modify->numofSet;
	if(modify->blocks[index][0].valid==1 && modify->blocks[index][0].tag==tag1){
			/*is it the same tag? Hit, update LRU, return*/
			modify->hits++;
			return;
		}
	if(modify->blocks[index][0].valid==0){
		modify->cold_misses++;
		modify->total_misses++;
		/*call next level and see if they have it*/
		if(modify->nextLevel!=NULL){
			if(strcmp(modify->nextLevel->type, "direct")==0){
				direct(modify->nextLevel, addMe);
			}	
			if((strlen(modify->nextLevel->type)>=7)&&(strncmp(modify->nextLevel->type,"assoc:", 5)==0)){
				//	printf("I came here");
					SA(modify->nextLevel, addMe, modify->nextLevel->assoc);
				}
			if((strlen(modify->nextLevel->type)==5)&& (strcmp(modify->nextLevel->type,"assoc")==0)){
					FA(modify->nextLevel, addMe);
			}
		}
		/*once we're done, add the address' tag, index, off set to the index*/
		modify->blocks[index][0].tag=tag1;
		modify->blocks[index][0].indexSet=index;
		modify->blocks[index][0].offSet=boff;
		modify->blocks[index][0].valid=1;
	}
	/*again, not equal? call the next cache*/
	if(modify->blocks[index][0].valid==1 && modify->blocks[index][0].tag!=tag1){
		if(modify->nextLevel!=NULL){
			if(strcmp(modify->nextLevel->type, "direct")==0){
				direct(modify->nextLevel, addMe);
			}	
			if((strlen(modify->nextLevel->type)>=7)&&(strncmp(modify->nextLevel->type,"assoc:", 5)==0)){
				//	printf("I came here");
					SA(modify->nextLevel, addMe, modify->nextLevel->assoc);
				}
			if((strlen(modify->nextLevel->type)==5)&& (strcmp(modify->nextLevel->type,"assoc")==0)){
					FA(modify->nextLevel, addMe);
				}
			}
		/*once we're done, add the address' tag, index, off set to the index*/
		modify->conflict_miss++;
		modify->total_misses++;
		modify->blocks[index][0].tag=tag1;
		modify->blocks[index][0].indexSet=index;
		modify->blocks[index][0].offSet=boff;
	}
}
/**
*	Top module to extract the whole string into final OpCode
*
* Input:
*	String	instructions,with appropriate arguments
* 
* Return OpCode in int type
*/
unsigned int interpret(String *instruction){
	stringTrimLeft(instruction);
	String *instString = stringRemoveWordNotContaining(instruction," ");
	char *instChar = stringSubstringInChar(instString,0,instString->length);
	instructionTable inst = getInstruction(instChar);
	
	if(inst.type == FDA_TYPE)
		return inst.opCode | FDA(instruction);
	else if(inst.type == FBA_TYPE)
		return inst.opCode | FBA(instruction);
	else if(inst.type == FA_TYPE)
		return inst.opCode | FA(instruction);
	else if(inst.type == FSFD_TYPE)
		return inst.opCode | FSFD(instruction);
	else if(inst.type == N_TYPE)
		return inst.opCode | N(instruction);
	else if(inst.type == NS_TYPE)
		return inst.opCode | NS(instruction);
	else if(inst.type == S_TYPE)
		return inst.opCode | S(instruction);
	else if(inst.type == K_TYPE)
		return inst.opCode | K(instruction);
	else if(inst.type == FK_TYPE)
		return inst.opCode | FK(instruction);
	else
		Throw(ERR_ILLEGAL_ARGUMENT);
}
Beispiel #3
0
TEST(hausdorff, knightVScheburashka) 
{
  Eigen::MatrixXd VA,VB;
  Eigen::MatrixXi FA,FB;
  test_common::load_mesh("decimated-knight.obj", VA, FA);
  test_common::load_mesh("cheburashka.off", VB, FB);
  //typedef CGAL::Epeck Kernel;
  typedef CGAL::Simple_cartesian<double> Kernel;
  CGAL::AABB_tree<
    CGAL::AABB_traits<Kernel, 
      CGAL::AABB_triangle_primitive<Kernel, 
        typename std::vector<CGAL::Triangle_3<Kernel> >::iterator
      >
    >
  > treeB;
  std::vector<CGAL::Triangle_3<Kernel> > TB;
  {
    igl::copyleft::cgal::point_mesh_squared_distance_precompute(VB,FB,treeB,TB);
  }
  std::vector<Eigen::VectorXd> U(5);
  for(int j = 0;j<U.size();j++)
  {
    if(j>0)
    {
      igl::upsample(Eigen::MatrixXd(VA),Eigen::MatrixXi(FA),VA,FA);
    }
    const int m = FA.rows();
    U[j].resize(m);
    for(int i = 0;i<m;i++)
    {
      Eigen::MatrixXd Vi(3,3);
      Vi<<VA.row(FA(i,0)),VA.row(FA(i,1)),VA.row(FA(i,2));
      double l;
      igl::copyleft::cgal::hausdorff(Vi,treeB,TB,l,U[j](i));
      if(j>0&&i%4==3)
      {
        double u4 = std::numeric_limits<double>::infinity();
        for(int u = 0;u<4;u++)
        {
          u4 = std::min(u4,U[j](i-u));
        }
        ASSERT_LE(u4,U[j-1](i/4));
      }
    }
    break;
  }
}
Beispiel #4
0
bool REParser::parse(const QString & str, int em) {
	if(rec) {
		rec->addLine("reparser.fa=FA();");
		rec->addLine(QString("reparser.endmark=%1;").arg(em));
	}
	errmsg="";
	issuemsg="";
	fa=FA();
	buf=str;
	currentchar=-1;
	pos=0;
	endmark=em;
	if(!parse()) {
		fa=FA();
		return false;
	}
	if(issuemsg.length()) {
		fa=FA();
		return false;
	}
	return true;
}
Beispiel #5
0
void test_FA_with_ERR_NO_ARGUMENT_0xff6_should_return_0xf6_and_store_in_ACCESS(void){
	int value;
	int e;
	
	Text *text = textNew("135");
	String *str = stringNew(text);
	
	extractValue_ExpectAndReturn(str, 0xff6);
	extractACCESSBANKED_ExpectAndThrow(str, 4);
	
	value = FA(str);

	TEST_ASSERT_EQUAL_HEX16(value, 0xf6);
}
Beispiel #6
0
void test_FA_should_return_0x34_and_store_in_BANKED(void){
	int value;
	int e;
	
	Text *text = textNew("135");
	String *str = stringNew(text);
	
	extractValue_ExpectAndReturn(str, 0x134);
	extractACCESSBANKED_ExpectAndReturn(str, 1);
	
	value = FA(str);

	TEST_ASSERT_EQUAL_HEX16(value, 0x134);
}
void QmitkDiffusionQuantificationView::CreateConnections()
{
    if ( m_Controls )
    {
        connect( (QObject*)(m_Controls->m_StandardGFACheckbox), SIGNAL(clicked()), this, SLOT(GFACheckboxClicked()) );
        connect( (QObject*)(m_Controls->m_GFAButton), SIGNAL(clicked()), this, SLOT(GFA()) );
        connect( (QObject*)(m_Controls->m_CurvatureButton), SIGNAL(clicked()), this, SLOT(Curvature()) );
        connect( (QObject*)(m_Controls->m_FAButton), SIGNAL(clicked()), this, SLOT(FA()) );
        connect( (QObject*)(m_Controls->m_RAButton), SIGNAL(clicked()), this, SLOT(RA()) );
        connect( (QObject*)(m_Controls->m_ADButton), SIGNAL(clicked()), this, SLOT(AD()) );
        connect( (QObject*)(m_Controls->m_RDButton), SIGNAL(clicked()), this, SLOT(RD()) );
        connect( (QObject*)(m_Controls->m_MDButton), SIGNAL(clicked()), this, SLOT(MD()) );
        connect( (QObject*)(m_Controls->m_ClusteringAnisotropy), SIGNAL(clicked()), this, SLOT(ClusterAnisotropy()) );
    }
}
Beispiel #8
0
int sc_main(int argc, char* argv[]) {
    sc_signal<sc_lv<1>> X_in,Y_in,Ci_in;
    sc_signal<sc_lv<1>> S_out,C_out;

    sc_clock CLK("clock",10,SC_NS);

    fullAdder FA("FA");
    FA(X_in,Y_in,Ci_in,S_out,C_out);

    test TEST("TEST");
    TEST(CLK,X_in,Y_in,Ci_in,S_out,C_out);

    sc_trace_file *tf = sc_create_vcd_trace_file("wave");
    sc_trace(tf,CLK,"clock");
    sc_trace(tf,X_in,"X_in");
    sc_trace(tf,Y_in,"Y_in");
    sc_trace(tf,Ci_in,"Ci_in");
    sc_trace(tf,S_out,"S_out");
    sc_trace(tf,C_out,"C_out");

    sc_start(80, SC_NS);
    sc_close_vcd_trace_file(tf);
    return(0);
}
Beispiel #9
0
void test_FA_operand1_empty_value_should_mock_and_throw_error(void){
	int value;
	int e;
	
	Text *text = textNew("135");
	String *str = stringNew(text);
	
	extractValue_ExpectAndThrow(str, 3);
	
	Try{
		value = FA(str);
	}Catch(e){
		TEST_ASSERT_EQUAL(ERR_EMPTY_ARGUMENT, e);
		
	}
}
void SingleSlater<dcomplex>::CDIIS() {
    int N = this->lenCoeff_;
    ComplexMatrix B(N,N);
    dcomplex *coef = new dcomplex[N];
    int    *iPiv = new int[N];
    int    NRHS = 1, INFO = -1;
    int NBSq = this->nBasis_*this->nBasis_*this->nTCS_*this->nTCS_;
    for(auto j = 0; j < (N-1); j++)
        for(auto k = 0; k <= j          ; k++) {
            ComplexMap EJA(this->ErrorAlphaMem_ + (j%(N-1))*NBSq,this->nTCS_*this->nBasis_,this->nTCS_*this->nBasis_);
            ComplexMap EKA(this->ErrorAlphaMem_ + (k%(N-1))*NBSq,this->nTCS_*this->nBasis_,this->nTCS_*this->nBasis_);
            B(j,k) = -EJA.frobInner(EKA);
            if(!this->isClosedShell && this->Ref_ != TCS) {
                ComplexMap EJB(this->ErrorBetaMem_ + (j%(N-1))*NBSq,this->nBasis_,this->nBasis_);
                ComplexMap EKB(this->ErrorBetaMem_ + (k%(N-1))*NBSq,this->nBasis_,this->nBasis_);
                B(j,k) += -EJB.frobInner(EKB);
            }
            B(k,j) = B(j,k);
        }
    for (auto l=0; l<N-1; l++) {
        B(N-1,l)=-1.0;
        B(l,N-1)=-1.0;
    }
    B(N-1,N-1)=0;
    for(auto k = 0; k < N; k++) coef[k] = 0.0;
    coef[N-1]=-1.0;
    /*
      zgesv_(&N,&NRHS,B.data(),&N,iPiv,coef,&N,&INFO);
    */
    ComplexVecMap COEFF(coef,N);
    VectorXcd     RHS(COEFF);
    COEFF = B.fullPivLu().solve(RHS);

    this->fockA_->setZero();
    if(!this->isClosedShell && this->Ref_ != TCS) this->fockB_->setZero();
    for(auto j = 0; j < N-1; j++) {
        ComplexMap FA(this->FADIIS_ + (j%(N-1))*NBSq,this->nTCS_*this->nBasis_,this->nTCS_*this->nBasis_);
        *this->fockA_ += coef[j]*FA;
        if(!this->isClosedShell && this->Ref_ != TCS) {
            ComplexMap FB(this->FBDIIS_ + (j%(N-1))*NBSq,this->nBasis_,this->nBasis_);
            *this->fockB_ += coef[j]*FB;
        }
    }
    delete [] coef;
    delete [] iPiv;

} // CDIIS
Beispiel #11
0
void test_FA_operand2_ERR_ILLEGAL_ARGUMENT_should_mock_and_throw_error(void){
	int value;
	int e;
	
	Text *text = textNew("135");
	String *str = stringNew(text);
	
	extractValue_ExpectAndReturn(str, 0x35);
	extractACCESSBANKED_ExpectAndThrow(str, 2);
	
	Try{
		value = FA(str);
	}Catch(e){
		TEST_ASSERT_EQUAL(ERR_ILLEGAL_ARGUMENT, e);
		
	}
}
Beispiel #12
0
Double_t TT_params::H2(Double_t q2)
{
  Double_t tau=-q2/(4.0*f_M*f_M);
  return pow(FA(q2),2) + pow(F1(q2),2) + tau*pow(F2(q2),2);
}
Beispiel #13
0
Datei: FH.C Projekt: elaird/nuqe
Double_t H4(Double_t q2,Double_t M) {
  Double_t tau=-q2/(4.0*M*M);
  return pow(F2(q2,M),2)*(1-tau)/4.0 + F1(q2,M)*F2(q2,M)/2.0 + FA(q2)*FP(q2,M) - tau*pow(FP(q2,M),2);
}
Beispiel #14
0
Datei: FH.C Projekt: elaird/nuqe
Double_t H3(Double_t q2,Double_t M) {
  return 2*FA(q2)*(F1(q2,M)+F2(q2,M));
}
Beispiel #15
0
Datei: FH.C Projekt: elaird/nuqe
Double_t H2(Double_t q2,Double_t M) {
  Double_t tau=-q2/(4.0*M*M);
  return pow(FA(q2),2) + pow(F1(q2,M),2) + tau*pow(F2(q2,M),2);
}
Beispiel #16
0
Datei: FH.C Projekt: elaird/nuqe
Double_t H1(Double_t q2,Double_t M) {
  Double_t tau=-q2/(4.0*M*M);
  return pow(FA(q2),2)*(1+tau) + tau*pow(F1(q2,M)+F2(q2,M),2);
}
Beispiel #17
0
Datei: FH.C Projekt: elaird/nuqe
Double_t FP(Double_t q2,Double_t M) {
  const Double_t Mpi=0.13957;
  return 2*M*M*FA(q2)/(Mpi*Mpi-q2);
}
int main(int argc, char **argv)
{   
    FILE *in, *out_count;
    FLOAT1 *eigen1, *eigen2, *eigen3;
    FLOAT2 *delta;
    char filename[100];
    int eig;
    
    float delta_min, delta_max, FA_min, FA_max;
    int N_FA, N_delta, i_lm, i_fa;
    float count[NMAX1][NMAX1];
    float fa, d, fa_f, d_f, fa_i, d_log;
    
    //Grid variables===============================================================================
    int dumb;
    char line[30];
    long long i;
    int n_x, n_y, n_z;
    int n_nodes;
    long long n_total;
    float dx, dy, dz, x_0, y_0, z_0;
    //=============================================================================================
    
    
    //PARAMETERS===================================================================================
    //Lambdas Range
    delta_min = atof( argv[3] );
    delta_min = log10(delta_min+1);
    delta_max = atof( argv[4] );
    delta_max = log10(delta_max+1);
    //Number of divisions in Lambda
    N_delta = atoi( argv[5] );
    //FA Range
    FA_min = atof( argv[6] );
    FA_max = atof( argv[7] );
    //Number of divisions in FA
    N_FA = atoi( argv[8] );
    //=============================================================================================
        
        
    //LOADING EIGENVALUES==========================================================================
    for( eig=0; eig<3; eig++ ){
        //filename of current eigenvalue
 	sprintf(filename, "%s_%d", argv[1], eig + 1);
	if(!(in=fopen(filename, "r"))){
	    fprintf(stderr, "Problem opening file %s\n", filename);
	    exit(1);}
	fread(&dumb,sizeof(int),1,in);
	fread(line,sizeof(char)*30,1,in);
	fread(&dumb,sizeof(int),1,in);
	fread(&dumb,sizeof(int),1,in);
	fread(&n_x,sizeof(int),1,in);    
	fread(&n_y,sizeof(int),1,in);    
	fread(&n_z,sizeof(int),1,in);    
	fread(&n_nodes,sizeof(int),1,in);    
	fread(&x_0,sizeof(float),1,in);    
	fread(&y_0,sizeof(float),1,in);    
	fread(&z_0,sizeof(float),1,in);    
	fread(&dx,sizeof(float),1,in);    
	fread(&dy,sizeof(float),1,in);    
	fread(&dz,sizeof(float),1,in);    
	fread(&dumb,sizeof(int),1,in);
	n_total = n_x * n_y * n_z;
/*	fprintf(stderr, "Nx Ny Nz : %d %d %d %lld\n", n_x, n_y, n_z, n_total);
	fprintf(stderr, "x_0 y_0 z_0 : %g %g %g\n", x_0, y_0, z_0);
	fprintf(stderr, "dx dy dz : %g %g %g\n", dx, dy, dz);  */  
	
	//First Eigenvalue
	if(eig == 0){
	    if(!(eigen1=malloc(n_nodes * sizeof(FLOAT1)))){
		fprintf(stderr, "problem with array allocation\n");
		exit(1);}
	    fread(&dumb,sizeof(int),1,in);
	    fread(&(eigen1[0]),sizeof(FLOAT1), n_total, in);
	    fread(&dumb,sizeof(int),1,in);}
	//Second Eigenvalue
	if(eig == 1){
	    if(!(eigen2=malloc(n_nodes * sizeof(FLOAT1)))){
		fprintf(stderr, "problem with array allocation\n");
		exit(1);}
	    fread(&dumb,sizeof(int),1,in);
	    fread(&(eigen2[0]),sizeof(FLOAT1), n_total, in);
	    fread(&dumb,sizeof(int),1,in);}
	//Third Eigenvalue
	if(eig == 2){
	    if(!(eigen3=malloc(n_nodes * sizeof(FLOAT1)))){
		fprintf(stderr, "problem with array allocation\n");
		exit(1);}
	    fread(&dumb,sizeof(int),1,in);
	    fread(&(eigen3[0]),sizeof(FLOAT1), n_total, in);
	    fread(&dumb,sizeof(int),1,in);}
	fclose(in);}
	
    //LOADING DENSITY FIELD========================================================================
    sprintf(filename, "%s", argv[2]);
    if(!(in=fopen(filename, "r"))){
	fprintf(stderr, "Problem opening file %s\n", filename);
	exit(1);}
    fread(&dumb,sizeof(int),1,in);
    fread(line,sizeof(char)*30,1,in);
    fread(&dumb,sizeof(int),1,in);
    fread(&dumb,sizeof(int),1,in);
    fread(&n_x,sizeof(int),1,in);    
    fread(&n_y,sizeof(int),1,in);    
    fread(&n_z,sizeof(int),1,in);    
    fread(&n_nodes,sizeof(int),1,in);    
    fread(&x_0,sizeof(float),1,in);    
    fread(&y_0,sizeof(float),1,in);    
    fread(&z_0,sizeof(float),1,in);    
    fread(&dx,sizeof(float),1,in);    
    fread(&dy,sizeof(float),1,in);    
    fread(&dz,sizeof(float),1,in);    
    fread(&dumb,sizeof(int),1,in);
    n_total = n_x * n_y * n_z;
/*    fprintf(stderr, "Nx Ny Nz : %d %d %d %lld\n", n_x, n_y, n_z, n_total);
    fprintf(stderr, "x_0 y_0 z_0 : %g %g %g\n", x_0, y_0, z_0);
    fprintf(stderr, "dx dy dz : %g %g %g\n", dx, dy, dz); */   
    
    //Loading densities
    if(!(delta=malloc(n_nodes * sizeof(FLOAT2)))){
	fprintf(stderr, "problem with array allocation\n");
	exit(1);}
    fread(&dumb,sizeof(int),1,in);
    fread(&(delta[0]),sizeof(FLOAT2), n_total, in);
    fread(&dumb,sizeof(int),1,in);

    //Initializing counters
    for( i_lm=0; i_lm<N_delta; i_lm++ )
	for( i_fa=0; i_fa<N_FA; i_fa++ )
	    count[i_lm][i_fa] = 0.0;
	
    for( i=0; i<n_total; i++ ){
	fa_i = FA( eigen1[i], eigen2[i], eigen3[i] );
	for( i_lm=0; i_lm<N_delta; i_lm++ ){	    
	    //current lambda bin
	    d = delta_min+ + (delta_max-delta_min)*i_lm/N_delta;
	    //Next lambda bin
	    d_f = delta_min+ + (delta_max-delta_min)*(i_lm+1)/N_delta;
	    d_log = log10(delta[i]+1);
	    if( d_log>=d && d_log<d_f ){
		for( i_fa=0; i_fa<N_FA; i_fa++ ){
		    //current fa bin
		    fa = FA_min + (FA_max-FA_min)*i_fa/N_FA;
		    //Next fa bin
		    fa_f = FA_min + (FA_max-FA_min)*(i_fa+1)/N_FA;
		    //If the current cell is within such void
		    if( fa_i>=fa && fa_i<fa_f ){
			count[i_lm][i_fa] ++;
			break;}}
		break;}}}

	    
    //File Head
    out_count = fopen("temp.tmp", "w");
    for( i_lm=0; i_lm<N_delta; i_lm++ ){
	for( i_fa=0; i_fa<N_FA; i_fa++ )
	    fprintf( out_count, "%1.5e\t", count[i_lm][i_fa] );
	fprintf( out_count,"\n" );}
	
    fclose(out_count);	
    //=============================================================================================
    return 0;
}
Beispiel #19
0
void test_solver(BfmSolver solver,LatticeFermion &src)
{

  g5dParams parms;

  int Ls=8;
  double M5=1.8;
  double mq=0.01;
  double wilson_lo = 0.05;
  double wilson_hi = 6.8;
  double shamir_lo = 0.025;
  double shamir_hi = 1.7;
  double ht_scale=2.0;
  double hw_scale=1.0;

  if ( solver == HtCayleyTanh ) { 
    Printf("Testing HtCayleyTanh aka DWF\n");
    parms.ShamirCayleyTanh(mq,M5,Ls);
  } else if ( solver == HmCayleyTanh ) { 
    parms.ScaledShamirCayleyTanh(mq,M5,Ls,ht_scale);
    Printf("Testing HmCayleyTanh Moebius\n");
  } else if ( solver == HwCayleyTanh ) { 
    parms.WilsonCayleyTanh(mq,M5,Ls,hw_scale);
    Printf("Testing HwCayleyTanh aka Borici\n");
  } else { 
    exit(-1);
  }

  multi1d<LatticeColorMatrix> u(4);
  HotSt(u);

  multi1d<LatticeFermion> X(Ls);
  multi1d<LatticeFermion> Y(Ls);
  for(int s=0;s<Ls;s++){
    gaussian(X[s]);
    gaussian(Y[s]);
  }

  multi1d<LatticeColorMatrix> Fb(4);
  multi1d<LatticeColorMatrix> F (4);

  int lx = QDP::Layout::subgridLattSize()[0];
  int ly = QDP::Layout::subgridLattSize()[1];
  int lz = QDP::Layout::subgridLattSize()[2];
  int lt = QDP::Layout::subgridLattSize()[3];

  multi1d<int> procs = QDP::Layout::logicalSize();
  /********************************************************
   * Setup DWF operator
   ********************************************************
   */
  bfmarg  dwfa;
  dwfa.node_latt[0]  = lx;
  dwfa.node_latt[1]  = ly;
  dwfa.node_latt[2]  = lz;
  dwfa.node_latt[3]  = lt;
  for(int mu=0;mu<4;mu++){
    if ( procs[mu]>1 ) {
      dwfa.local_comm[mu] = 0;
    } else { 
      dwfa.local_comm[mu] = 1;
    }
  }

  bfm_qmp dwf_qmp;

  dwfa.mass = parms.mass;
  dwfa.M5   = parms.M5;
  dwfa.Csw = 0.0;
  dwfa.precon_5d=0;
  dwfa.residual=1.0e-5;
  dwfa.max_iter=5000;
  dwfa.Ls = parms.Ls;
  dwfa.solver= parms.solver;
  dwfa.zolo_lo   = parms.zolo_lo;
  dwfa.zolo_hi   = parms.zolo_hi;
  dwfa.mobius_scale = parms.mobius_scale;

  dwf_qmp.init(dwfa);
  dwf_qmp.importGauge(u);

  Fermion_t X_t;
  Fermion_t Y_t;
  Matrix_t  Force_t[2];

  X_t     = dwf_qmp.allocFermion();
  Y_t     = dwf_qmp.allocFermion();
  for(int cb=0;cb<2;cb++){
    Force_t[cb] = dwf_qmp.allocMatrix();
    printf("Force_t pointer %lx\n",Force_t[cb]);
  }


  multi1d<int> bcs(Nd); bcs[0] = bcs[1] = bcs[2] = bcs[3] = 1;
  Handle<FermBC<T,U,U> > fbc(new SimpleFermBC< T, U, U >(bcs));
  Handle<CreateFermState<T,U,U> > cfs( new CreateSimpleFermState<T,U,U>(fbc));
  Handle<FermState<T,U,U> > fs ((*cfs)(u));


  //! Params for NEFF
  EvenOddPrecKNOFermActArrayParams kparams;

  Real scale = dwf_qmp.mobius_scale;
  kparams.OverMass = dwf_qmp.M5;
  kparams.Mass     = dwf_qmp.mass;
  kparams.a5       = 1.0;
  kparams.coefs.resize(Ls);
  for(int s=0;s<Ls;s++)
    kparams.coefs[s] = scale;
  kparams.N5       = dwf_qmp.Ls;

  EvenOddPrecKNOFermActArray FA(cfs,kparams);
  Handle< DiffLinearOperatorArray<Phi,P,Q> > M(FA.linOp(fs));
  
  for( int dag=0;dag<2;dag++){

    Fb=zero;
    F=zero;

    dwf_qmp.importFermion(X,X_t,1);
    dwf_qmp.importFermion(Y,Y_t,1);

    dwf_qmp.zeroMatrix(Force_t[0]);
    dwf_qmp.zeroMatrix(Force_t[1]);


    dwf_qmp.MprecDeriv(X_t,Y_t,Force_t,dag);

    for(int cb=0;cb<2;cb++)
      dwf_qmp.exportForce(Force_t[cb],Fb,cb);
    
    Printf("Calling S_f deriv\n");
    if( dag==1 ) 
      M->deriv(F, X, Y, MINUS);
    else
      M->deriv(F, X, Y, PLUS);
      
    for(int mu=0;mu<4;mu++){
      QDPIO::cout << "dag "<< dag<<"mu "<<mu<<" n2diff " << norm2(Fb[mu]-F[mu])<<endl;
    }

#if 0
    QDPIO::cout << "Calling force term" << endl;
    dwf_qmp.zeroMatrix(Force_t[0]);
    dwf_qmp.zeroMatrix(Force_t[1]);
    dwf_qmp.TwoFlavorRatioForce(X_t,Force_t,1.0,dwf_qmp.mass);
    for(int cb=0;cb<2;cb++)
      dwf_qmp.exportForce(Force_t[cb],Fb,cb);
    for(int mu=0;mu<4;mu++){
      QDPIO::cout << "dag "<< dag<<"mu "<<mu<<" TwoFlavorForce " << norm2(Fb[mu])<<endl;
    }
#endif

    //    { 
    // EvenOddPrecConstDetTwoFlavorRatioConvConvWilsonTypeFermMonomial5D Monomial();
    //    }

  }

    dwf_qmp.freeMatrix(Force_t[0]);
    dwf_qmp.freeMatrix(Force_t[1]);
    exit(0);


}
Beispiel #20
0
Double_t TT_params::FP(Double_t q2)
{
  return 2*f_M*f_M*FA(q2)/(f_Mpi*f_Mpi-q2);
}
Beispiel #21
0
void FA(Cache modify, size_t addMe){
	int index2;
	modify->memory_access++;
	long long boff=extract(modify->HMblock,0, addMe);
	long long tag1=extract(modify->HMtag,modify->HMblock, addMe);
	for (int j=0;j<modify->numofSet; j++){
		if(modify->blocks[j][0].valid==1 && modify->blocks[j][0].tag==tag1){
			/*is it the same tag? Hit, update LRU, return*/
			if(modify->LRU!=NULL){
				SLInsert(modify->LRU, j);
				modify->hits++;
				return;
			}
			else{
				/*do nothing to fifo*/
				modify->hits++;
				return;
			}
		}
		if(modify->blocks[j][0].valid==0){
			if(modify->nextLevel!=NULL){
				if(strcmp(modify->nextLevel->type, "direct")==0){
					direct(modify->nextLevel, addMe);
				}	
					if((strlen(modify->nextLevel->type)>=7)&&(strncmp(modify->nextLevel->type,"assoc:", 5)==0)){
					//	printf("I came here");
						SA(modify->nextLevel, addMe, modify->nextLevel->assoc);
					}
					if((strlen(modify->nextLevel->type)==5)&& (strcmp(modify->nextLevel->type,"assoc")==0)){
						FA(modify->nextLevel, addMe);
					}
			}
		
			modify->cold_misses++;
			modify->total_misses++;
			/*updates the queue or DLL*/
			if(modify->LRU!=NULL){
				SLInsert(modify->LRU, j);
			}
			else{
				enqueue(modify->FIFO,j);
			}
			//printf("%d", j);
			modify->blocks[j][0].tag=tag1;
			modify->blocks[j][0].offSet=boff;
			modify->blocks[j][0].valid=1;
		//	printf("\nj is at %d\n", j);
			return;
		}

		if(modify->blocks[j][0].valid==1 &&modify->blocks[j][0].tag!=tag1
			&& j==(modify->numofSet-1)){
				if(modify->nextLevel!=NULL){
				if(strcmp(modify->nextLevel->type, "direct")==0){
					direct(modify->nextLevel, addMe);
				}	
				if((strlen(modify->nextLevel->type)>=7)&&(strncmp(modify->nextLevel->type,"assoc:", 5)==0)){
					//	printf("I came here");
						SA(modify->nextLevel, addMe, modify->nextLevel->assoc);
					}
				if((strlen(modify->nextLevel->type)==5)&& (strcmp(modify->nextLevel->type,"assoc")==0)){
						FA(modify->nextLevel, addMe);
					}
			}
		//		printf("sadI came here %d\n", j);
				/*it's full. Call LRU*/
				modify->total_misses++;
				if(modify->LRU!=NULL){
					index2=getLRU(modify->LRU);}
				else{
					index2=dequeue(modify->FIFO);
				}
			//	printf("\n num: %d\n", index2);
				modify->blocks[index2][0].tag=tag1;
				modify->blocks[index2][0].offSet=boff;
				if(modify->LRU!=NULL){
					SLInsert(modify->LRU, index2);
				}
				else{
					enqueue(modify->FIFO,index2);
				}
				return;
		}
	}
}
Beispiel #22
0
Double_t TT_params::H3(Double_t q2)
{
  return 2.0*FA(q2)*(F1(q2)+F2(q2));
}
Beispiel #23
0
    SA(ps.pmove.velocity, 3),
    B(ps.pmove.pm_flags),
    B(ps.pmove.pm_time),
    S(ps.pmove.gravity),
    SA(ps.pmove.delta_angles, 3),

    V(ps.viewangles),
    V(ps.viewoffset),
    V(ps.kick_angles),

    V(ps.gunangles),
    V(ps.gunoffset),
    I(ps.gunindex),
    I(ps.gunframe),

    FA(ps.blend, 4),

    F(ps.fov),

    I(ps.rdflags),

    SA(ps.stats, MAX_STATS),

    SZ(pers.userinfo, MAX_INFO_STRING),
    SZ(pers.netname, 16),
    I(pers.hand),

    I(pers.connected),

    I(pers.health),
    I(pers.max_health),
Beispiel #24
0
Double_t TT_params::H4(Double_t q2)
{
  Double_t tau=-q2/(4.0*f_M*f_M);
  return pow(F2(q2),2)*(1-tau)/4.0 + F1(q2)*F2(q2)/2.0 + FA(q2)*FP(q2) - tau*pow(FP(q2),2);
}