ALPSCore reference
var_strategy.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 <Eigen/Core>
9 
10 #include <alps/alea/complex_op.hpp>
11 
12 // Forward declarations
13 namespace alps { namespace alea {
14  struct circular_var;
15  struct elliptic_var;
16  template <typename Strategy, typename T> struct bind;
17 }}
18 
19 // Actual declarations
20 
21 namespace alps { namespace alea {
22 
38 struct circular_var { };
39 
58 struct elliptic_var { };
59 
60 
61 template <typename T>
62 struct bind<circular_var, T>
63 {
64  typedef T value_type;
65  typedef T var_type;
66  typedef T cov_type;
67 
68  typedef Eigen::internal::scalar_abs2_op<T> abs2_op;
69 
70  static cov_type outer(T x, T y) { return x * y; }
71 };
72 
73 template <typename T>
74 struct bind<circular_var, std::complex<T> >
75 {
76  typedef std::complex<T> value_type;
77  typedef T var_type;
78  typedef std::complex<T> cov_type;
79 
80  typedef Eigen::internal::scalar_abs2_op<std::complex<T> > abs2_op;
81 
82  static cov_type outer(std::complex<T> x, std::complex<T> y)
83  { return x * std::conj(y); }
84 };
85 
86 template <typename T>
87 struct bind<elliptic_var, T>
88 {
89  typedef T value_type;
90  typedef T var_type;
91  typedef T cov_type;
92 
93  typedef Eigen::internal::scalar_abs2_op<T> abs2_op;
94 
95  static cov_type outer(T x, T y) { return x * y; }
96 };
97 
98 template <typename T>
99 struct bind<elliptic_var, std::complex<T> >
100 {
101  typedef std::complex<T> value_type;
104 
105  struct abs2_op
106  {
108  const complex_op<T> operator() (const std::complex<T> &x) const
109  { return complex_op<T>::outer(x, x); }
110  };
111 
112  static complex_op<T> outer(std::complex<T> x, std::complex<T> y)
113  { return complex_op<T>::outer(x, y); }
114 };
115 
116 
117 }} /* namespace alps::alea */
118 
static cov_type outer(T x, T y)
Eigen::internal::scalar_abs2_op< T > abs2_op
STL namespace.
static complex_op< T > outer(std::complex< T > x, std::complex< T > y)
static cov_type outer(std::complex< T > x, std::complex< T > y)
Eigen::internal::scalar_abs2_op< std::complex< T > > abs2_op
static complex_op outer(std::complex< T > a, std::complex< T > b)
Definition: complex_op.hpp:55
static cov_type outer(T x, T y)
Eigen::internal::scalar_abs2_op< T > abs2_op