0
我通過這個例子工作,但是我沒有得到什麼數學運算boost :: accumulators :: moment < 2>是。什麼是瞬間<2>在boost :: accumulators中的含義
#include <iostream>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/stats.hpp>
#include <boost/accumulators/statistics/mean.hpp>
#include <boost/accumulators/statistics/moment.hpp>
using namespace boost::accumulators;
int main()
{
// Define an accumulator set for calculating the mean and the
// 2nd moment ...
accumulator_set<double, stats<tag::mean, tag::moment<2> > > acc;
// push in some data ...
acc(1.2);
acc(2.3);
acc(3.4);
acc(4.5);
// Display the results ...
std::cout << "Mean: " << mean(acc) << std::endl;
std::cout << "Moment: " << accumulators::moment<2>(acc) << std::endl;
return 0;
}
的例子可以在這裏找到:http://www.boost.org/doc/libs/1_53_0/doc/html/accumulators/user_s_guide.html
此外,我怎麼能得到平均的樣本的距離方差的條款?