Boost logo

Boost Users :

Subject: Re: [Boost-users] [accumulator] compiler error with quantil
From: Philipp Kraus (philipp.kraus_at_[hidden])
Date: 2013-06-14 11:21:55


On 2013-06-14 01:02:35 +0200, Eric Niebler said:

> On 6/13/2013 3:56 AM, Philipp Kraus wrote:
>> On 2013-06-11 15:09:40 +0200, Philipp Kraus said:
>>
>>> I try to create a complex accumulator. I would like to use an
>>> accumulator for a box plot with the whisker data (
>>> http://en.wikipedia.org/wiki/Box_plot ).
>>
>> This short example
>>
>> #include <boost/accumulators/accumulators.hpp>
>> #include <boost/accumulators/statistics/sum.hpp>
>> #include <boost/accumulators/statistics/min.hpp>
>> #include <boost/accumulators/statistics/max.hpp>
>> #include <boost/accumulators/statistics/mean.hpp>
>> #include <boost/accumulators/statistics/stats.hpp>
>> #include <boost/accumulators/statistics/count.hpp>
>> #include <boost/accumulators/statistics/median.hpp>
>> #include <boost/accumulators/statistics/variance.hpp>
>> #include <boost/accumulators/statistics/extended_p_square.hpp>
>
> whoops, should be:
>
> #include <boost/accumulators/statistics/extended_p_square_quantile.hpp>
>
>> #include <boost/array.hpp>
>>
>> using namespace boost::accumulators;
>>
>> typedef accumulator_set<double, stats<
>> tag::count,
>> tag::sum,
>> tag::mean,
>> tag::extended_p_square_quantile //*
>>>> accumulator_t;
>>
>>
>> int main()
>> {
>> boost::array<double,3> probs = {0.25, 0.50, 0.75};
>> accumulator_t acc(extended_p_square_probabilities = probs);
>> }
>>
>> compiles only, if I comment the //* line, but with the quantil tag the
>> compiler creates this errors:
>
> <snip>
>
> The errors went away for me when I included the correct header. You
> might check the docs for the statistics you're using. The docs aren't
> great, but they at least tell you what headers to include.
>
> http://www.boost.org/doc/libs/1_53_0/doc/html/accumulators/user_s_guide.html#accumulators.user_s_guide.the_statistical_accumulators_library.extended_p_square_quantile
>

I can solve the problem :-P
I have include these headers:

        #include <boost/array.hpp>
        #include <boost/accumulators/statistics.hpp>
        #include <boost/accumulators/accumulators.hpp>

But my variable m_times is a std::map<std::string, accumulator> and I
can not push the accumulator with m_times[<some string>] =
Accumulator(...)
I need the insert method of the map with a std::pair and for accessing
the element does not work the m_times[<some string>](<a value>), I need
the iterator of the map element and push the value to the accumulator
with it->second(<a value>)

Phil



Boost-users 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