Statistics
| Revision:

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

History | View | Annotate | Download (2.5 kB)

1 2486 sjacqu01
///////////////////////////////////////////////////////////////////////////////
2 2486 sjacqu01
// error_of.hpp
3 2486 sjacqu01
//
4 2486 sjacqu01
//  Copyright 2005 Eric Niebler. Distributed under the Boost
5 2486 sjacqu01
//  Software License, Version 1.0. (See accompanying file
6 2486 sjacqu01
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 2486 sjacqu01
8 2486 sjacqu01
#ifndef BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_HPP_EAN_29_11_2005
9 2486 sjacqu01
#define BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_HPP_EAN_29_11_2005
10 2486 sjacqu01
11 2486 sjacqu01
#include <boost/mpl/placeholders.hpp>
12 2486 sjacqu01
#include <boost/accumulators/framework/accumulator_base.hpp>
13 2486 sjacqu01
#include <boost/accumulators/framework/extractor.hpp>
14 2486 sjacqu01
#include <boost/accumulators/framework/depends_on.hpp>
15 2486 sjacqu01
#include <boost/accumulators/statistics_fwd.hpp>
16 2486 sjacqu01
17 2486 sjacqu01
namespace boost { namespace accumulators
18 2486 sjacqu01
{
19 2486 sjacqu01
20 2486 sjacqu01
namespace impl
21 2486 sjacqu01
{
22 2486 sjacqu01
    /// INTERNAL ONLY
23 2486 sjacqu01
    ///
24 2486 sjacqu01
    template<typename Feature>
25 2486 sjacqu01
    struct this_feature_has_no_error_calculation
26 2486 sjacqu01
      : mpl::false_
27 2486 sjacqu01
    {
28 2486 sjacqu01
    };
29 2486 sjacqu01
30 2486 sjacqu01
    ///////////////////////////////////////////////////////////////////////////////
31 2486 sjacqu01
    // error_of_impl
32 2486 sjacqu01
    /// INTERNAL ONLY
33 2486 sjacqu01
    ///
34 2486 sjacqu01
    template<typename Sample, typename Feature>
35 2486 sjacqu01
    struct error_of_impl
36 2486 sjacqu01
      : accumulator_base
37 2486 sjacqu01
    {
38 2486 sjacqu01
        // TODO: specialize this on the specific features that have errors we're
39 2486 sjacqu01
        // interested in.
40 2486 sjacqu01
        BOOST_MPL_ASSERT((this_feature_has_no_error_calculation<Feature>));
41 2486 sjacqu01
42 2486 sjacqu01
        // for boost::result_of
43 2486 sjacqu01
        typedef int result_type;
44 2486 sjacqu01
45 2486 sjacqu01
        error_of_impl(dont_care)
46 2486 sjacqu01
        {
47 2486 sjacqu01
        }
48 2486 sjacqu01
49 2486 sjacqu01
        result_type result(dont_care) const
50 2486 sjacqu01
        {
51 2486 sjacqu01
            return 0;
52 2486 sjacqu01
        }
53 2486 sjacqu01
    };
54 2486 sjacqu01
55 2486 sjacqu01
} // namespace impl
56 2486 sjacqu01
57 2486 sjacqu01
///////////////////////////////////////////////////////////////////////////////
58 2486 sjacqu01
// tag::error_of
59 2486 sjacqu01
//
60 2486 sjacqu01
namespace tag
61 2486 sjacqu01
{
62 2486 sjacqu01
    template<typename Feature>
63 2486 sjacqu01
    struct error_of
64 2486 sjacqu01
      : depends_on<Feature>
65 2486 sjacqu01
    {
66 2486 sjacqu01
        /// INTERNAL ONLY
67 2486 sjacqu01
        ///
68 2486 sjacqu01
        typedef accumulators::impl::error_of_impl<mpl::_1, Feature> impl;
69 2486 sjacqu01
    };
70 2486 sjacqu01
}
71 2486 sjacqu01
72 2486 sjacqu01
///////////////////////////////////////////////////////////////////////////////
73 2486 sjacqu01
// extract::error_of
74 2486 sjacqu01
//
75 2486 sjacqu01
namespace extract
76 2486 sjacqu01
{
77 2486 sjacqu01
    BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, error_of, (typename))
78 2486 sjacqu01
}
79 2486 sjacqu01
80 2486 sjacqu01
using extract::error_of;
81 2486 sjacqu01
82 2486 sjacqu01
// make tag::error_of<tag::feature(modifier)> work
83 2486 sjacqu01
template<typename Feature>
84 2486 sjacqu01
struct as_feature<tag::error_of<Feature> >
85 2486 sjacqu01
{
86 2486 sjacqu01
    typedef tag::error_of<typename as_feature<Feature>::type> type;
87 2486 sjacqu01
};
88 2486 sjacqu01
89 2486 sjacqu01
// make error_of<tag::mean> work with non-void weights (should become
90 2486 sjacqu01
// error_of<tag::weighted_mean>
91 2486 sjacqu01
template<typename Feature>
92 2486 sjacqu01
struct as_weighted_feature<tag::error_of<Feature> >
93 2486 sjacqu01
{
94 2486 sjacqu01
    typedef tag::error_of<typename as_weighted_feature<Feature>::type> type;
95 2486 sjacqu01
};
96 2486 sjacqu01
97 2486 sjacqu01
}} // namespace boost::accumulators
98 2486 sjacqu01
99 2486 sjacqu01
#endif