当前位置: 首页>>代码示例>>C++>>正文


C++ timer::reportTotal方法代码示例

本文整理汇总了C++中timer::reportTotal方法的典型用法代码示例。如果您正苦于以下问题:C++ timer::reportTotal方法的具体用法?C++ timer::reportTotal怎么用?C++ timer::reportTotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在timer的用法示例。


在下文中一共展示了timer::reportTotal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Compute

void Compute(graph<vertex>& GA, commandLine P) {
  t1.start();
  long start = P.getOptionLongValue("-r",0);
  if(GA.V[start].getOutDegree() == 0) { 
    cout << "starting vertex has degree 0" << endl;
    return;
  }
  const uintE K = P.getOptionIntValue("-K",10);
  const uintE N = P.getOptionIntValue("-N",10);
  const double t = P.getOptionDoubleValue("-t",3);
  srand (time(NULL));
  uintE seed = rand();
  const intE n = GA.n;

  //walk length probabilities
  double* fact = newA(double,K);
  fact[0] = 1;
  for(long k=1;k<K;k++) fact[k] = k*fact[k-1];
  double* probs = newA(double,K);
  for(long k=0;k<K;k++) probs[k] = exp(-t)*pow(t,k)/fact[k];

  unordered_map<uintE,double> p;
  for(long i=0;i<N;i++) {
    double randDouble = (double) hashInt(seed++) / UINT_E_MAX;
    long j = 0;
    double mass = 0;
    uintE x = start;
    do {
      mass += probs[j];
      if(randDouble < mass) break;
      x = walk(x,GA.V,seed++);
      j++;
    } while(j <= K);
    p[x]++;
  }
  for(auto it=p.begin();it!=p.end();it++) {
    p[it->first] /= N;
  }

  free(probs); free(fact);
  t1.stop();
  pairIF* A = newA(pairIF,p.size());

  long numNonzerosQ = 0;
  for(auto it = p.begin(); it != p.end(); it++) {
    A[numNonzerosQ++] = make_pair(it->first,it->second);
  }
  sweepObject sweep = sweepCut(GA,A,numNonzerosQ,start);
  free(A);
  cout << "number of vertices touched = " << p.size() << endl;
  cout << "number of edges touched = " << sweep.vol << endl;
  cout << "conductance = " << sweep.conductance << " |S| = " << sweep.sizeS << " vol(S) = " << sweep.volS << " edgesCrossing = " << sweep.edgesCrossing << endl; 
  t1.reportTotal("computation time");
}
开发者ID:jshun,项目名称:ligra,代码行数:54,代码来源:HeatKernel-Randomized-Serial.C

示例2: reportAll

void reportAll() {
  t0.reportTotal("preprocess");
  t1.reportTotal("connected components");
  t2.reportTotal("Ecc phase 1");
  t3.reportTotal("sort by decreasing eccentricities");
  t4.reportTotal("Ecc phase 2");
  t5.reportTotal("total time excluding writing to file");
}
开发者ID:cequencer,项目名称:ligra,代码行数:8,代码来源:kBFS-Ecc.C

示例3: reportAll

void reportAll() {
  t0.reportTotal("preprocess");
  t1.reportTotal("connected components");
  t2.reportTotal("random sampling");
  t3.reportTotal("BFS from sample");
  t4.reportTotal("compute max distances");
  t5.reportTotal("find furthest vertex w");
  t6.reportTotal("BFS from w");
  t7.reportTotal("BFS from Ngh_S");
  t8.reportTotal("compute estimates");
  t9.reportTotal("main loop");
  t10.reportTotal("total time excluding writing to file");
}
开发者ID:hpc-projects,项目名称:ligra,代码行数:13,代码来源:RV.C


注:本文中的timer::reportTotal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。