
My 2-cent One can easily compute the standard deviation of data contained in a std::vector as shown here: http://stackoverflow.com/questions/7616511/calculate-mean-and-standard-devia... Another option is resorting on boost, and any boost container as here: http://www.boost.org/doc/libs/1_41_0/libs/math/doc/sf_and_dist/html/math_too... I mean I am not sure ** in this case *** trying to mix standard vector and boost is the best solution. Best Edouard https://quantcorner.wordpress.com/ ========= Message: 4 Date: Fri, 17 Aug 2012 13:15:50 -0700 (PDT) From: leeto <denisigoshev@gmail.com> To: boost-users@lists.boost.org Subject: [Boost-users] boost::math::standard_deviation how to use ? Message-ID: <1345234550791-4634435.post@n4.nabble.com> Content-Type: text/plain; charset=us-ascii How to compute standard_deviation using boost I want that interface will be like in excel i mean you mark some data and that all ) How do the same in c++ boost using data from a standard container like vector for example... Many thanks in advance #include <boost/math/distributions.hpp> // For non-member functions of distributions #include <vector> #include <numeric> using namespace std; int main () { std::vector<double> v; for (unsigned int i = 0; i < 7; i++) { v.push_back(std::rand()%7); } std::vector<double>::iterator i = v.begin(); for (i ; i != v.end(); ++i) { std::cout << (*i) << ", "; } cout << std::accumulate(v.begin(), v.end(),0) << endl; //boost::math::normal_distribution cout << "\n\n\n" ; return 0;