3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-24 13:23:37 +01:00

changing non_view_type to regular_type

- cosmetic : for clarity of the code.
This commit is contained in:
Olivier Parcollet 2013-08-20 16:15:43 +02:00
parent 938f3dc425
commit 41bc8d0338
34 changed files with 75 additions and 75 deletions

View File

@ -28,7 +28,7 @@ using namespace triqs::utility;
template <typename T> struct check { template <typename T> struct check {
static_assert(std::is_same<typename T::view_type, typename view_type_if_exists_else_type<T>::type >::value, "err"); static_assert(std::is_same<typename T::view_type, typename view_type_if_exists_else_type<T>::type >::value, "err");
static_assert(std::is_same<typename T::non_view_type, typename non_view_type_if_exists_else_type<T>::type >::value, "err"); static_assert(std::is_same<typename T::regular_type, typename regular_type_if_exists_else_type<T>::type >::value, "err");
}; };
int main(int argc, char **argv) { int main(int argc, char **argv) {

View File

@ -42,7 +42,7 @@ namespace triqs { namespace arrays {
public: public:
typedef typename IMPL_TYPE::indexmap_type indexmap_type; typedef typename IMPL_TYPE::indexmap_type indexmap_type;
typedef typename IMPL_TYPE::storage_type storage_type; typedef typename IMPL_TYPE::storage_type storage_type;
typedef array <ValueType,Rank,Opt,TraversalOrder> non_view_type; typedef array <ValueType,Rank,Opt,TraversalOrder> regular_type;
typedef array_view<ValueType,Rank,Opt,TraversalOrder> view_type; typedef array_view<ValueType,Rank,Opt,TraversalOrder> view_type;
typedef array_view<ValueType,Rank,Opt,TraversalOrder,true> weak_view_type; typedef array_view<ValueType,Rank,Opt,TraversalOrder,true> weak_view_type;
typedef void has_view_type_tag; typedef void has_view_type_tag;
@ -98,7 +98,7 @@ namespace triqs { namespace arrays {
typedef typename IMPL_TYPE::value_type value_type; typedef typename IMPL_TYPE::value_type value_type;
typedef typename IMPL_TYPE::storage_type storage_type; typedef typename IMPL_TYPE::storage_type storage_type;
typedef typename IMPL_TYPE::indexmap_type indexmap_type; typedef typename IMPL_TYPE::indexmap_type indexmap_type;
typedef array <ValueType,Rank,Opt,TraversalOrder> non_view_type; typedef array <ValueType,Rank,Opt,TraversalOrder> regular_type;
typedef array_view<ValueType,Rank,Opt,TraversalOrder> view_type; typedef array_view<ValueType,Rank,Opt,TraversalOrder> view_type;
typedef array_view<ValueType,Rank,Opt,TraversalOrder,true> weak_view_type; typedef array_view<ValueType,Rank,Opt,TraversalOrder,true> weak_view_type;
typedef void has_view_type_tag; typedef void has_view_type_tag;

View File

@ -92,7 +92,7 @@ namespace triqs { namespace arrays { namespace blas_lapack_tools {
const bool need_copy; const bool need_copy;
A keeper; A keeper;
struct internal_data { struct internal_data {
typename A::non_view_type copy_data; typename A::regular_type copy_data;
A view; A view;
internal_data(const_qcache const & P) : copy_data(P.keeper), view(copy_data) { internal_data(const_qcache const & P) : copy_data(P.keeper), view(copy_data) {
#ifdef TRIQS_ARRAYS_CACHE_COPY_VERBOSE #ifdef TRIQS_ARRAYS_CACHE_COPY_VERBOSE

View File

@ -118,7 +118,7 @@ namespace triqs { namespace arrays {
dataspace.getSimpleExtentDims( &dims_out[0], NULL); dataspace.getSimpleExtentDims( &dims_out[0], NULL);
mini_vector<size_t,ArrayType::rank > d2; for (size_t u=0; u<ArrayType::rank ; ++u) d2[u] = dims_out[u]; mini_vector<size_t,ArrayType::rank > d2; for (size_t u=0; u<ArrayType::rank ; ++u) d2[u] = dims_out[u];
resize_or_check(A, d2 ); resize_or_check(A, d2 );
if (C_reorder) { read_array(g,name, cache<ArrayType,typename ArrayType::non_view_type>(A).view(),false);} if (C_reorder) { read_array(g,name, cache<ArrayType,typename ArrayType::regular_type>(A).view(),false);}
//if (C_reorder) { read_array(g,name, make_cache(A).view(),false);} //if (C_reorder) { read_array(g,name, make_cache(A).view(),false);}
ds.read( get_array_data_ptr(A), h5::data_type_memory<typename ArrayType::value_type>(), data_space(A) , dataspace ); ds.read( get_array_data_ptr(A), h5::data_type_memory<typename ArrayType::value_type>(), data_space(A) , dataspace );
} }

View File

@ -75,7 +75,7 @@ namespace triqs {
template<typename A> typename A::view_type make_view(A const & x) { return typename A::view_type(x);} template<typename A> typename A::view_type make_view(A const & x) { return typename A::view_type(x);}
/// Makes a clone /// Makes a clone
template<typename A> typename A::non_view_type make_clone(A const & x) { return typename A::non_view_type(x);} template<typename A> typename A::regular_type make_clone(A const & x) { return typename A::regular_type(x);}
namespace arrays { namespace arrays {
using triqs::make_clone; using triqs::make_clone;

View File

@ -126,7 +126,7 @@ namespace triqs { namespace arrays {
friend std::ostream & operator<<(std::ostream & out,inverse_lazy_impl const&x){return out<<"inverse("<<x.a<<")";} friend std::ostream & operator<<(std::ostream & out,inverse_lazy_impl const&x){return out<<"inverse("<<x.a<<")";}
protected: protected:
struct internal_data { // implementing the pattern LazyPreCompute struct internal_data { // implementing the pattern LazyPreCompute
//typedef typename A_type::non_view_type M_type; //typedef typename A_type::regular_type M_type;
typedef matrix<value_type> M_type; typedef matrix<value_type> M_type;
typedef matrix_view<value_type> M_view_type; typedef matrix_view<value_type> M_view_type;
M_type M; M_type M;
@ -174,7 +174,7 @@ namespace triqs { namespace arrays {
friend std::ostream & operator<<(std::ostream & out, determinant_lazy const & x){ return out<<"determinant("<<x.a<<")";} friend std::ostream & operator<<(std::ostream & out, determinant_lazy const & x){ return out<<"determinant("<<x.a<<")";}
protected: protected:
struct internal_data { struct internal_data {
typedef typename A_type::non_view_type M_type; typedef typename A_type::regular_type M_type;
M_type M; typename A::value_type det; M_type M; typename A::value_type det;
internal_data(determinant_lazy const & P):M(P.a){det_and_inverse_worker<A_type> worker(M); det = worker.det();} internal_data(determinant_lazy const & P):M(P.a){det_and_inverse_worker<A_type> worker(M); det = worker.det();}
}; };

View File

@ -126,7 +126,7 @@ namespace triqs { namespace arrays {
friend std::ostream & operator<<(std::ostream & out,inverse_lazy_impl const&x){return out<<"inverse("<<x.a<<")";} friend std::ostream & operator<<(std::ostream & out,inverse_lazy_impl const&x){return out<<"inverse("<<x.a<<")";}
protected: protected:
struct internal_data { // implementing the pattern LazyPreCompute struct internal_data { // implementing the pattern LazyPreCompute
//typedef typename A_type::non_view_type M_type; //typedef typename A_type::regular_type M_type;
typedef matrix<value_type> M_type; typedef matrix<value_type> M_type;
typedef matrix_view<value_type> M_view_type; typedef matrix_view<value_type> M_view_type;
M_type M; M_type M;
@ -174,7 +174,7 @@ namespace triqs { namespace arrays {
friend std::ostream & operator<<(std::ostream & out, determinant_lazy const & x){ return out<<"determinant("<<x.a<<")";} friend std::ostream & operator<<(std::ostream & out, determinant_lazy const & x){ return out<<"determinant("<<x.a<<")";}
protected: protected:
struct internal_data { struct internal_data {
typedef typename A_type::non_view_type M_type; typedef typename A_type::regular_type M_type;
M_type M; typename A::value_type det; M_type M; typename A::value_type det;
internal_data(determinant_lazy const & P):M(P.a){det_and_inverse_worker<A_type> worker(M); det = worker.det();} internal_data(determinant_lazy const & P):M(P.a){det_and_inverse_worker<A_type> worker(M); det = worker.det();}
}; };

View File

@ -81,7 +81,7 @@ namespace triqs { namespace arrays { namespace linalg {
protected: protected:
eigenelements_worker_base ( matrix_view <T,Opt> the_matrix) : eigenelements_worker_base <T,Opt,false> (the_matrix) {this->compz='V'; } eigenelements_worker_base ( matrix_view <T,Opt> the_matrix) : eigenelements_worker_base <T,Opt,false> (the_matrix) {this->compz='V'; }
public: public:
typename matrix_view<T,Opt>::non_view_type vectors() const { typename matrix_view<T,Opt>::regular_type vectors() const {
if (!this->has_run) TRIQS_RUNTIME_ERROR<<"eigenelements_worker has not been invoked !"; if (!this->has_run) TRIQS_RUNTIME_ERROR<<"eigenelements_worker has not been invoked !";
return this->mat; return this->mat;
} }
@ -153,7 +153,7 @@ namespace triqs { namespace arrays { namespace linalg {
* if true : a copy is made, M is preserved, but of course it is slower... * if true : a copy is made, M is preserved, but of course it is slower...
*/ */
template<typename MatrixViewType > template<typename MatrixViewType >
std::pair<array<double,1>, typename MatrixViewType::non_view_type> eigenelements( MatrixViewType const & M, bool take_copy =false) { std::pair<array<double,1>, typename MatrixViewType::regular_type> eigenelements( MatrixViewType const & M, bool take_copy =false) {
eigenelements_worker<typename MatrixViewType::view_type, true> W(take_copy ? MatrixViewType(make_clone(M)) : M); eigenelements_worker<typename MatrixViewType::view_type, true> W(take_copy ? MatrixViewType(make_clone(M)) : M);
W.invoke(); W.invoke();
return std::make_pair(W.values(),W.vectors()); return std::make_pair(W.values(),W.vectors());

View File

@ -126,7 +126,7 @@ namespace triqs { namespace arrays {
friend std::ostream & operator<<(std::ostream & out,inverse_lazy_impl const&x){return out<<"inverse("<<x.a<<")";} friend std::ostream & operator<<(std::ostream & out,inverse_lazy_impl const&x){return out<<"inverse("<<x.a<<")";}
protected: protected:
struct internal_data { // implementing the pattern LazyPreCompute struct internal_data { // implementing the pattern LazyPreCompute
//typedef typename A_type::non_view_type M_type; //typedef typename A_type::regular_type M_type;
typedef matrix<value_type> M_type; typedef matrix<value_type> M_type;
typedef matrix_view<value_type> M_view_type; typedef matrix_view<value_type> M_view_type;
M_type M; M_type M;
@ -174,7 +174,7 @@ namespace triqs { namespace arrays {
friend std::ostream & operator<<(std::ostream & out, determinant_lazy const & x){ return out<<"determinant("<<x.a<<")";} friend std::ostream & operator<<(std::ostream & out, determinant_lazy const & x){ return out<<"determinant("<<x.a<<")";}
protected: protected:
struct internal_data { struct internal_data {
typedef typename A_type::non_view_type M_type; typedef typename A_type::regular_type M_type;
M_type M; typename A::value_type det; M_type M; typename A::value_type det;
internal_data(determinant_lazy const & P):M(P.a){det_and_inverse_worker<A_type> worker(M); det = worker.det();} internal_data(determinant_lazy const & P):M(P.a){det_and_inverse_worker<A_type> worker(M); det = worker.det();}
}; };

View File

@ -51,7 +51,7 @@ namespace triqs { namespace arrays {
template <typename ValueType, ull_t Opt, ull_t TraversalOrder, bool Borrowed> template <typename ValueType, ull_t Opt, ull_t TraversalOrder, bool Borrowed>
class matrix_view : Tag::matrix_view, TRIQS_MODEL_CONCEPT(MutableMatrix), public IMPL_TYPE { class matrix_view : Tag::matrix_view, TRIQS_MODEL_CONCEPT(MutableMatrix), public IMPL_TYPE {
public : public :
typedef matrix <ValueType,Opt,TraversalOrder> non_view_type; typedef matrix <ValueType,Opt,TraversalOrder> regular_type;
typedef matrix_view<ValueType,Opt,TraversalOrder> view_type; typedef matrix_view<ValueType,Opt,TraversalOrder> view_type;
typedef matrix_view<ValueType,Opt,TraversalOrder,true> weak_view_type; typedef matrix_view<ValueType,Opt,TraversalOrder,true> weak_view_type;
typedef void has_view_type_tag; typedef void has_view_type_tag;
@ -113,7 +113,7 @@ namespace triqs { namespace arrays {
typedef typename IMPL_TYPE::value_type value_type; typedef typename IMPL_TYPE::value_type value_type;
typedef typename IMPL_TYPE::storage_type storage_type; typedef typename IMPL_TYPE::storage_type storage_type;
typedef typename IMPL_TYPE::indexmap_type indexmap_type; typedef typename IMPL_TYPE::indexmap_type indexmap_type;
typedef matrix <ValueType,Opt,TraversalOrder> non_view_type; typedef matrix <ValueType,Opt,TraversalOrder> regular_type;
typedef matrix_view<ValueType,Opt,TraversalOrder> view_type; typedef matrix_view<ValueType,Opt,TraversalOrder> view_type;
typedef matrix_view<ValueType,Opt,TraversalOrder,true> weak_view_type; typedef matrix_view<ValueType,Opt,TraversalOrder,true> weak_view_type;
typedef void has_view_type_tag; typedef void has_view_type_tag;

View File

@ -65,7 +65,7 @@ namespace triqs { namespace arrays {
void invert() {for (size_t i=0; i<size(); ++i) { auto v = view(i); v = inverse(v);} } void invert() {for (size_t i=0; i<size(); ++i) { auto v = view(i); v = inverse(v);} }
friend matrix_stack_view matmul_L_R ( matrix_view<T> const & L, matrix_stack_view const & M, matrix_view<T> const & R) { friend matrix_stack_view matmul_L_R ( matrix_view<T> const & L, matrix_stack_view const & M, matrix_view<T> const & R) {
matrix_stack_view res (typename array_view_t::non_view_type (M.size(), L.dim0(), R.dim1())); matrix_stack_view res (typename array_view_t::regular_type (M.size(), L.dim0(), R.dim1()));
for (size_t i=0; i<M.size(); ++i) { res.view(i) = L * M.view(i) * R; } for (size_t i=0; i<M.size(); ++i) { res.view(i) = L * M.view(i) * R; }
return res; return res;
} }

View File

@ -68,7 +68,7 @@ namespace triqs { namespace arrays { namespace storages { //namespace details {
template<bool Weak, typename ValueType> DISABLE_IFC(Weak) dec_ref(mem_block<ValueType> * const m) { template<bool Weak, typename ValueType> DISABLE_IFC(Weak) dec_ref(mem_block<ValueType> * const m) {
m->ref_count--; if (m->ref_count ==0) { m->ref_count--; if (m->ref_count ==0) {
#ifdef TRIQS_ARRAYS_CHECK_WEAK_REFS #ifdef TRIQS_ARRAYS_CHECK_WEAK_REFS
std::cout << " detroying "<< m->weak_ref_count <<std::endl; //std::cout << " detroying "<< m->weak_ref_count <<std::endl;
if (m->weak_ref_count !=0) TRIQS_RUNTIME_ERROR << "Deleting an memory block of an array with still "<< m->weak_ref_count<< " weak references"; if (m->weak_ref_count !=0) TRIQS_RUNTIME_ERROR << "Deleting an memory block of an array with still "<< m->weak_ref_count<< " weak references";
#endif #endif
delete m; delete m;

View File

@ -40,7 +40,7 @@ namespace triqs { namespace arrays {
template <typename ValueType, ull_t Opt, bool Borrowed> template <typename ValueType, ull_t Opt, bool Borrowed>
class vector_view : Tag::vector_view, TRIQS_MODEL_CONCEPT(MutableVector), public IMPL_TYPE { class vector_view : Tag::vector_view, TRIQS_MODEL_CONCEPT(MutableVector), public IMPL_TYPE {
public : public :
typedef vector <ValueType,Opt> non_view_type; typedef vector <ValueType,Opt> regular_type;
typedef vector_view<ValueType,Opt,false> view_type; typedef vector_view<ValueType,Opt,false> view_type;
typedef vector_view<ValueType,Opt,true> weak_view_type; typedef vector_view<ValueType,Opt,true> weak_view_type;
typedef void has_view_type_tag; typedef void has_view_type_tag;
@ -107,7 +107,7 @@ namespace triqs { namespace arrays {
typedef typename IMPL_TYPE::value_type value_type; typedef typename IMPL_TYPE::value_type value_type;
typedef typename IMPL_TYPE::storage_type storage_type; typedef typename IMPL_TYPE::storage_type storage_type;
typedef typename IMPL_TYPE::indexmap_type indexmap_type; typedef typename IMPL_TYPE::indexmap_type indexmap_type;
typedef vector <ValueType,Opt> non_view_type; typedef vector <ValueType,Opt> regular_type;
typedef vector_view<ValueType,Opt> view_type; typedef vector_view<ValueType,Opt> view_type;
typedef vector_view<ValueType,Opt,true> weak_view_type; typedef vector_view<ValueType,Opt,true> weak_view_type;
typedef void has_view_type_tag; typedef void has_view_type_tag;

View File

@ -56,7 +56,7 @@ namespace triqs { namespace gfs {
/// --------------------------- data access --------------------------------- /// --------------------------- data access ---------------------------------
template<typename Target, typename Opt> struct data_proxy<block_index,Target,Opt> : data_proxy_vector <typename non_view_type_if_exists_else_type<Target>::type>{}; template<typename Target, typename Opt> struct data_proxy<block_index,Target,Opt> : data_proxy_vector <typename regular_type_if_exists_else_type<Target>::type>{};
// ------------------------------- Factories -------------------------------------------------- // ------------------------------- Factories --------------------------------------------------

View File

@ -98,7 +98,7 @@ namespace triqs { namespace gfs {
// Pattern : ValueView // Pattern : ValueView
typedef gf_view<Variable,Target,Opt> view_type; typedef gf_view<Variable,Target,Opt> view_type;
typedef gf<Variable,Target,Opt> non_view_type; typedef gf<Variable,Target,Opt> regular_type;
typedef gf_desc<Variable,Target,Opt> descriptor_t; typedef gf_desc<Variable,Target,Opt> descriptor_t;
@ -113,9 +113,9 @@ namespace triqs { namespace gfs {
typedef gfs_implementation::evaluator<Variable,Target,Opt> evaluator_t; typedef gfs_implementation::evaluator<Variable,Target,Opt> evaluator_t;
typedef gfs_implementation::data_proxy<Variable,Target,Opt> data_proxy_t; typedef gfs_implementation::data_proxy<Variable,Target,Opt> data_proxy_t;
typedef typename data_proxy_t::storage_t data_non_view_t; typedef typename data_proxy_t::storage_t data_regular_t;
typedef typename data_proxy_t::storage_view_t data_view_t; typedef typename data_proxy_t::storage_view_t data_view_t;
typedef typename std::conditional<IsView, data_view_t, data_non_view_t>::type data_t; typedef typename std::conditional<IsView, data_view_t, data_regular_t>::type data_t;
typedef typename gfs_implementation::singularity<Variable,Target,Opt>::type singularity_non_view_t; typedef typename gfs_implementation::singularity<Variable,Target,Opt>::type singularity_non_view_t;
typedef typename view_type_if_exists_else_type<singularity_non_view_t>::type singularity_view_t; typedef typename view_type_if_exists_else_type<singularity_non_view_t>::type singularity_view_t;

View File

@ -75,7 +75,7 @@ namespace triqs { namespace gfs {
template<typename MeshType> template<typename MeshType>
static gf_t make_gf(MeshType && m, tqa::mini_vector<size_t,2> shape, local::tail_view const & t) { static gf_t make_gf(MeshType && m, tqa::mini_vector<size_t,2> shape, local::tail_view const & t) {
typename gf_t::data_non_view_t A(shape.front_append(m.size())); A() =0; typename gf_t::data_regular_t A(shape.front_append(m.size())); A() =0;
return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ; return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ;
} }
static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape) { static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape) {
@ -95,7 +95,7 @@ namespace triqs { namespace gfs {
template<typename MeshType> template<typename MeshType>
static gf_t make_gf(MeshType && m, local::tail_view const & t) { static gf_t make_gf(MeshType && m, local::tail_view const & t) {
typename gf_t::data_non_view_t A(m.size()); A() =0; typename gf_t::data_regular_t A(m.size()); A() =0;
return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ; return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ;
} }
static gf_t make_gf(double beta, statistic_enum S) { static gf_t make_gf(double beta, statistic_enum S) {

View File

@ -130,7 +130,7 @@ namespace triqs { namespace gfs {
typedef gf<imtime,matrix_valued,Opt> gf_t; typedef gf<imtime,matrix_valued,Opt> gf_t;
template<typename MeshType> template<typename MeshType>
static gf_t make_gf(MeshType && m, tqa::mini_vector<size_t,2> shape, local::tail_view const & t) { static gf_t make_gf(MeshType && m, tqa::mini_vector<size_t,2> shape, local::tail_view const & t) {
typename gf_t::data_non_view_t A(shape.front_append(m.size())); A() =0; typename gf_t::data_regular_t A(shape.front_append(m.size())); A() =0;
//return gf_t ( m, std::move(A), t, nothing() ) ; //return gf_t ( m, std::move(A), t, nothing() ) ;
return gf_t (std::forward<MeshType>(m), std::move(A), t, nothing(), evaluator<imtime,matrix_valued,Opt>(shape[0],shape[1]) ) ; return gf_t (std::forward<MeshType>(m), std::move(A), t, nothing(), evaluator<imtime,matrix_valued,Opt>(shape[0],shape[1]) ) ;
} }
@ -147,7 +147,7 @@ namespace triqs { namespace gfs {
typedef gf<imtime,scalar_valued,Opt> gf_t; typedef gf<imtime,scalar_valued,Opt> gf_t;
template<typename MeshType> template<typename MeshType>
static gf_t make_gf(MeshType && m, local::tail_view const & t) { static gf_t make_gf(MeshType && m, local::tail_view const & t) {
typename gf_t::data_non_view_t A(m.size()); A() =0; typename gf_t::data_regular_t A(m.size()); A() =0;
return gf_t (std::forward<MeshType>(m), std::move(A), t, nothing()); return gf_t (std::forward<MeshType>(m), std::move(A), t, nothing());
} }
static gf_t make_gf(double beta, statistic_enum S, size_t Nmax=1025, mesh_kind mk= half_bins) { static gf_t make_gf(double beta, statistic_enum S, size_t Nmax=1025, mesh_kind mk= half_bins) {

View File

@ -65,7 +65,7 @@ namespace triqs { namespace gfs {
typedef typename mesh<legendre, Opt>::type mesh_t; typedef typename mesh<legendre, Opt>::type mesh_t;
static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape, size_t n_leg) { static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape, size_t n_leg) {
typename gf_t::data_non_view_t A(shape.front_append(n_leg)); A() = 0; typename gf_t::data_regular_t A(shape.front_append(n_leg)); A() = 0;
return gf_t(mesh<legendre,Opt>::make(beta, S, n_leg), std::move(A), nothing(), nothing()); return gf_t(mesh<legendre,Opt>::make(beta, S, n_leg), std::move(A), nothing(), nothing());
} }

View File

@ -52,15 +52,15 @@ namespace triqs { namespace gfs { namespace local {
public : public :
typedef void has_view_type_tag; // Idiom : ValueView typedef void has_view_type_tag; // Idiom : ValueView
typedef tail_view view_type; typedef tail_view view_type;
typedef tail non_view_type; typedef tail regular_type;
typedef arrays::array <dcomplex,3> data_non_view_type; typedef arrays::array <dcomplex,3> data_regular_type;
typedef arrays::array_view <dcomplex,3> data_view_type; typedef arrays::array_view <dcomplex,3> data_view_type;
typedef typename mpl::if_c<IsView, data_view_type, data_non_view_type>::type data_type; typedef typename mpl::if_c<IsView, data_view_type, data_regular_type>::type data_type;
typedef arrays::array<long,2> mask_non_view_type; typedef arrays::array<long,2> mask_regular_type;
typedef arrays::array_view<long,2> mask_view_type; typedef arrays::array_view<long,2> mask_view_type;
typedef typename mpl::if_c<IsView, mask_view_type, mask_non_view_type>::type mask_type; typedef typename mpl::if_c<IsView, mask_view_type, mask_regular_type>::type mask_type;
typedef arrays::matrix_view<dcomplex> mv_type; typedef arrays::matrix_view<dcomplex> mv_type;
typedef arrays::matrix_view<dcomplex> const_mv_type; typedef arrays::matrix_view<dcomplex> const_mv_type;
@ -116,13 +116,13 @@ namespace triqs { namespace gfs { namespace local {
const_mv_type operator() (int n) const { const_mv_type operator() (int n) const {
if (n>this->order_max()) TRIQS_RUNTIME_ERROR<<" n > Max Order. n= "<<n <<", Max Order = "<<order_max() ; if (n>this->order_max()) TRIQS_RUNTIME_ERROR<<" n > Max Order. n= "<<n <<", Max Order = "<<order_max() ;
if (n<this->order_min()) { mv_type::non_view_type r(this->shape()); r()=0; return r;} if (n<this->order_min()) { mv_type::regular_type r(this->shape()); r()=0; return r;}
return this->_data(n-omin,tqa::range(), tqa::range()); return this->_data(n-omin,tqa::range(), tqa::range());
} }
/// same as (), but if n is too large, then returns 0 instead of raising an exception /// same as (), but if n is too large, then returns 0 instead of raising an exception
const_mv_type get_or_zero (int n) const { const_mv_type get_or_zero (int n) const {
if ( (n>this->order_max()) || (n<this->order_min()) ) { mv_type::non_view_type r(this->shape()); r()=0; return r;} if ( (n>this->order_max()) || (n<this->order_min()) ) { mv_type::regular_type r(this->shape()); r()=0; return r;}
return this->_data(n-omin,tqa::range(), tqa::range()); return this->_data(n-omin,tqa::range(), tqa::range());
} }

View File

@ -160,7 +160,7 @@ namespace triqs { namespace gfs {
template<typename ... Meshes> template<typename ... Meshes>
static gf_t make_gf(Meshes && ... meshes) { static gf_t make_gf(Meshes && ... meshes) {
auto m = make_gf_mesh<cartesian_product<Ms...>,Opt>(meshes...); auto m = make_gf_mesh<cartesian_product<Ms...>,Opt>(meshes...);
typename gf_t::data_non_view_t A(m.size()); typename gf_t::data_regular_t A(m.size());
A() =0; A() =0;
return gf_t (m, std::move(A), nothing(), nothing()); return gf_t (m, std::move(A), nothing(), nothing());
} }

View File

@ -77,7 +77,7 @@ namespace triqs { namespace gfs {
static gf_t make_gf(double wmin, double wmax, size_t nw, double beta, statistic_enum S, size_t nwn) { static gf_t make_gf(double wmin, double wmax, size_t nw, double beta, statistic_enum S, size_t nwn) {
auto m = make_gf_mesh<re_im_freq,Opt>(wmin, wmax, nw, beta, S, nwn); auto m = make_gf_mesh<re_im_freq,Opt>(wmin, wmax, nw, beta, S, nwn);
typename gf_t::data_non_view_t A(m.size()); typename gf_t::data_regular_t A(m.size());
A() =0; A() =0;
return gf_t (m, std::move(A), gfs::make_gf<refreq,scalar_valued>(wmin, wmax, nw), nothing() ) ; return gf_t (m, std::move(A), gfs::make_gf<refreq,scalar_valued>(wmin, wmax, nw), nothing() ) ;
} }

View File

@ -81,14 +81,14 @@ namespace triqs { namespace gfs {
template<typename MeshType> template<typename MeshType>
static gf_t make_gf(MeshType && m) { static gf_t make_gf(MeshType && m) {
typename gf_t::data_non_view_t A(m.size()); typename gf_t::data_regular_t A(m.size());
A() =0; A() =0;
return gf_t (m, std::move(A), nothing(), nothing() ) ; return gf_t (m, std::move(A), nothing(), nothing() ) ;
} }
static gf_t make_gf(double tmin, double tmax, size_t nt, double beta, statistic_enum S, size_t ntau, mesh_kind mk=full_bins) { static gf_t make_gf(double tmin, double tmax, size_t nt, double beta, statistic_enum S, size_t ntau, mesh_kind mk=full_bins) {
auto m = make_gf_mesh<re_im_time,Opt>(tmin,tmax, nt, beta, S, ntau, mk); auto m = make_gf_mesh<re_im_time,Opt>(tmin,tmax, nt, beta, S, ntau, mk);
typename gf_t::data_non_view_t A(m.size()); typename gf_t::data_regular_t A(m.size());
A() =0; A() =0;
return gf_t (m, std::move(A), nothing(), nothing()); return gf_t (m, std::move(A), nothing(), nothing());
//return gf_t (m, std::move(A), make_gf<retime,scalar_valued>(tmin, tmax, nt), nothing()); //return gf_t (m, std::move(A), make_gf<retime,scalar_valued>(tmin, tmax, nt), nothing());

View File

@ -54,7 +54,7 @@ namespace triqs { namespace gfs {
typedef typename std::conditional < std::is_same<Target, matrix_valued>::value, arrays::matrix<std::complex<double> >, std::complex<double>>::type rtype; typedef typename std::conditional < std::is_same<Target, matrix_valued>::value, arrays::matrix<std::complex<double> >, std::complex<double>>::type rtype;
template<typename G> template<typename G>
rtype operator() (G const * g,double w0) const { rtype operator() (G const * g,double w0) const {
//auto operator() (G const * g,double w0) const -> typename decltype ((*g)[0])::non_view_type { //auto operator() (G const * g,double w0) const -> typename decltype ((*g)[0])::regular_type {
size_t n; double w; bool in; size_t n; double w; bool in;
std::tie(in, n, w) = windowing(g->mesh(),w0); std::tie(in, n, w) = windowing(g->mesh(),w0);
if (!in) TRIQS_RUNTIME_ERROR <<" Evaluation out of bounds"; if (!in) TRIQS_RUNTIME_ERROR <<" Evaluation out of bounds";
@ -77,17 +77,17 @@ namespace triqs { namespace gfs {
template<typename MeshType> template<typename MeshType>
static gf_t make_gf(MeshType && m, tqa::mini_vector<size_t,2> shape, local::tail_view const & t) { static gf_t make_gf(MeshType && m, tqa::mini_vector<size_t,2> shape, local::tail_view const & t) {
typename gf_t::data_non_view_t A(shape.front_append(m.size())); A() =0; typename gf_t::data_regular_t A(shape.front_append(m.size())); A() =0;
return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ; return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ;
} }
static gf_t make_gf(double wmin, double wmax, size_t n_freq, tqa::mini_vector<size_t,2> shape) { static gf_t make_gf(double wmin, double wmax, size_t n_freq, tqa::mini_vector<size_t,2> shape) {
typename gf_t::data_non_view_t A(shape.front_append(n_freq)); A() =0; typename gf_t::data_regular_t A(shape.front_append(n_freq)); A() =0;
return gf_t(mesh<refreq,Opt>::make(wmin, wmax, n_freq, full_bins), std::move(A), local::tail(shape), nothing()); return gf_t(mesh<refreq,Opt>::make(wmin, wmax, n_freq, full_bins), std::move(A), local::tail(shape), nothing());
} }
static gf_t make_gf(double wmin, double wmax, size_t n_freq, tqa::mini_vector<size_t,2> shape, mesh_kind mk) { static gf_t make_gf(double wmin, double wmax, size_t n_freq, tqa::mini_vector<size_t,2> shape, mesh_kind mk) {
typename gf_t::data_non_view_t A(shape.front_append(n_freq)); A() =0; typename gf_t::data_regular_t A(shape.front_append(n_freq)); A() =0;
return gf_t(mesh<refreq,Opt>::make(wmin, wmax, n_freq, mk), std::move(A), local::tail(shape), nothing()); return gf_t(mesh<refreq,Opt>::make(wmin, wmax, n_freq, mk), std::move(A), local::tail(shape), nothing());
} }
}; };
@ -98,17 +98,17 @@ namespace triqs { namespace gfs {
template<typename MeshType> template<typename MeshType>
static gf_t make_gf(MeshType && m, local::tail_view const & t) { static gf_t make_gf(MeshType && m, local::tail_view const & t) {
typename gf_t::data_non_view_t A(m.size()); A() =0; typename gf_t::data_regular_t A(m.size()); A() =0;
return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ; return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ;
} }
static gf_t make_gf(double wmin, double wmax, size_t n_freq) { static gf_t make_gf(double wmin, double wmax, size_t n_freq) {
typename gf_t::data_non_view_t A(n_freq); A() =0; typename gf_t::data_regular_t A(n_freq); A() =0;
return gf_t(mesh<refreq,Opt>::make(wmin, wmax, n_freq), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing()); return gf_t(mesh<refreq,Opt>::make(wmin, wmax, n_freq), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing());
} }
static gf_t make_gf(double wmin, double wmax, size_t n_freq, mesh_kind mk) { static gf_t make_gf(double wmin, double wmax, size_t n_freq, mesh_kind mk) {
typename gf_t::data_non_view_t A(n_freq); A() =0; typename gf_t::data_regular_t A(n_freq); A() =0;
return gf_t(mesh<refreq,Opt>::make(wmin, wmax, n_freq, mk), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing()); return gf_t(mesh<refreq,Opt>::make(wmin, wmax, n_freq, mk), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing());
} }

View File

@ -83,14 +83,14 @@ namespace triqs { namespace gfs {
template<typename MeshType> template<typename MeshType>
static gf_t make_gf(MeshType && m) { static gf_t make_gf(MeshType && m) {
typename gf_t::data_non_view_t A(m.size()); typename gf_t::data_regular_t A(m.size());
A() =0; A() =0;
return gf_t (m, std::move(A), nothing(), nothing() ) ; return gf_t (m, std::move(A), nothing(), nothing() ) ;
} }
static gf_t make_gf(double wmin, double wmax, size_t n_freq, double beta, statistic_enum S, size_t nt, mesh_kind mk=full_bins) { static gf_t make_gf(double wmin, double wmax, size_t n_freq, double beta, statistic_enum S, size_t nt, mesh_kind mk=full_bins) {
auto m = make_gf_mesh<refreq_imtime,Opt>(wmin, wmax, n_freq, beta,S, nt, mk); auto m = make_gf_mesh<refreq_imtime,Opt>(wmin, wmax, n_freq, beta,S, nt, mk);
typename gf_t::data_non_view_t A(m.size()); typename gf_t::data_regular_t A(m.size());
A() =0; A() =0;
return gf_t (m, std::move(A), nothing(), nothing() ) ; return gf_t (m, std::move(A), nothing(), nothing() ) ;
} }

View File

@ -79,17 +79,17 @@ namespace triqs { namespace gfs {
template<typename MeshType> template<typename MeshType>
static gf_t make_gf(MeshType && m, tqa::mini_vector<size_t,2> shape, local::tail_view const t) { static gf_t make_gf(MeshType && m, tqa::mini_vector<size_t,2> shape, local::tail_view const t) {
typename gf_t::data_non_view_t A(shape.front_append(m.size())); A() =0; typename gf_t::data_regular_t A(shape.front_append(m.size())); A() =0;
return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ; return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ;
} }
static gf_t make_gf(double tmin, double tmax, size_t n_points, tqa::mini_vector<size_t,2> shape, mesh_kind mk) { static gf_t make_gf(double tmin, double tmax, size_t n_points, tqa::mini_vector<size_t,2> shape, mesh_kind mk) {
typename gf_t::data_non_view_t A(shape.front_append(n_points)); A() =0; typename gf_t::data_regular_t A(shape.front_append(n_points)); A() =0;
return gf_t(mesh<retime,Opt>::make(tmin, tmax, n_points,mk), std::move(A), local::tail(shape), nothing()); return gf_t(mesh<retime,Opt>::make(tmin, tmax, n_points,mk), std::move(A), local::tail(shape), nothing());
} }
static gf_t make_gf(double tmin, double tmax, size_t n_points, tqa::mini_vector<size_t,2> shape) { static gf_t make_gf(double tmin, double tmax, size_t n_points, tqa::mini_vector<size_t,2> shape) {
typename gf_t::data_non_view_t A(shape.front_append(n_points)); A() =0; typename gf_t::data_regular_t A(shape.front_append(n_points)); A() =0;
return gf_t(mesh<retime,Opt>::make(tmin, tmax, n_points), std::move(A), local::tail(shape), nothing()); return gf_t(mesh<retime,Opt>::make(tmin, tmax, n_points), std::move(A), local::tail(shape), nothing());
} }
@ -101,17 +101,17 @@ namespace triqs { namespace gfs {
template<typename MeshType> template<typename MeshType>
static gf_t make_gf(MeshType && m, local::tail_view const t) { static gf_t make_gf(MeshType && m, local::tail_view const t) {
typename gf_t::data_non_view_t A(m.size()); A() =0; typename gf_t::data_regular_t A(m.size()); A() =0;
return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ; return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ;
} }
static gf_t make_gf(double tmin, double tmax, size_t n_points, mesh_kind mk) { static gf_t make_gf(double tmin, double tmax, size_t n_points, mesh_kind mk) {
typename gf_t::data_non_view_t A(n_points); A() =0; typename gf_t::data_regular_t A(n_points); A() =0;
return gf_t(mesh<retime,Opt>::make(tmin, tmax, n_points,mk), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing()); return gf_t(mesh<retime,Opt>::make(tmin, tmax, n_points,mk), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing());
} }
static gf_t make_gf(double tmin, double tmax, size_t n_points) { static gf_t make_gf(double tmin, double tmax, size_t n_points) {
typename gf_t::data_non_view_t A(n_points); A() =0; typename gf_t::data_regular_t A(n_points); A() =0;
return gf_t(mesh<retime,Opt>::make(tmin, tmax, n_points), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing()); return gf_t(mesh<retime,Opt>::make(tmin, tmax, n_points), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing());
} }

View File

@ -76,7 +76,7 @@ namespace triqs { namespace gfs {
nothing() {} nothing() {}
typedef void has_view_type_tag; // Idiom : ValueView typedef void has_view_type_tag; // Idiom : ValueView
typedef nothing view_type; typedef nothing view_type;
typedef nothing non_view_type; typedef nothing regular_type;
void rebind (nothing){} void rebind (nothing){}
template< typename RHS> void operator=(RHS && ) {} template< typename RHS> void operator=(RHS && ) {}
friend void h5_write (h5::group, std::string subgroup_name, nothing ) {} friend void h5_write (h5::group, std::string subgroup_name, nothing ) {}

View File

@ -95,7 +95,7 @@ namespace triqs { namespace gfs {
static gf_t make_gf(double tmax, double n_time_slices, tqa::mini_vector<size_t,2> shape) { static gf_t make_gf(double tmax, double n_time_slices, tqa::mini_vector<size_t,2> shape) {
auto m = mesh<two_real_times,Opt>::make(tmax, n_time_slices); auto m = mesh<two_real_times,Opt>::make(tmax, n_time_slices);
typename gf_t::data_non_view_t A(shape.front_append(m.size())); A() =0; typename gf_t::data_regular_t A(shape.front_append(m.size())); A() =0;
return gf_t (m, std::move(A), nothing(), nothing() ) ; return gf_t (m, std::move(A), nothing(), nothing() ) ;
} }
}; };

View File

@ -31,7 +31,7 @@ namespace triqs { namespace h5 {
template<typename T> template<typename T>
struct h5_extractor { struct h5_extractor {
typename view_type_if_exists_else_type<T>::type operator() (group fg, std::string const & subgroup_name) const { typename view_type_if_exists_else_type<T>::type operator() (group fg, std::string const & subgroup_name) const {
typename non_view_type_if_exists_else_type<T>::type r; typename regular_type_if_exists_else_type<T>::type r;
h5_read(fg,subgroup_name,r); h5_read(fg,subgroup_name,r);
return r; return r;
} }

View File

@ -52,7 +52,7 @@ namespace triqs { namespace lattice_tools {
brillouin_zone bz_; brillouin_zone bz_;
// deduce the return type from decltype(begin()->second) // deduce the return type from decltype(begin()->second)
public: public:
typedef typename non_view_type_if_exists_else_type< decltype(f.begin()->second)>::type return_construct_type; typedef typename regular_type_if_exists_else_type< decltype(f.begin()->second)>::type return_construct_type;
typedef typename view_type_if_exists_else_type<return_construct_type>::type return_type; typedef typename view_type_if_exists_else_type<return_construct_type>::type return_type;
typedef K_view_type arg_type; typedef K_view_type arg_type;

View File

@ -29,7 +29,7 @@ namespace triqs { namespace python_tools {
// This class must be friend of V, to use the private default constructor. // This class must be friend of V, to use the private default constructor.
template<typename V> class cython_proxy : public V { template<typename V> class cython_proxy : public V {
public: public:
cython_proxy() : V(typename V::non_view_type()) {} cython_proxy() : V(typename V::regular_type()) {}
cython_proxy(V const &v) : V(v){}; cython_proxy(V const &v) : V(v){};
cython_proxy(cython_proxy const & cp) : V(cp) {}; cython_proxy(cython_proxy const & cp) : V(cp) {};
template<typename ... Args> explicit cython_proxy(Args && ... args) : V (std::forward<Args>(args)...){} template<typename ... Args> explicit cython_proxy(Args && ... args) : V (std::forward<Args>(args)...){}

View File

@ -37,9 +37,9 @@ namespace triqs {
public: public:
typedef void has_view_type_tag; // Idiom : ValueView typedef void has_view_type_tag; // Idiom : ValueView
typedef value_view<T,true> view_type; typedef value_view<T,true> view_type;
typedef value_view<T,false> non_view_type; typedef value_view<T,false> regular_type;
typedef typename std::remove_cv<typename std::remove_reference <T>::type >::type value_type; typedef typename std::remove_cv<typename std::remove_reference <T>::type >::type value_type;
value_view( non_view_type const & a) { p = a.p;} value_view( regular_type const & a) { p = a.p;}
value_view( view_type const & a) { p = a.p;} value_view( view_type const & a) { p = a.p;}
void rebind( view_type const &X) { p = X.p; } void rebind( view_type const &X) { p = X.p; }
@ -48,7 +48,7 @@ namespace triqs {
operator T() { return *p;} operator T() { return *p;}
operator T const() const { return *p;} operator T const() const { return *p;}
value_view & operator=(view_type const & x) { if (!p) rebind(x); else { *p = *x.p;} return *this;} value_view & operator=(view_type const & x) { if (!p) rebind(x); else { *p = *x.p;} return *this;}
value_view & operator=(non_view_type const & x) { if (!p) rebind(x); else { *p = *x.p;} return *this;} value_view & operator=(regular_type const & x) { if (!p) rebind(x); else { *p = *x.p;} return *this;}
value_view & operator=(T const & x) { *p = x; return *this;} value_view & operator=(T const & x) { *p = x; return *this;}
friend void h5_write (arrays::h5::group_or_file fg, std::string p, value_view const & v) { h5_write(fg,p,v()); } friend void h5_write (arrays::h5::group_or_file fg, std::string p, value_view const & v) { h5_write(fg,p,v()); }
@ -68,9 +68,9 @@ namespace triqs {
public: public:
typedef void has_view_type_tag; // Idiom : ValueView typedef void has_view_type_tag; // Idiom : ValueView
typedef value_view<T,true> view_type; typedef value_view<T,true> view_type;
typedef value_view<T,false> non_view_type; typedef value_view<T,false> regular_type;
typedef typename std::remove_cv<typename std::remove_reference <T>::type >::type value_type; typedef typename std::remove_cv<typename std::remove_reference <T>::type >::type value_type;
value_view( non_view_type const & a) { p = std::make_shared<T>(*a.p);} value_view( regular_type const & a) { p = std::make_shared<T>(*a.p);}
value_view( view_type const & a) { p = std::make_shared<T>(*a.p);} value_view( view_type const & a) { p = std::make_shared<T>(*a.p);}
template<typename... Args> explicit value_view(Args&&... args) {p = std::make_shared<T>(std::forward<Args>(args)...);} template<typename... Args> explicit value_view(Args&&... args) {p = std::make_shared<T>(std::forward<Args>(args)...);}
T & operator()() { return *p;} T & operator()() { return *p;}
@ -78,7 +78,7 @@ namespace triqs {
operator T() { return *p;} operator T() { return *p;}
operator T const() const { return *p;} operator T const() const { return *p;}
value_view& operator=(view_type const & x) { *p = *x.p;return *this;} value_view& operator=(view_type const & x) { *p = *x.p;return *this;}
value_view& operator=(non_view_type const & x) { *p = *x.p;return *this;} value_view& operator=(regular_type const & x) { *p = *x.p;return *this;}
value_view& operator=(T const & x) { *p = x; return *this;} value_view& operator=(T const & x) { *p = x; return *this;}
friend void h5_write (arrays::h5::group_or_file fg, std::string p, value_view const & v) { h5_write(fg,p,v()); } friend void h5_write (arrays::h5::group_or_file fg, std::string p, value_view const & v) { h5_write(fg,p,v()); }

View File

@ -60,7 +60,7 @@ namespace triqs {
} }
template <typename T> void deserialize_into_view (std::string const & serial_str, T & x) { template <typename T> void deserialize_into_view (std::string const & serial_str, T & x) {
typename non_view_type_if_exists_else_type<T>::type obj; typename regular_type_if_exists_else_type<T>::type obj;
// wrap buffer inside a stream and deserialize serial_str into obj // wrap buffer inside a stream and deserialize serial_str into obj
boost::iostreams::basic_array_source<char> device(serial_str.data(), serial_str.size()); boost::iostreams::basic_array_source<char> device(serial_str.data(), serial_str.size());
boost::iostreams::stream<boost::iostreams::basic_array_source<char> > s(device); boost::iostreams::stream<boost::iostreams::basic_array_source<char> > s(device);

View File

@ -51,4 +51,4 @@ void serialize(Archive & ar, std::tuple<ElementTypes...> & t, const unsigned int
} // namespace serialization } // namespace serialization
} // namespace boost } // namespace boost
#endif #endif

View File

@ -30,11 +30,11 @@ namespace triqs {
template<typename T> void nop(T ...){}; template<typename T> void nop(T ...){};
template<typename T, typename Enable=void> struct has_view : std::false_type {}; template<typename T, typename Enable=void> struct has_view : std::false_type {};
template<typename T> struct has_view<T, decltype(nop(std::declval<typename T::view_type>(),std::declval<typename T::non_view_type>()))> : std::true_type {}; template<typename T> struct has_view<T, decltype(nop(std::declval<typename T::view_type>(),std::declval<typename T::regular_type>()))> : std::true_type {};
template<typename T, bool HasView = has_view<T>::value> struct non_view_type_if_exists_else_type; template<typename T, bool HasView = has_view<T>::value> struct regular_type_if_exists_else_type;
template<typename T> struct non_view_type_if_exists_else_type<T,false> {typedef T type;}; template<typename T> struct regular_type_if_exists_else_type<T,false> {typedef T type;};
template<typename T> struct non_view_type_if_exists_else_type<T,true > {typedef typename T::non_view_type type;}; template<typename T> struct regular_type_if_exists_else_type<T,true > {typedef typename T::regular_type type;};
template<typename T, bool HasView = has_view<T>::value> struct view_type_if_exists_else_type; template<typename T, bool HasView = has_view<T>::value> struct view_type_if_exists_else_type;
template<typename T> struct view_type_if_exists_else_type<T,false> {typedef T type;}; template<typename T> struct view_type_if_exists_else_type<T,false> {typedef T type;};
@ -47,8 +47,8 @@ namespace triqs {
#else #else
template<typename T, typename Void =void> struct non_view_type_if_exists_else_type {typedef T type;}; template<typename T, typename Void =void> struct regular_type_if_exists_else_type {typedef T type;};
template<typename T> struct non_view_type_if_exists_else_type<T, typename T::has_view_type_tag> {typedef typename T::non_view_type type;}; template<typename T> struct regular_type_if_exists_else_type<T, typename T::has_view_type_tag> {typedef typename T::regular_type type;};
template<typename T, typename Void =void> struct view_type_if_exists_else_type {typedef T type;}; template<typename T, typename Void =void> struct view_type_if_exists_else_type {typedef T type;};
template<typename T> struct view_type_if_exists_else_type<T, typename T::has_view_type_tag> {typedef typename T::view_type type;}; template<typename T> struct view_type_if_exists_else_type<T, typename T::has_view_type_tag> {typedef typename T::view_type type;};
@ -62,7 +62,7 @@ namespace triqs {
// replacement of std::plus for views ... // replacement of std::plus for views ...
template <class T> struct add_views : std::binary_function <T,T,T> { template <class T> struct add_views : std::binary_function <T,T,T> {
T operator() (const T& x, const T& y) const T operator() (const T& x, const T& y) const
{ typename T::non_view_type r(x); r =r + y; return r;} { typename T::regular_type r(x); r =r + y; return r;}
}; };