Statistics
| Revision:

## root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / accumulators / statistics / sum.hpp @ 2486

 1 ///////////////////////////////////////////////////////////////////////////////  // sum.hpp  //  // Copyright 2005 Eric Niebler. Distributed under the Boost  // Software License, Version 1.0. (See accompanying file  // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)  #ifndef BOOST_ACCUMULATORS_STATISTICS_SUM_HPP_EAN_28_10_2005  #define BOOST_ACCUMULATORS_STATISTICS_SUM_HPP_EAN_28_10_2005  #include  #include  #include  #include  #include  #include  #include  #include  #include  #include  namespace boost { namespace accumulators  {  namespace impl  {   ///////////////////////////////////////////////////////////////////////////////   // sum_impl   template   struct sum_impl   : accumulator_base   {   // for boost::result_of   typedef Sample result_type;   template   sum_impl(Args const &args)   : sum(args[parameter::keyword::get() | Sample()])   {   }   template   void operator ()(Args const &args)   {   // what about overflow?   this->sum += args[parameter::keyword::get()];   }   result_type result(dont_care) const   {   return this->sum;   }   private:   Sample sum;   };  } // namespace impl  ///////////////////////////////////////////////////////////////////////////////  // tag::sum  // tag::sum_of_weights  // tag::sum_of_variates  //  namespace tag  {   struct sum   : depends_on<>   {   /// INTERNAL ONLY   ///   typedef accumulators::impl::sum_impl impl;   };   struct sum_of_weights   : depends_on<>   {   typedef mpl::true_ is_weight_accumulator;   /// INTERNAL ONLY   ///   typedef accumulators::impl::sum_impl impl;   };   template   struct sum_of_variates   : depends_on<>   {   /// INTERNAL ONLY   ///   typedef mpl::always > impl;   };   struct abstract_sum_of_variates   : depends_on<>   {   };  }  ///////////////////////////////////////////////////////////////////////////////  // extract::sum  // extract::sum_of_weights  // extract::sum_of_variates  //  namespace extract  {   extractor const sum = {};   extractor const sum_of_weights = {};   extractor const sum_of_variates = {};   BOOST_ACCUMULATORS_IGNORE_GLOBAL(sum)   BOOST_ACCUMULATORS_IGNORE_GLOBAL(sum_of_weights)   BOOST_ACCUMULATORS_IGNORE_GLOBAL(sum_of_variates)  }  using extract::sum;  using extract::sum_of_weights;  using extract::sum_of_variates;  // So that mean can be automatically substituted with  // weighted_mean when the weight parameter is non-void.  template<>  struct as_weighted_feature  {   typedef tag::weighted_sum type;  };  template<>  struct feature_of   : feature_of  {};  template  struct feature_of >   : feature_of  {  };  }} // namespace boost::accumulators  #endif