annotate DEPENDENCIES/generic/include/boost/accumulators/statistics/rolling_mean.hpp @ 46:d572322e2efe

Fix to .cat file check (was susceptible to DOS line-endings) and subrepo update
author Chris Cannam
date Thu, 07 Aug 2014 14:39:38 +0100
parents 2665513ce2d3
children c530137014c0
rev   line source
Chris@16 1 ///////////////////////////////////////////////////////////////////////////////
Chris@16 2 // rolling_mean.hpp
Chris@16 3 //
Chris@16 4 // Copyright 2008 Eric Niebler. Distributed under the Boost
Chris@16 5 // Software License, Version 1.0. (See accompanying file
Chris@16 6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7
Chris@16 8 #ifndef BOOST_ACCUMULATORS_STATISTICS_ROLLING_MEAN_HPP_EAN_26_12_2008
Chris@16 9 #define BOOST_ACCUMULATORS_STATISTICS_ROLLING_MEAN_HPP_EAN_26_12_2008
Chris@16 10
Chris@16 11 #include <boost/mpl/placeholders.hpp>
Chris@16 12 #include <boost/accumulators/framework/accumulator_base.hpp>
Chris@16 13 #include <boost/accumulators/framework/extractor.hpp>
Chris@16 14 #include <boost/accumulators/numeric/functional.hpp>
Chris@16 15 #include <boost/accumulators/framework/parameters/sample.hpp>
Chris@16 16 #include <boost/accumulators/framework/depends_on.hpp>
Chris@16 17 #include <boost/accumulators/statistics_fwd.hpp>
Chris@16 18 #include <boost/accumulators/statistics/rolling_sum.hpp>
Chris@16 19 #include <boost/accumulators/statistics/rolling_count.hpp>
Chris@16 20
Chris@16 21 namespace boost { namespace accumulators
Chris@16 22 {
Chris@16 23
Chris@16 24 namespace impl
Chris@16 25 {
Chris@16 26
Chris@16 27 ///////////////////////////////////////////////////////////////////////////////
Chris@16 28 // rolling_mean_impl
Chris@16 29 // returns the unshifted results from the shifted rolling window
Chris@16 30 template<typename Sample>
Chris@16 31 struct rolling_mean_impl
Chris@16 32 : accumulator_base
Chris@16 33 {
Chris@16 34 typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type result_type;
Chris@16 35
Chris@16 36 rolling_mean_impl(dont_care)
Chris@16 37 {}
Chris@16 38
Chris@16 39 template<typename Args>
Chris@16 40 result_type result(Args const &args) const
Chris@16 41 {
Chris@16 42 return numeric::fdiv(rolling_sum(args), rolling_count(args));
Chris@16 43 }
Chris@16 44 };
Chris@16 45
Chris@16 46 } // namespace impl
Chris@16 47
Chris@16 48 ///////////////////////////////////////////////////////////////////////////////
Chris@16 49 // tag::rolling_mean
Chris@16 50 //
Chris@16 51 namespace tag
Chris@16 52 {
Chris@16 53 struct rolling_mean
Chris@16 54 : depends_on< rolling_sum, rolling_count >
Chris@16 55 {
Chris@16 56 /// INTERNAL ONLY
Chris@16 57 ///
Chris@16 58 typedef accumulators::impl::rolling_mean_impl< mpl::_1 > impl;
Chris@16 59
Chris@16 60 #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
Chris@16 61 /// tag::rolling_window::window_size named parameter
Chris@16 62 static boost::parameter::keyword<tag::rolling_window_size> const window_size;
Chris@16 63 #endif
Chris@16 64 };
Chris@16 65 } // namespace tag
Chris@16 66
Chris@16 67 ///////////////////////////////////////////////////////////////////////////////
Chris@16 68 // extract::rolling_mean
Chris@16 69 //
Chris@16 70 namespace extract
Chris@16 71 {
Chris@16 72 extractor<tag::rolling_mean> const rolling_mean = {};
Chris@16 73
Chris@16 74 BOOST_ACCUMULATORS_IGNORE_GLOBAL(rolling_mean)
Chris@16 75 }
Chris@16 76
Chris@16 77 using extract::rolling_mean;
Chris@16 78
Chris@16 79 }} // namespace boost::accumulators
Chris@16 80
Chris@16 81 #endif