15 #include <Eigen/Dense> 22 namespace alps {
namespace alea {
31 namespace alps {
namespace alea {
33 template <
typename Derived>
35 const Eigen::DenseBase<Derived> &in)
46 template<
typename T,
size_t N>
61 size_t size()
const {
return 1; }
103 size_t size()
const {
return in_.size(); }
107 if (out.
size() != in_.size())
109 for (
size_t i = 0; i != in_.size(); ++i)
110 out.
data()[i] += in_[i];
116 const std::vector<T> &in_;
126 size_t size()
const {
return in_.size(); }
129 if (out.
size() != in_.size())
131 for (
size_t i = 0; i != in_.size(); ++i)
132 out.
data()[i] += in_[i];
138 const std::array<T, N> &in_;
141 template <
typename T,
typename Derived>
152 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Eigen::DenseBase<Derived>);
153 static_assert(std::is_same<T, typename Derived::Scalar>::value,
154 "Type mismatch -- use explicit cast");
157 size_t size()
const {
return in_.size(); }
161 if (out.
size() != (size_t)in_.rows())
171 const Eigen::DenseBase<Derived> &in_;
177 template <
typename T,
typename Parent>
183 typedef void (Parent::*adder_type)(
view<T>)
const;
192 size_t size()
const {
return size_; }
198 const Parent &
parent()
const {
return parent_; }
200 const adder_type &
adder()
const {
return adder_; }
205 const Parent &parent_;
211 template<
typename AccType>
212 typename std::enable_if<is_alea_acc<AccType>::value, AccType&>::type
213 operator<<(AccType& acc,
const typename AccType::value_type& v){
214 return acc << value_adapter<typename AccType::value_type>(v);
218 template<
typename AccType,
typename Derived>
219 typename std::enable_if<is_alea_acc<AccType>::value, AccType&>::type
220 operator<<(AccType& acc, const Eigen::DenseBase<Derived>& v){
221 return acc << eigen_adapter<typename AccType::value_type, Derived>(v);
225 template<
typename AccType>
226 typename std::enable_if<is_alea_acc<AccType>::value, AccType&>::type
227 operator<<(AccType& acc, const std::vector<typename AccType::value_type>& v){
228 return acc << vector_adapter<typename AccType::value_type>(v);
232 template<
typename AccType,
size_t N>
233 typename std::enable_if<is_alea_acc<AccType>::value, AccType&>::type
234 operator<<(AccType& acc, const std::array<typename AccType::value_type, N>& v){
235 return acc << array_adapter<typename AccType::value_type, N>(v);
computed_cmember(const Parent &parent, adder_type adder, size_t size)
void add_to(view< T > out) const
void add_to(view< T > out) const
std::enable_if<!is_sequence< T >::value, std::size_t >::type size(T const &)
void add_to(view< T > out) const
void fast_add_to(view< T > out)
vector_adapter(const std::vector< T > &in)
void add_to(view< T > out) const
const Parent & parent() const
Eigen::Map< col, Eigen::Unaligned > col_map
array_adapter< T, N > make_array_adapter(const std::array< T, N > &a)
const adder_type & adder() const
array_adapter(const std::array< T, N > &in)
std::ostream & operator<<(std::ostream &, const autocorr_result< T > &)
eigen_adapter< typename Derived::Scalar, Derived > make_adapter(const Eigen::DenseBase< Derived > &in)
void add_to(view< T > out) const
eigen_adapter(const Eigen::DenseBase< Derived > &in)