void init_cpu_time(void) { top1(); top2(); _temps_residuel = 1000000L * _t2.tv_sec + _t2.tv_usec - (1000000L * _t1.tv_sec + _t1.tv_usec ); }
int sc_main (int argc , char *argv[]) { srand(time(NULL)); top top1("Top1"); sc_start(10, SC_US); return 0; };
void MetalStyle::drawMetalFrame( QPainter *p, int x, int y, int w, int h ) const { QColor top1("#878769691515"); QColor top2("#C6C6B4B44949"); QColor bot2("#70705B5B1414"); QColor bot1("#56564A4A0E0E"); //first from the bottom int x2 = x + w - 1; int y2 = y + h - 1; //frame: p->setPen( top1 ); p->drawLine( x, y2, x, y ); p->drawLine( x, y, x2-1, y ); p->setPen( top2 ); p->drawLine( x+1, y2 -1, x+1, y+1 ); p->drawLine( x+1, y+1 , x2-2, y+1 ); p->setPen( bot1 ); p->drawLine( x+1, y2, x2, y2 ); p->drawLine( x2, y2, x2, y ); p->setPen( bot2 ); p->drawLine( x+1, y2-1, x2-1, y2-1 ); p->drawLine( x2-1, y2-1, x2-1, y+1 ); }
int sc_main (int argc , char *argv[]) { top top1("Top1"); sc_start(); return 0; }
int main(int argc, char **argv) { try { // write std::map<std::string, int> m = { {"a",1}, {"b",2} }; std::map<std::string, std::vector<double>> mv = { {"a",{1.0, 2.0}}, {"b",{2.0, 3.0, 4.0}} }; { h5::file file1("test_map.h5", H5F_ACC_TRUNC); h5::group top1(file1); h5_write(top1, "map_int", m); h5_write(top1, "map_vec", mv); } // read std::map<std::string, int> mm = { {"c",1} }; std::map<std::string, std::vector<double>> mmv = { {"c",{1.0}} }; h5::file file2("test_map.h5", H5F_ACC_RDONLY); h5::group top2(file2); h5_read(top2, "map_int", mm); h5_read(top2, "map_vec", mmv); for (auto const & val: mm) std::cout << val.first << " " << val.second << std::endl; for (auto const & val: mmv) { std::cout << val.first << std::endl; for (auto const & x: val.second) std::cout << x << std::endl; } } TRIQS_CATCH_AND_ABORT; }
void ll_recovery(void) { /*let 's' be the parse stack, 'a' be the current input token*/ while(parse_error(top(s), a)) { if(top(s) ∈ x) { /*top1 peeks at top(pop(s))*/ if(parse_error(top1(s), a) && ! (a ∈ header_set)) scanner(a); /*skip current token*/ else /*remove top stack symbol*/ pop(s); } else { /*top(s) ∈ y */ if(top(s)==SCANEOF) scanner(&a); /*never skip past end maker*/ else pop(s); /*match expected terminal*/ /*then, try again*/ } } }
int sc_main (int, char*[]) { top top1("Top1"); sc_start(); return 0; }
int sc_main(int argc, char **argv) { top top1("top1"); sc_start(); return 0; }
int sc_main (int argc , char *argv[]) { // instantiate top top top1("Top1"); // tracing of signals ... // sc_start sc_start (); return 0; };
int sc_main(int argc, char* argv[]) { int size = (argc > 1) ? atoi(argv[1]) : 10; size = (size > 100000) ? 100000 : size; size = (size < 1) ? 1 : size; top top1("top1", size); sc_core::sc_start(); sc_core::sc_stop(); return 0; }
int sc_main(int argc, char **argv) { MPI_Init (&argc, &argv); top top1("top1"); sc_start(); MPI_Finalize(); return 0; }
int sc_main (int argc , char *argv[]) { int size = 10; if (argc > 1) size = atoi(argv[1]); if (size < 1) size = 1; if (size > 100000) size = 100000; top top1("Top1", size); sc_start(10,SC_US); return 0; }
bool TopologicalGraph::CheckSimple() {if(debug())DebugPrintf(" CheckSimple"); if(Set().exist(PROP_SIMPLE))return true; if(ne() <= 1){Prop1<int> simple(Set(),PROP_SIMPLE);return true;} if(debug())DebugPrintf("Executing CheckSimple"); if(!CheckNoLoops())return false; svector<tedge>link(1,ne()); link.clear(); link.SetName("CheckSimple:link"); svector<tedge>top1(1,nv()); top1.clear(); top1.SetName("CheckSimple:link"); svector<tedge>top2(1,nv()); top2.clear(); top2.SetName("CheckSimple:link"); tvertex u,v,w; tedge e,next; //First sort with respect to biggest label for(e = ne();e >= 1;e--) {v = (vin[e] < vin[-e]) ? vin[-e] : vin[e]; link[e] = top1[v];top1[v] = e; } // Then sort with respect to smallest label for(u = nv();u > 1;u--) {e = top1[u]; while(e!=0) {next = link[e]; //as link is modified v = (vin[e] < vin[-e]) ? vin[e] : vin[-e]; link[e] = top2[v]; top2[v] = e; e = next; } } // Check Multiple edges for(v = nv()-1;v >= 1;v--) {e = top2[v]; while(e!=0) {next = link[e]; u = vin[e]; if(u == v)u = vin[-e]; w = vin[next]; if(w == v)w = vin[-next]; if(u == w) return false; else link[e] = 0; e = next; } } Prop1<int> simple(Set(),PROP_SIMPLE); return true; }
int main() { char res; int z; player lista = NULL; // Ponteiro de lista lista=recupera(lista); // recupera a lista dos jogadores do momento em que encerrou o jogo do{ do{ z = menu(); switch(z){ case 1:lista=novoJogo(lista);break; case 2:lista=carregarjogo(lista);break; case 3:lista=jogadores(lista);break; case 4:instrucoes();break; case 5:top1(lista);break; } }while(z!=6); do{ titulo(); imgJogo(); printf("\t Tem a certeza que pretende sair?\n\n\t\t sim[s]\tnao[n] \n\t\t\t "); res = getchar(); if(res == 's') { titulo(); printf("\n\n\n\n\n\t\t\t Made by:\n\n\t Rodolfo Lima 21170826 & Ricardo Dinis 21170949\n\n\n\n\n\t\tIsec 2010\\2011 Cadeira:Programacao\n\n\n"); grava_ficheiro(lista); // grava a lista dos jogadores antes de encerrar o jogo getchar(); return 0; } }while(res != 's' && res != 'n'); }while(res != 's'); }
int sc_main(int argc, char *argv[]) { sc_signal<int> s1, s2; sc_clock clk("c1", 1, SC_NS); top top1("Top1"); top1.clk(clk); top1.input(s1); top1.output(s2); stimulus sti1("stimulus1"); sti1.clk(clk); sti1.x(s1); monitor mon1("monitor1"); mon1.clk(clk); mon1.z(s2); sc_start(20, SC_NS); return 0; }
int sc_main (int argc , char *argv[]) { // FIFO size can be set as command line argument // default is 10 int size = 10; if (argc > 1) size = atoi(argv[1]); if (size < 1) size = 1; if (size > 100000) size = 100000; // instantiating top module top top1("Top1", size); // initializing random number generator srand ( time(NULL) ); // run simualtion indefinitely until some module calls sc_stop sc_start(); return 0; }
float getISRCorrection( MT2tree* fMT2tree, const MT2Sample& sample ) { //assign all samples to its type string sampletype = (string)sample.type; if(sampletype==(string)"mc"){ if(sample.sname=="QCD") sampletype = (string)"QCD"; else if(sample.sname=="Wtolnu") sampletype = (string)"WJets"; else if(sample.sname=="DY") sampletype = (string)"ZJets"; else if(sample.name=="TTbar") sampletype = (string)"TTbar"; else if(sample.name=="TTbar_Madgraph0l") sampletype = (string)"TTbar"; else if(sample.name=="TTbar_Madgraph1l") sampletype = (string)"TTbar"; else if(sample.name=="TTbar_Madgraph2l") sampletype = (string)"TTbar"; else if(sample.sname=="Top") sampletype = (string)"SingleTop";//no ttbar, includes TTZ, TTW else sampletype = (string)"Other"; } TLorentzVector hardgenlv; hardgenlv.SetPtEtaPhiM(0,0,0,0); if(sampletype=="WJets"){ bool foundW(false); for(int ngl = 0; ngl<fMT2tree->NGenLepts; ++ngl){//lepton from W int ID =abs(fMT2tree->genlept[ngl].ID); int MID =abs(fMT2tree->genlept[ngl].MID); if((ID == 11 || ID == 12 || ID == 13 || ID == 14 || ID == 15 || ID == 16) && MID==24){ hardgenlv = fMT2tree->genlept[ngl].Mlv; foundW = true; } if(foundW) break; } if(!foundW){ for(int ngl = 0; ngl<fMT2tree->NGenLepts; ++ngl){//lepton from tau, tau from W int ID =abs(fMT2tree->genlept[ngl].ID); int MID =abs(fMT2tree->genlept[ngl].MID); int GMID=abs(fMT2tree->genlept[ngl].GMID); if((ID == 11 || ID == 12 || ID == 13 || ID == 14 || ID == 16) && MID==15 && GMID==24){ hardgenlv = fMT2tree->genlept[ngl].Mlv; foundW = true; } if(foundW) break; } } } else if(sampletype=="ZJets"){ hardgenlv = fMT2tree->GenZ[0]; } else if(sampletype=="TTbar"){ TLorentzVector top1(0.,0.,0.,0.), top2(0.,0.,0.,0.); bool top1f(false), top2f(false); for(int ngl = 0; ngl<fMT2tree->NGenLepts; ++ngl){ int id = abs(fMT2tree->genlept[ngl].ID); if(id!=5) continue; int mid = fMT2tree->genlept[ngl].MID;//from b if(mid==6&&top1f) continue; else if(mid==6) { top1 = fMT2tree->genlept[ngl].Mlv; top1f = true; } if(mid==-6&&top2f) continue; else if(mid==-6){ top2 = fMT2tree->genlept[ngl].Mlv; top2f = true; } if(top1f&&top2f) { hardgenlv = top1+top2; break; } } } else if(sampletype=="SingleTop"){ TString samplename_tstr(sample.name); if(samplename_tstr.Contains("tW")){//t + W TLorentzVector top(0.,0.,0.,0.), W(0.,0.,0.,0.); bool topf(false), Wf(false); for(int ngl = 0; ngl<fMT2tree->NGenLepts; ++ngl){ int id = abs(fMT2tree->genlept[ngl].ID); int mid = abs(fMT2tree->genlept[ngl].MID);//from b int gmid = abs(fMT2tree->genlept[ngl].GMID);//from b if(mid==6&&topf) continue; else if(mid==6) { top = fMT2tree->genlept[ngl].Mlv; topf = true; } if(mid==24&&gmid!=6&&Wf) continue; if((id == 11 || id == 12 || id == 13 || id == 14 || id == 15 || id == 16) && mid==24 && gmid!=6){ W = fMT2tree->genlept[ngl].Mlv; Wf = true; } if(topf&&Wf){ hardgenlv = top+W; break; } } if(!Wf){//this might be wrong - but influence negligible anyway for(int ngl = 0; ngl<fMT2tree->NGenLepts; ++ngl){ int id = abs(fMT2tree->genlept[ngl].ID); int mid = abs(fMT2tree->genlept[ngl].MID);//from b int gmid = abs(fMT2tree->genlept[ngl].GMID);//from b if(mid==6||gmid==6) continue; if(gmid==24&&gmid==15&&Wf) continue; if((id == 11 || id == 12 || id == 13 || id == 14 || id == 15 || id == 16) && mid==15 && gmid==24){ W = fMT2tree->genlept[ngl].Mlv; Wf = true; } if(topf&&Wf){ hardgenlv = top+W; break; } } } } else { TLorentzVector top(0.,0.,0.,0.); bool topf(false), Wf(false); for(int ngl = 0; ngl<fMT2tree->NGenLepts; ++ngl){ int id = abs(fMT2tree->genlept[ngl].ID); int mid = abs(fMT2tree->genlept[ngl].MID);//from b int gmid = abs(fMT2tree->genlept[ngl].GMID);//from b if(mid==6&&topf) continue; else if(mid==6) { top = fMT2tree->genlept[ngl].Mlv; topf = true; } if(topf){ hardgenlv = top; break; } } } } float ISRweight=1.; if(hardgenlv.Pt()>250.) ISRweight = 0.8; else if(hardgenlv.Pt()>150.) ISRweight = 0.9; else if(hardgenlv.Pt()>120.) ISRweight = 0.95; else ISRweight = 1.; return ISRweight; }
int main(void) { register unsigned int i; float flops; unsigned long temps ; init_matf(Af,2.0); init_matf(Bf,3.0); init_matf(Cf,0.0); init_matd(Ad,7.0); init_vect(V1,2.3); //aff_matf(Af); //aff_matd(Ad); //aff_matf(Cf); printf("Calculs sur %d matrices\n", ITER); printf("Dimension des matrices : %d\n", N); printf("Nombre de threads : %d\n", THREADS); printf("Dépassement du cache : %s\n", depasseCache()); printf("// MULTIPLICATIONS //\n"); /* Affichage du temps et des MFLOPS pour différents types d'opérations */ printf("Multiplication | Lignes de la matrice de sortie\n"); top1(); for(i=0; i< ITER; i++) multLigneF_OMP(Af,Bf,Cf); top2(); temps = cpu_time(); printf("time = %ld.%03ldms\n", temps/1000, temps%1000); flops = (float)(2*(float)CUBE(N)) / (float)(temps * (1e-6)) *ITER; printf("MFLOPS : %f\n",flops/1e6); printf("Multiplication | Colonnes de la matrice de sortie\n"); top1(); for(i=0; i< ITER; i++) muxColonneF_OMP(Af,Af,Cf); top2(); temps = cpu_time(); printf("time = %ld.%03ldms\n", temps/1000, temps%1000); flops = (float)(2*(float)CUBE(N)) / (float)(temps * (1e-6)) *ITER; printf("MFLOPS : %f\n",flops/1e6); printf("Multiplication | Par blocs de %d valeurs de la matrice de sortie\n",BLOC); top1(); for(i=0; i< ITER; i++) multBlocF_OMP(Af,Bf,Cf); top2(); temps = cpu_time(); printf("time = %ld.%03ldms\n", temps/1000, temps%1000); flops = (float)(2*(float)CUBE(N)) / (float)(temps * (1e-6)) *ITER; printf("MFLOPS : %f\n",flops/1e6); printf("// SOMME //\n"); top1(); for(i=0; i< ITER; i++) sommeF(Af,Bf,Cf); top2(); temps = cpu_time(); printf("time = %ld.%03ldms\n", temps/1000, temps%1000); flops = (float)((N)*(N)) / (float)(temps * (1e-6)) *ITER; printf("MFLOPS : %f\n",flops/1e6); printf("// MULT MATxVECT //\n"); top1(); for(i=0; i< ITER; i++) multVect(Af,V1,V2); top2(); temps = cpu_time(); printf("time = %ld.%03ldms\n", temps/1000, temps%1000); flops = (float)((N)*(N)) / (float)(temps * (1e-6)) *ITER; printf("MFLOPS : %f\n",flops/1e6); printf("// GAXPY //\n"); top1(); for(i=0; i< ITER; i++) gaxpy(V1,V2,Af,V3); top2(); temps = cpu_time(); printf("time = %ld.%03ldms\n", temps/1000, temps%1000); flops = (float)((N*N)+N) / (float)(temps * (1e-6)) *ITER; printf("MFLOPS : %f\n",flops/1e6); return 0; }
int TopologicalGraph::Simplify() // returns the # o multiple edges + # loops {if(Set().exist(PROP_SIMPLE))return 0; if(debug())DebugPrintf(" Executing Simplify"); // Remove Loops int n = RemoveLoops(); if(!ne()){Prop1<int> simple(Set(),PROP_SIMPLE);return n;} svector<tedge>link(0,ne()); link.clear(); link.SetName("TG:Simplify:link"); svector<tedge>top1(1,nv()); top1.clear(); top1.SetName("TG:Simplify:top1"); svector<tedge>top2(1,nv()); top2.clear(); top2.SetName("TG:Simplify:top2"); tvertex u,v,w; tedge e,e0,next; //First sort with respect to biggest label for(e = ne();e >= 1;e--) {v = (vin[e] < vin[-e]) ? vin[-e] : vin[e]; link[e] = top1[v];top1[v] = e; } // Then sort with respect to smallest label for(u = nv();u > 1;u--) {e = top1[u]; while(e!=0) {next = link[e]; //as link is modified v = (vin[e] < vin[-e]) ? vin[e] : vin[-e]; link[e] = top2[v]; top2[v] = e; e = next; } } // Erase Multiple edges, but backup multiplicity Prop<int> multiplicity(Set(tedge()),PROP_MULTIPLICITY); for (e=1; e<=ne(); ++e) multiplicity[e]=1; for(v = nv()-1;v >= 1;v--) {e0 = top2[v]; u = vin[e0];if(u == v)u = vin[-e0]; e=link[e0]; link[e0]=0; while(e!=0) {next=link[e]; w = vin[e];if(w == v)w = vin[-e]; if(u == w) {++n; ++multiplicity[e0]; link[e] = 1; } else {u=w; link[e0=e] = 0; } e=next; } } bool erased = false; for(e = ne();e >= 1;e--) if(link[e]!=0){DeleteEdge(e);erased = true;} if(!erased)Set(tedge()).erase(PROP_MULTIPLICITY); Prop1<int> simple(Set(),PROP_SIMPLE); return n; }