本文整理汇总了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;
}
示例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;
}