ALPSCore reference
namedaccumulators.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1998-2018 ALPS Collaboration. See COPYRIGHT.TXT
3  * All rights reserved. Use is subject to license terms. See LICENSE.TXT
4  * For use in publications, see ACKNOWLEDGE.TXT
5  */
6 
7 #include <boost/preprocessor/tuple/to_seq.hpp>
8 #include <boost/preprocessor/seq/for_each.hpp>
9 
10 #include <alps/config.hpp>
11 
13 
14 #define ALPS_ACCUMULATOR_VALUE_TYPES_SEQ BOOST_PP_TUPLE_TO_SEQ(ALPS_ACCUMULATOR_VALUE_TYPES_SIZE, (ALPS_ACCUMULATOR_VALUE_TYPES))
15 
16 namespace alps {
17  namespace accumulators {
18 
19  //
20  // MeanAccumulator
21  //
22 
23  template<typename T>
24  MeanAccumulator<T>& MeanAccumulator<T>::operator=(const MeanAccumulator& rhs)
25  {
26  return static_cast<MeanAccumulator&>(*static_cast<base_type*>(this)=rhs);
27  }
28 
29  template<typename T>
31  detail::AccumulatorBase<accumulator_type>(rhs) {}
32 
33  #define ALPS_ACCUMULATOR_INST_MEAN_ACCUMULATOR(r, data, T) \
34  template struct MeanAccumulator<T>;
36 
37  //
38  // NoBinningAccumulator
39  //
40 
41  template<typename T>
42  NoBinningAccumulator<T>& NoBinningAccumulator<T>::operator=(const NoBinningAccumulator& rhs)
43  {
44  return static_cast<NoBinningAccumulator&>(*static_cast<base_type*>(this)=rhs);
45  }
46 
47  template<typename T>
49  detail::AccumulatorBase<accumulator_type>(rhs) {}
50 
51  #define ALPS_ACCUMULATOR_INST_NO_BINNING_ACCUMULATOR(r, data, T) \
52  template struct NoBinningAccumulator<T>;
54 
55  //
56  // LogBinningAccumulator
57  //
58 
59  template<typename T>
60  LogBinningAccumulator<T>& LogBinningAccumulator<T>::operator=(const LogBinningAccumulator& rhs)
61  {
62  return static_cast<LogBinningAccumulator&>(*static_cast<base_type*>(this)=rhs);
63  }
64 
65  template<typename T>
67  detail::AccumulatorBase<accumulator_type>(rhs) {}
68 
69  template<typename T>
71  {
72  return this->wrapper->template extract<accumulator_type>().autocorrelation();
73  }
74 
75  #define ALPS_ACCUMULATOR_INST_LOG_BINNING_ACCUMULATOR(r, data, T) \
76  template struct LogBinningAccumulator<T>;
78 
79  //
80  // FullBinningAccumulator
81  //
82 
83  template<typename T>
84  FullBinningAccumulator<T>& FullBinningAccumulator<T>::operator=(const FullBinningAccumulator& rhs)
85  {
86  return static_cast<FullBinningAccumulator&>(*static_cast<base_type*>(this)=rhs);
87  }
88 
89  template<typename T>
91  detail::AccumulatorBase<accumulator_type>(rhs) {}
92 
93  template<typename T>
95  {
96  return this->wrapper->template extract<accumulator_type>().autocorrelation();
97  }
98 
99  #define ALPS_ACCUMULATOR_INST_FULL_BINNING_ACCUMULATOR(r, data, T) \
100  template struct FullBinningAccumulator<T>;
102 
103  //
104  // operator<<
105  //
106 
107  #define ALPS_ACCUMULATOR_DEFINE_OPERATOR(A) \
108  template<typename T> accumulator_set & operator<<(accumulator_set & set, const A <T> & arg) { \
109  set.insert(arg.name, arg.wrapper); \
110  return set; \
111  }
116 
117  #define ALPS_ACCUMULATOR_INST_OPERATOR_TYPE(r, data, T) \
118  template accumulator_set & operator<<(accumulator_set & set, const MeanAccumulator <T> &); \
119  template accumulator_set & operator<<(accumulator_set & set, const NoBinningAccumulator <T> &); \
120  template accumulator_set & operator<<(accumulator_set & set, const LogBinningAccumulator <T> &); \
121  template accumulator_set & operator<<(accumulator_set & set, const FullBinningAccumulator <T> &);
123  }
124 }
#define ALPS_ACCUMULATOR_INST_MEAN_ACCUMULATOR(r, data, T)
FullBinningAccumulator(const FullBinningAccumulator &rhs)
detail::AccumulatorBase< accumulator_type > base_type
#define ALPS_ACCUMULATOR_INST_FULL_BINNING_ACCUMULATOR(r, data, T)
detail::AccumulatorBase< accumulator_type > base_type
#define ALPS_ACCUMULATOR_INST_OPERATOR_TYPE(r, data, T)
MeanAccumulator(const MeanAccumulator &rhs)
NoBinningAccumulator(const NoBinningAccumulator &rhs)
detail::AccumulatorBase< accumulator_type > base_type
autocorrelation_type tau() const
Returns autocorrelation for this accumulator.
autocorrelation_type tau() const
Returns autocorrelation for this accumulator.
autocorrelation_type< T >::type autocorrelation(T const &arg)
#define ALPS_ACCUMULATOR_VALUE_TYPES_SEQ
#define ALPS_ACCUMULATOR_INST_NO_BINNING_ACCUMULATOR(r, data, T)
#define ALPS_ACCUMULATOR_INST_LOG_BINNING_ACCUMULATOR(r, data, T)
#define ALPS_ACCUMULATOR_DEFINE_OPERATOR(A)
LogBinningAccumulator(const LogBinningAccumulator &rhs)
autocorrelation_type< accumulator_type >::type autocorrelation_type
Data type corresponding to autocorrelation.
autocorrelation_type< accumulator_type >::type autocorrelation_type
Data type corresponding to autocorrelation.