From 445f7d42e13def7b7f9c54bdd704537cf49d4b8e Mon Sep 17 00:00:00 2001 From: Olivier Parcollet Date: Mon, 21 Oct 2013 10:32:59 +0200 Subject: [PATCH] arrays: clean dead code --- triqs/arrays/impl/assignment.hpp | 37 ++-------------- triqs/arrays/impl/indexmap_storage_pair.hpp | 47 --------------------- 2 files changed, 3 insertions(+), 81 deletions(-) diff --git a/triqs/arrays/impl/assignment.hpp b/triqs/arrays/impl/assignment.hpp index ab42d085..4fbab864 100644 --- a/triqs/arrays/impl/assignment.hpp +++ b/triqs/arrays/impl/assignment.hpp @@ -24,9 +24,6 @@ #include "../indexmaps/cuboid/foreach.hpp" #include "../storages/memcopy.hpp" -// two ways of doing things... optimal one depends on compiler ? To be checked... -#define TRIQS_ARRAYS_ASSIGN_ISP_WITH_FOREACH - namespace triqs { namespace arrays { namespace Tag {struct indexmap_storage_pair{}; }// defined here since needed below... @@ -97,18 +94,7 @@ namespace triqs { namespace arrays { if (( (OP=='E') && indexmaps::raw_copy_possible(lhs.indexmap(), rhs.indexmap()))) { storages::memcopy(lhs.data_start(), rhs.data_start(), rhs.indexmap().domain().number_of_elements()); } - else { -#ifdef TRIQS_ARRAYS_ASSIGN_ISP_WITH_FOREACH - foreach(lhs,*this); - //indexmaps::foreach_v(*this,lhs); -#else - typename RHS::const_iterator it_rhs = rhs.begin(); - typedef typename RHS::const_iterator::indexmap_iterator_type RHS_mapit; - typedef typename LHS::indexmap_type::iterator IT; - iterator_adapter it_lhs(lhs.indexmap(),lhs.storage()); - for (;it_lhs; ++it_lhs, ++it_rhs) { assert(it_rhs); _ops_::invoke(*it_lhs , *it_rhs); } -#endif - } + else { foreach(lhs,*this); } } }; @@ -119,17 +105,9 @@ namespace triqs { namespace arrays { TRIQS_REJECT_MATRIX_COMPOUND_MUL_DIV_NON_SCALAR; typedef typename LHS::value_type value_type; LHS & lhs; const RHS & rhs; - //value_type & restrict p; impl(LHS & lhs_, const RHS & rhs_): lhs(lhs_), rhs(rhs_) {} //, p(*(lhs_.data_start())) {} template void operator()(Args const & ... args) const { _ops_::invoke(lhs(args...),rhs(args...));} - void invoke() { -#ifdef TRIQS_ARRAYS_ASSIGN_ISP_WITH_FOREACH - foreach(lhs,*this); -#else - typename LHS::storage_type & S(lhs.storage()); - for (auto it= lhs.indexmap();it; ++it) _ops_::invoke(S[*it] , rhs[it.indices()] ); -#endif - } + void invoke() { foreach(lhs,*this); } }; // ----------------- assignment for scalar RHS, except some matrix case -------------------------------------------------- @@ -138,17 +116,9 @@ namespace triqs { namespace arrays { TRIQS_REJECT_ASSIGN_TO_CONST; typedef typename LHS::value_type value_type; LHS & lhs; const RHS & rhs; - //value_type & restrict p; impl(LHS & lhs_, const RHS & rhs_): lhs(lhs_), rhs(rhs_){}//, p(*(lhs_.data_start())) {} template void operator()(Args const & ...args) const {_ops_::invoke(lhs(args...), rhs);} - void invoke() { -#ifdef TRIQS_ARRAYS_ASSIGN_ISP_WITH_FOREACH - foreach(lhs,*this); // if contiguous : plain loop else foreach... -#else - typename LHS::storage_type & S(lhs.storage()); - for (auto it = lhs.indexmap();it; ++it) _ops_::invoke(S[*it], rhs); -#endif - } + void invoke() { foreach(lhs,*this); } }; // ----------------- assignment for scalar RHS for Matrices -------------------------------------------------- @@ -162,7 +132,6 @@ namespace triqs { namespace arrays { TRIQS_REJECT_ASSIGN_TO_CONST; typedef typename LHS::value_type value_type; LHS & lhs; const RHS & rhs; - //value_type & restrict p; impl(LHS & lhs_, const RHS & rhs_): lhs(lhs_), rhs(rhs_){} //, p(*(lhs_.data_start())) {} template void operator()(Args const & ... args) const {_ops_::invoke(lhs(args...), (kronecker(args...) ? rhs : RHS()));} diff --git a/triqs/arrays/impl/indexmap_storage_pair.hpp b/triqs/arrays/impl/indexmap_storage_pair.hpp index 0c38835f..1c355e17 100644 --- a/triqs/arrays/impl/indexmap_storage_pair.hpp +++ b/triqs/arrays/impl/indexmap_storage_pair.hpp @@ -195,8 +195,6 @@ namespace triqs { namespace arrays { typedef typename ISPViewType::type type; }; - // simplify this ? -#ifndef TRIQS_ARRAYS_SLICE_DEFAUT_IS_SHARED template // non const version typename boost::lazy_enable_if_c< (!clef::is_any_lazy::value) && (indexmaps::slicer::r_type::domain_type::rank!=0) && (!IsConst) @@ -259,51 +257,6 @@ namespace triqs { namespace arrays { return make_expr_call(std::move(*this),args...); } -#else - - template // non const version - typename boost::lazy_enable_if_c< - (!clef::is_any_lazy::value) && (indexmaps::slicer::r_type::domain_type::rank!=0) - , result_of_call_as_view - >::type // enable_if - operator()(Args const & ... args) { - return typename result_of_call_as_view::type ( indexmaps::slicer::invoke(indexmap_,args...), storage()); } - - template // const version - typename boost::lazy_enable_if_c< - (!clef::is_any_lazy::value) && (indexmaps::slicer::r_type::domain_type::rank!=0) - , result_of_call_as_view - >::type // enable_if - operator()(Args const & ... args) const { - return typename result_of_call_as_view::type ( indexmaps::slicer::invoke(indexmap_,args...), storage()); } - - /// Equivalent to make_view - //typename ISPViewType::type,domain_type::rank, OptionFlags, TraversalOrder, ViewTag >::type - typename ISPViewType::type - operator()() const { return *this; } - - typename ISPViewType::type - operator()() { return *this; } - - // Interaction with the CLEF library : calling with any clef expression as argument build a new clef expression - // NB : this is ok because indexmap_storage_pair has a shallow copy constructor ... - // Correction : no copy, just a ref... - // so A(i_) if A is an array will NOT copy the data.... - template< typename... Args> - typename clef::_result_of::make_expr_call::type - operator()( Args&&... args ) const { - static_assert(sizeof...(Args) <= indexmap_type::rank, "Incorrect number of variable in call");// not perfect : ellipsis ... - return make_expr_call(*this,args...); - } - - template< typename... Args> - typename clef::_result_of::make_expr_call::type - operator()( Args&&... args ) { - static_assert(sizeof...(Args) <= indexmap_type::rank, "Incorrect number of variable in call");// not perfect : ellipsis ... - return make_expr_call(*this,args...); - } - -#endif template friend void triqs_clef_auto_assign (indexmap_storage_pair & x, Fnt f) { assign_foreach(x,f);} // ------------------------------- Iterators --------------------------------------------