ALPSCore reference
joined.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 <alps/alea/core.hpp>
9 
10 // We only need forwards here
11 
12 namespace alps { namespace alea {
13  template <typename T> class mean_result;
14  template <typename T, typename Str> class var_result;
15  template <typename T, typename Str> class cov_result;
16  template <typename T> class autocorr_result;
17  template <typename T> class batch_result;
18 
19  struct circular_var;
20  struct elliptic_var;
21 }}
22 
23 // Actual declarations
24 
25 namespace alps { namespace alea { namespace internal {
26 
27 // Predicates
28 
29 template <typename T1, typename T2>
30 constexpr bool joins_batch()
31 {
32  return std::is_same<typename T1::value_type, typename T2::value_type>::value
33  && T1::HAVE_BATCH && T2::HAVE_BATCH;
34 }
35 
36 template <typename T1, typename T2>
37 constexpr bool joins_autocorr()
38 {
39  return std::is_same<typename T1::value_type, typename T2::value_type>::value
40  && T1::HAVE_TAU && T2::HAVE_TAU;
41 }
42 
43 template <typename T1, typename T2>
44 constexpr bool joins_cov()
45 {
46  return std::is_same<typename T1::value_type, typename T2::value_type>::value
47  && T1::HAVE_COV && T2::HAVE_COV
48  && !(T1::HAVE_BATCH && T2::HAVE_BATCH);
49 }
50 
51 template <typename T1, typename T2>
52 constexpr bool joins_var()
53 {
54  return std::is_same<typename T1::value_type, typename T2::value_type>::value
55  && (T1::HAVE_VAR && T2::HAVE_VAR)
56  && !(T1::HAVE_COV && T2::HAVE_COV)
57  && !(T1::HAVE_TAU && T2::HAVE_TAU)
58  && !(T1::HAVE_BATCH && T2::HAVE_BATCH);
59 }
60 
61 template <typename T1, typename T2>
62 constexpr bool joins_mean()
63 {
64  return std::is_same<typename T1::value_type, typename T2::value_type>::value
65  && T1::HAVE_MEAN && T2::HAVE_MEAN
66  && !(T1::HAVE_VAR && T2::HAVE_VAR);
67 }
68 
72 template <typename R1, typename R2, typename Enabler=void>
73 struct joined;
74 
75 template <typename R1, typename R2>
76 struct joined<R1, R2,
77  typename std::enable_if<joins_batch<traits<R1>, traits<R2> >()>::type>
78 {
80 };
81 
82 template <typename R1, typename R2>
83 struct joined<R1, R2,
84  typename std::enable_if<joins_autocorr<traits<R1>, traits<R2> >()>::type>
85 {
87 };
88 
89 template <typename R1, typename R2>
90 struct joined<R1, R2,
91  typename std::enable_if<joins_cov<traits<R1>, traits<R2> >()>::type>
92 {
95 };
96 
97 template <typename R1, typename R2>
98 struct joined<R1, R2,
99  typename std::enable_if<joins_var<traits<R1>, traits<R2> >()>::type>
100 {
103 };
104 
105 template <typename R1, typename R2>
106 struct joined<R1, R2,
107  typename std::enable_if<joins_mean<traits<R1>, traits<R2> >()>::type>
108 {
110 };
111 
112 }}} /* namespace alps::alea::internal */
var_result< typename traits< R1 >::value_type, typename traits< R1 >::strategy_type > result_type
Definition: joined.hpp:102
constexpr bool joins_mean()
Definition: joined.hpp:62
STL namespace.
constexpr bool joins_var()
Definition: joined.hpp:52
constexpr bool joins_autocorr()
Definition: joined.hpp:37
constexpr bool joins_cov()
Definition: joined.hpp:44
cov_result< typename traits< R1 >::value_type, typename traits< R1 >::strategy_type > result_type
Definition: joined.hpp:94
constexpr bool joins_batch()
Definition: joined.hpp:30