From eda6eb90a2062539b50feff22ea2912fbb53ae9c Mon Sep 17 00:00:00 2001 From: Olivier Parcollet Date: Thu, 30 Jan 2014 20:26:19 +0100 Subject: [PATCH] arrays: correction of value_type of matrix_expr - forgot to correct the value_type of matrix_expr, and vector_expr as was done long ago for arrays... - also added cases for arrays until dim 10 - TODO : replace this trait in arrays with a tuple tools for any dim.. not urgent. --- triqs/arrays/expression_template/array_algebra.hpp | 4 ++++ triqs/arrays/expression_template/matrix_algebra.hpp | 4 +++- triqs/arrays/expression_template/vector_algebra.hpp | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/triqs/arrays/expression_template/array_algebra.hpp b/triqs/arrays/expression_template/array_algebra.hpp index f119879c..5e656477 100644 --- a/triqs/arrays/expression_template/array_algebra.hpp +++ b/triqs/arrays/expression_template/array_algebra.hpp @@ -31,6 +31,10 @@ namespace triqs { namespace arrays { template struct get_call_const_return_type { typedef decltype(std::declval()(0,0,0)) type; }; template struct get_call_const_return_type { typedef decltype(std::declval()(0,0,0,0)) type; }; template struct get_call_const_return_type { typedef decltype(std::declval()(0,0,0,0,0)) type; }; + template struct get_call_const_return_type { typedef decltype(std::declval()(0,0,0,0,0,0)) type; }; + template struct get_call_const_return_type { typedef decltype(std::declval()(0,0,0,0,0,0,0)) type; }; + template struct get_call_const_return_type { typedef decltype(std::declval()(0,0,0,0,0,0,0,0)) type; }; + template struct get_call_const_return_type { typedef decltype(std::declval()(0,0,0,0,0,0,0,0,0)) type; }; template struct array_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableArray) { diff --git a/triqs/arrays/expression_template/matrix_algebra.hpp b/triqs/arrays/expression_template/matrix_algebra.hpp index 6b043902..90479704 100644 --- a/triqs/arrays/expression_template/matrix_algebra.hpp +++ b/triqs/arrays/expression_template/matrix_algebra.hpp @@ -69,10 +69,12 @@ namespace triqs { namespace arrays { typedef typename std::remove_reference::type L_t; typedef typename std::remove_reference::type R_t; static_assert( get_rank::value==0 || get_rank::value==0 || get_rank::value == get_rank::value, "rank mismatch in matrix operations"); - typedef typename std::result_of(typename L_t::value_type,typename R_t::value_type)>::type value_type; + //typedef typename std::result_of(typename L_t::value_type,typename R_t::value_type )>::type value_type; typedef typename std::remove_cv< typename std::remove_reference::type>::type>::type domain_type; L l; R r; + using value_type = decltype(utility::operation()(l(0, 0), r(0, 0))); + template matrix_expr(LL && l_, RR && r_) : l(std::forward(l_)), r(std::forward(r_)) {} domain_type domain() const { return combine_domain()(l,r); } diff --git a/triqs/arrays/expression_template/vector_algebra.hpp b/triqs/arrays/expression_template/vector_algebra.hpp index 0bfc7821..21950921 100644 --- a/triqs/arrays/expression_template/vector_algebra.hpp +++ b/triqs/arrays/expression_template/vector_algebra.hpp @@ -29,10 +29,12 @@ namespace triqs { namespace arrays { typedef typename std::remove_reference::type L_t; typedef typename std::remove_reference::type R_t; static_assert( get_rank::value==0 || get_rank::value==0 || get_rank::value == get_rank::value, "rank mismatch in array operations"); - typedef typename std::result_of(typename L_t::value_type,typename R_t::value_type)>::type value_type; + //typedef typename std::result_of(typename L_t::value_type,typename R_t::value_type)>::type value_type; typedef typename std::remove_reference::type>::type domain_type; L l; R r; + using value_type = decltype(utility::operation()(l(0), r(0))); + template vector_expr(LL && l_, RR && r_) : l(std::forward(l_)), r(std::forward(r_)) {} domain_type domain() const { return combine_domain()(l,r); }