ALPSCore reference
result.hpp
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 #pragma once
7 
8 #include <boost/variant.hpp>
9 
10 #include <alps/alea/mean.hpp>
11 #include <alps/alea/variance.hpp>
12 #include <alps/alea/covariance.hpp>
13 #include <alps/alea/autocorr.hpp>
14 #include <alps/alea/batch.hpp>
15 
16 namespace alps { namespace alea {
17 
18 class result;
19 void serialize(serializer &, const std::string &, const result &);
20 
21 }}
22 
23 
24 namespace alps { namespace alea {
25 
26 struct estimate_unavailable : public std::exception { };
27 
28 struct estimate_type_mismatch : public std::exception { };
29 
30 class result
31 {
32 public:
33  result() : res_(mean_result<double>()) { } // empty
34 
35  template <typename T>
36  result(const mean_result<T> &res) : res_(res) { }
37 
38  template <typename T, typename Str>
39  result(const var_result<T,Str> &res) : res_(res) { }
40 
41  template <typename T, typename Str>
42  result(const cov_result<T,Str> &res) : res_(res) { }
43 
44  template <typename T>
45  result(const autocorr_result<T> &res) : res_(res) { }
46 
47  template <typename T>
48  result(const batch_result<T> &res) : res_(res) { }
49 
51  bool valid() const;
52 
54  size_t size() const;
55 
57  size_t count() const;
58 
60  template <typename T>
61  column<T> mean() const;
62 
64  template <typename T, typename Str=circular_var>
66 
68  template <typename T, typename Str=circular_var>
69  typename eigen<typename bind<Str,T>::cov_type>::matrix cov() const;
70 
72  friend void serialize(serializer &, const std::string &, const result &);
73 
74 private:
75  typedef boost::variant<
80  , var_result<std::complex<double>, elliptic_var>
83  , cov_result<std::complex<double>, elliptic_var>
88  > variant_type;
89 
90  variant_type res_;
91 };
92 
93 
94 }}
std::enable_if<!is_sequence< T >::value, std::size_t >::type size(T const &)
Definition: size.hpp:20
result(const var_result< T, Str > &res)
Definition: result.hpp:39
mean_type< T >::type mean(T const &arg)
Definition: mean.hpp:47
result(const cov_result< T, Str > &res)
Definition: result.hpp:42
void serialize(serializer &, const std::string &, const autocorr_result< T > &)
Definition: autocorr.cpp:243
result(const autocorr_result< T > &res)
Definition: result.hpp:45
result(const mean_result< T > &res)
Definition: result.hpp:36
traits< Acc >::result_type result(const Acc &acc)
Definition: util.hpp:53
result(const batch_result< T > &res)
Definition: result.hpp:48
count_type< T >::type count(T const &arg)
Definition: count.hpp:39