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


C++ Statistic::variance方法代码示例

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


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

示例1: main

int main( int argc, char** argv )
{
  using namespace Z3i;
  Statistic<double> stats;
  unsigned int nbtries = ( argc > 1 ) ? atoi( argv[ 1 ] ) : 100;
  unsigned int nbpoints = ( argc > 2 ) ? atoi( argv[ 2 ] ) : 100;
  unsigned int diameter = ( argc > 3 ) ? atoi( argv[ 3 ] ) : 100;
  std::cout << "# Usage: " << argv[0] << " <nbtries> <nbpoints> <diameter>." << std::endl;
  std::cout << "# Test class COBANaivePlaneComputer. Points are randomly chosen in [-diameter,diameter]^3." << std::endl;
  std::cout << "# Integer nbtries nbpoints diameter time/plane(ms) E(comp) V(comp)" << std::endl;
  
 // Max diameter is ~20 for int32_t, ~500 for int64_t, any with BigInteger.
  trace.beginBlock ( "Testing class COBANaivePlaneComputer" );
  bool res = true 
    && checkPlanes<COBANaivePlaneComputer<Z3, DGtal::BigInteger> >( nbtries, diameter, nbpoints, stats );
  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
  long t = trace.endBlock();
  stats.terminate();
  std::cout << "BigInteger" << " " << stats.samples()
            << " " << nbpoints
            << " " << diameter 
            << " " << ( (double) t / (double) stats.samples() )
            << " " << stats.mean()
            << " " << stats.variance()
            << std::endl;
  return res ? 0 : 1;
}
开发者ID:arnaudetitia,项目名称:DGtal,代码行数:27,代码来源:testCOBANaivePlaneComputer-benchmark.cpp

示例2: testStatistics

/**
 * Example of a test. To be completed.
 *
 */
bool testStatistics()
{
  unsigned int nbok = 0;
  unsigned int nb = 3;
  
  trace.beginBlock ( "Testing Statistics ..." );

  Statistic<double> stat;
  
  for(unsigned int k=0; k < 1000; k++)
    stat.addValue((double)k);
  
  stat.terminate();
  
  trace.info() << "Mean value = "<<stat.mean()  << std::endl;
  nbok += (stat.mean()==499.5) ? 1 : 0; 
  trace.info() << "Variance value = "<<stat.variance()<<std::endl;
  trace.info() << "Max value = "<<stat.max()<<std::endl;
  nbok += (stat.max()==999) ? 1 : 0; 
  trace.info() << "Min value = "<<stat.min()<<std::endl;
  nbok += (stat.min()==0)  ? 1 : 0; 
 
  trace.info() << "(" << nbok << "/" << nb << ") "
         << "true == true" << std::endl;
  trace.endBlock();
  
  return nbok == nb;
}
开发者ID:BorisMansencal,项目名称:DGtal,代码行数:32,代码来源:testStatistics.cpp


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