
Boost Users : 
Subject: Re: [Boostusers] boost::math::standard_deviation how to use ?
From: Edouard Tallent (tallent_e_at_[hidden])
Date: 20120818 13:53:04
My 2cent
One can easily compute the standard deviation of data contained in a std::vector as shown here:
http://stackoverflow.com/questions/7616511/calculatemeanandstandarddeviationfromavectorofsamplesincusingboost
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_toolkit/dist/stat_tut/weg/find_eg/find_mean_and_sd_eg.html
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_at_[hidden]>
To: boostusers_at_[hidden]
Subject: [Boostusers] boost::math::standard_deviation how to use ?
MessageID: <13452345507914634435.post_at_[hidden]>
ContentType: text/plain; charset=usascii
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 nonmember 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;
Boostusers list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net