From 603e397e166296fc15baf4ea7737d7179b1b7758 Mon Sep 17 00:00:00 2001 From: Olivier Parcollet Date: Tue, 22 Oct 2013 21:28:25 +0200 Subject: [PATCH] gf. Clean code, rereading for doc - no major change. Code cleaning + clang-format. --- triqs/gfs/gf.hpp | 479 +++++++++++++++++++++++-------------------- triqs/gfs/imtime.hpp | 6 +- 2 files changed, 260 insertions(+), 225 deletions(-) diff --git a/triqs/gfs/gf.hpp b/triqs/gfs/gf.hpp index 0898fa4f..c4b7552e 100644 --- a/triqs/gfs/gf.hpp +++ b/triqs/gfs/gf.hpp @@ -33,13 +33,11 @@ namespace triqs { namespace gfs { using utility::factory; using arrays::make_shape; - template long get_shape(std::vector const &x) { return x.size(); } - // the gf mesh template struct gf_mesh; // The regular type - template class gf; + template class gf; // The view type template class gf_view; @@ -70,77 +68,16 @@ namespace triqs { namespace gfs { // this is used to specialize this part of the code to array of dim 3 (matrix gf), dim 1 (scalar gf) and vector (e.g. block gf, ...) template struct data_proxy; - // This trait contains functions to read/write in hdf5 files. Can be specialized for some case (Cf block) - template struct h5_name; // value is a const char * - - template struct h5_name { static std::string invoke(){ return h5_name::invoke() + "_s";}}; - - // the h5 write and read of gf members, so that we can specialize it e.g. for block gf - template struct h5_rw { - - static void write (h5::group gr, gf_const_view g) { - h5_write(gr,"data",g._data); - h5_write(gr,"singularity",g._singularity); - h5_write(gr,"mesh",g._mesh); - h5_write(gr,"symmetry",g._symmetry); - } - - template - static void read (h5::group gr, gf_impl & g) { - h5_read(gr,"data",g._data); - h5_read(gr,"singularity",g._singularity); - h5_read(gr,"mesh",g._mesh); - h5_read(gr,"symmetry",g._symmetry); - } - }; - - // factories regroup all factories (constructors..) for all types of gf. + // Traits to read/write in hdf5 files. Can be specialized for some case (Cf block). Defined below + template struct h5_name; // value is a const char + template struct h5_rw; + + // factories regroup all factories (constructors..) for all types of gf. Defaults implemented below. template struct factories; - template struct factories,Opt> { - typedef gf,Opt> gf_t; - typedef tqa::mini_vector target_shape_t; - typedef typename gf_t::mesh_t mesh_t; - - static typename gf_t::data_t make_data(mesh_t const & m, target_shape_t shape) { - typename gf_t::data_t A(shape.front_append(m.size())); - A() =0; - return A; - } - - static typename gf_t::singularity_t make_singularity(mesh_t const & m, target_shape_t shape) { return typename gf_t::singularity_t(shape); } - }; - - template struct factories { - typedef gf gf_t; - typedef tqa::mini_vector target_shape_t; - typedef typename gf_t::mesh_t mesh_t; - - static typename gf_t::data_t make_data(mesh_t const & m, target_shape_t shape) { - typename gf_t::data_t A(shape.front_append(m.size())); - A() =0; - return A; - } - - static typename gf_t::singularity_t make_singularity(mesh_t const & m, target_shape_t shape) { return typename gf_t::singularity_t(shape); } - }; - - template struct factories { - typedef gf gf_t; - struct target_shape_t {}; - typedef typename gf_t::mesh_t mesh_t; - - static typename gf_t::data_t make_data(mesh_t const & m, target_shape_t shape) { - typename gf_t::data_t A(m.size()); - A() =0; - return A; - } - static typename gf_t::singularity_t make_singularity(mesh_t const & m, target_shape_t shape) { return typename gf_t::singularity_t {1,1} ; } - - }; - } // gfs_implementation + // OBSOLETE : kept for backward compatibility only. Do not document. // make_gf and make_gf_view forward any args to them template gf make_gf(gf_mesh m, U && ... x) @@ -155,15 +92,18 @@ namespace triqs { namespace gfs { // The trait that "marks" the Green function TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT(ImmutableGreenFunction); - template - auto get_gf_data_shape(G const & g) DECL_AND_RETURN(g.get_data_shape()); + template auto get_gf_data_shape(G const &g) DECL_AND_RETURN(g.get_data_shape()); // ---------------------- implementation -------------------------------- + // overload get_shape for a vector to simplify code below in gf block case. + template long get_shape(std::vector const &x) { return x.size(); } + /// A common implementation class for gf and gf_view. They will only redefine contructor and = ... - template class gf_impl : - TRIQS_CONCEPT_TAG_NAME(ImmutableGreenFunction){ - static_assert(!( !IsView && IsConst), "Internal error"); + template + class gf_impl : TRIQS_CONCEPT_TAG_NAME(ImmutableGreenFunction) { + static_assert(!(!IsView && IsConst), "Internal error"); + public : typedef gf_view mutable_view_type; typedef gf_const_view const_view_type; @@ -215,72 +155,84 @@ namespace triqs { namespace gfs { // all protected but one, this is an implementation class, see gf/gf_view later for public one gf_impl() {} // all arrays of zero size (empty) - public : //everyone can make a copy (for clef lib in particular, this one needs to be public) - - gf_impl(gf_impl const & x) : _mesh(x.mesh()), _data(factory(x.data())), - _singularity(factory(x.singularity())), _symmetry(x.symmetry()), _evaluator(x._evaluator){} + public : //everyone can make a copy and a move (for clef lib in particular, this one needs to be public) + gf_impl(gf_impl const &x) + : _mesh(x.mesh()), + _data(factory(x.data())), + _singularity(factory(x.singularity())), + _symmetry(x.symmetry()), + _evaluator(x._evaluator) {} gf_impl(gf_impl &&) = default; protected: + template + gf_impl(G &&x, bool) // bool to disambiguate + : _mesh(x.mesh()), + _data(factory(x.data())), + _singularity(factory(x.singularity())), + _symmetry(x.symmetry()), + _evaluator(x.get_evaluator()) {} - template - gf_impl(G && x, bool): _mesh(x.mesh()), _data(factory(x.data())), - _singularity(factory(x.singularity())), _symmetry(x.symmetry()), _evaluator(x.get_evaluator()){} - - template - gf_impl(M && m, D && dat, S && sing, SY && sy, EV && ev) : - _mesh(std::forward(m)), _data(std::forward(dat)), _singularity(std::forward(sing)),_symmetry(std::forward(sy)), _evaluator(std::forward(ev)){} + template + gf_impl(M &&m, D &&dat, S &&sing, SY &&sy, EV &&ev) + : _mesh(std::forward(m)), + _data(std::forward(dat)), + _singularity(std::forward(sing)), + _symmetry(std::forward(sy)), + _evaluator(std::forward(ev)) {} void operator = (gf_impl const & rhs) = delete; // done in derived class. void swap_impl (gf_impl & b) noexcept { using std::swap; - swap(this->_mesh, b._mesh); swap(this->_data, b._data); swap (this->_singularity,b._singularity); swap(this->_symmetry,b._symmetry); swap(this->_evaluator,b._evaluator); + swap(this->_mesh, b._mesh); + swap(this->_data, b._data); + swap(this->_singularity, b._singularity); + swap(this->_symmetry, b._symmetry); + swap(this->_evaluator, b._evaluator); } - public: + public: + // ------------- All the call operators ----------------------------- // First, a simple () returns a view, like for an array... - const_view_type operator()() const { return *this;} + const_view_type operator()() const { return *this; } view_type operator()() { return *this; } /// Calls are (perfectly) forwarded to the evaluator::operator(), except mesh_point_t and when /// there is at least one lazy argument ... - template // match any argument list, picking out the first type : () is not permitted - typename std::add_const< - typename boost::lazy_disable_if< // disable the template if one the following conditions it true - boost::mpl::or_< // starting condition [OR] - clef::is_any_lazy // One of Args is a lazy expression - , boost::mpl::bool_<(sizeof...(Args)!= evaluator_t::arity -1 ) && (evaluator_t::arity !=-1)> // if -1 : no check - >, // end of OR - std::result_of // what is the result type of call - >::type // end of lazy_disable_if - >::type // end of add_Const - operator() (Arg0&& arg0, Args&&... args) const { return _evaluator(this,std::forward( arg0), std::forward(args)...); } + template // match any argument list, picking out the first type : () is not permitted + typename std::add_const::value || + ((sizeof...(Args) != evaluator_t::arity) && (evaluator_t::arity != -1)) // if -1 : no check + , + std::result_of // what is the result type of call + >::type // end of lazy_disable_if + >::type // end of add_Const + operator()(Args &&... args) const { + return _evaluator(this, std::forward(args)...); + } - template - typename clef::_result_of::make_expr_call::type - operator()(Arg0 &&arg0, Args&&... args) & { - return clef::make_expr_call(*this,std::forward(arg0), std::forward(args)...); - } + template + typename clef::_result_of::make_expr_call::type operator()(Args &&... args) & { + return clef::make_expr_call(*this, std::forward(args)...); + } - template - typename clef::_result_of::make_expr_call::type - operator()(Arg0 &&arg0, Args&&... args) const & { - return clef::make_expr_call(*this,std::forward(arg0), std::forward(args)...); - } + template + typename clef::_result_of::make_expr_call::type operator()(Args &&... args) const &{ + return clef::make_expr_call(*this, std::forward(args)...); + } - template - typename clef::_result_of::make_expr_call::type - operator()(Arg0 &&arg0, Args&&... args) && { - return clef::make_expr_call(std::move(*this),std::forward(arg0), std::forward(args)...); - } + template typename clef::_result_of::make_expr_call::type operator()(Args &&... args) && { + return clef::make_expr_call(std::move(*this), std::forward(args)...); + } - //// [] and access to the grid point - typedef typename std::result_of::type r_type; - typedef typename std::result_of::type cr_type; + // ------------- All the [] operators ----------------------------- + // [] and access to the grid point + typedef typename std::result_of::type r_type; + typedef typename std::result_of::type cr_type; r_type operator[] (mesh_index_t const & arg) { return _data_proxy(_data,_mesh.index_to_linear(arg));} cr_type operator[] (mesh_index_t const & arg) const { return _data_proxy(_data,_mesh.index_to_linear(arg));} @@ -305,25 +257,31 @@ namespace triqs { namespace gfs { typename clef::_result_of::make_expr_subscript::type operator[](Arg && arg) && { return clef::make_expr_subscript(std::move(*this),std::forward(arg));} - /// A direct access to the grid point + /// --------------------- A direct access to the grid point -------------------------- template r_type on_mesh (Args&&... args) { return _data_proxy(_data,_mesh.index_to_linear(mesh_index_t(std::forward(args)...)));} template cr_type on_mesh (Args&&... args) const { return _data_proxy(_data,_mesh.index_to_linear(mesh_index_t(std::forward(args)...)));} - private: + // The on_mesh little adaptor .... + private: struct _on_mesh_wrapper_const { - gf_impl const & f; _on_mesh_wrapper_const (gf_impl const & _f) : f(_f) {} - template cr_type operator ()(Args && ... args) const { return f.on_mesh(std::forward(args)...);} + gf_impl const &f; + template cr_type operator()(Args &&... args) const { return f.on_mesh(std::forward(args)...); } }; struct _on_mesh_wrapper { - gf_impl & f; _on_mesh_wrapper (gf_impl & _f) : f(_f) {} - template r_type operator ()(Args && ... args) const { return f.on_mesh(std::forward(args)...);} + gf_impl &f; + template r_type operator()(Args &&... args) const { return f.on_mesh(std::forward(args)...); } }; - _on_mesh_wrapper_const friend on_mesh(gf_impl const & f) { return f;} - _on_mesh_wrapper friend on_mesh(gf_impl & f) { return f;} - public: + + public: + _on_mesh_wrapper_const friend on_mesh(gf_impl const &f) { + return {f}; + } + _on_mesh_wrapper friend on_mesh(gf_impl &f) { + return {f}; + } //----------------------------- HDF5 ----------------------------- @@ -388,28 +346,26 @@ namespace triqs { namespace gfs { } }; - // --------------------------------------------------------------------------------- - ///The regular class of GF + // -------------------------The regular class of GF -------------------------------------------------------- + template class gf : public gf_impl { typedef gf_impl B; typedef gfs_implementation::factories factory; public : + gf() : B() {} + gf(gf const &g) : B(g) {} + gf(gf &&g) noexcept : B(std::move(g)) {} + gf(gf_view const &g) : B(g, bool{}) {} + gf(gf_const_view const &g) : B(g, bool{}) {} - gf():B() {} - gf(gf const & g): B(g){} - gf(gf && g) noexcept : B(std::move(g)){} - gf(gf_view const & g): B(g, bool() ){} - gf(gf_const_view const & g): B(g, bool() ){} - - template gf(GfType const & x,typename std::enable_if::value>::type *dummy =0 ): B() { *this = x;} + template + gf(GfType const &x, typename std::enable_if::value>::type *dummy = 0) + : B() { + *this = x; + } - gf(typename B::mesh_t m, - typename B::data_t dat, - typename B::singularity_view_t const & si, - typename B::symmetry_t const & s , - typename B::evaluator_t const & eval = typename B::evaluator_t () - ) : - B(std::move(m),std::move(dat), si,s,eval) {} + gf(typename B::mesh_t m, typename B::data_t dat, typename B::singularity_view_t const &si, typename B::symmetry_t const &s) + : B(std::move(m), std::move(dat), si, s, typename B::evaluator_t{}) {} typedef typename factory::target_shape_t target_shape_t; @@ -433,72 +389,74 @@ namespace triqs { namespace gfs { }; - // --------------------------------------------------------------------------------- - ///The const View class of GF + // --------------------------The const View class of GF ------------------------------------------------------- + template class gf_view : public gf_impl { typedef gf_impl B; public : gf_view() = delete; - gf_view(gf_view const & g): B(g){} - gf_view(gf_view && g) noexcept : B(std::move(g)){} + gf_view(gf_view const &g) : B(g) {} + gf_view(gf_view &&g) noexcept : B(std::move(g)) {} - gf_view(gf_impl const & g) : B(g, bool()){} // from a const_view - gf_view(gf_impl const & g): B(g, bool()){} // from a view - gf_view(gf_impl const & g): B(g, bool()){} // from a const gf - gf_view(gf_impl & g): B(g, bool()){} // from a gf & - gf_view(gf_impl && g) noexcept: B(std::move(g), bool()){} // from a gf && + gf_view(gf_impl const &g) : B(g, bool{}) {} // from a const_view + gf_view(gf_impl const &g) : B(g, bool{}) {} // from a view + gf_view(gf_impl const &g) : B(g, bool{}) {} // from a const gf + gf_view(gf_impl &g) : B(g, bool{}) {} // from a gf & + gf_view(gf_impl &&g) noexcept : B(std::move(g), bool{}) {} // from a gf && - template - gf_view (typename B::mesh_t const & m, - D const & dat,typename B::singularity_view_t const & t,typename B::symmetry_t const & s, - typename B::evaluator_t const &e = typename B::evaluator_t () ) : - B(m,factory(dat),t,s,e) {} + template + gf_view(typename B::mesh_t const &m, D const &dat, typename B::singularity_view_t const &t, typename B::symmetry_t const &s) + : B(m, factory(dat), t, s, typename B::evaluator_t{}) {} - void rebind (gf_view const &X) noexcept { + void rebind(gf_view const &X) noexcept { this->_mesh = X._mesh; this->_symmetry = X._symmetry; this->_data_proxy.rebind(this->_data,X); this->_singularity.rebind(X._singularity); } - void rebind (gf_view const &X) noexcept { rebind (gf_view{X});} + void rebind(gf_view const &X) noexcept { + rebind(gf_view{X}); + } gf_view & operator = (gf_view const & ) = delete; - }; // class gf_const_view - // --------------------------------------------------------------------------------- - ///The View class of GF + // ------------------------- The View class of GF ------------------------------------------------------- + template class gf_view : public gf_impl { typedef gf_impl B; public : gf_view() = delete; - gf_view(gf_view const & g): B(g){} - gf_view(gf_view && g) noexcept : B(std::move(g)){} + gf_view(gf_view const &g) : B(g) {} + gf_view(gf_view &&g) noexcept : B(std::move(g)) {} - gf_view(gf_impl const & g) = delete; // from a const view : impossible - gf_view(gf_impl const & g): B(g, bool()){} // from a view - gf_view(gf_impl const & g) = delete; // from a const gf : impossible - //gf_view(gf_impl const & g): B(g, bool()){} // from a gf & - gf_view(gf_impl & g): B(g, bool()){} // from a gf & - gf_view(gf_impl && g) noexcept: B(std::move(g), bool()){} // from a gf && + gf_view(gf_impl const &g) = delete; // from a const view : impossible + gf_view(gf_impl const &g) : B(g, bool{}) {} // from a view + gf_view(gf_impl const &g) = delete; // from a const gf : impossible + gf_view(gf_impl &g) : B(g, bool{}) {} // from a gf & + gf_view(gf_impl &&g) noexcept : B(std::move(g), bool{}) {} // from a gf && - template - gf_view (typename B::mesh_t const & m, - D const & dat,typename B::singularity_view_t const & t,typename B::symmetry_t const & s, - typename B::evaluator_t const &e = typename B::evaluator_t () ) : - B(m,factory(dat),t,s,e) {} + template + gf_view(typename B::mesh_t const &m, D const &dat, typename B::singularity_view_t const &t, typename B::symmetry_t const &s) + : B(m, factory(dat), t, s, typename B::evaluator_t{}) {} friend void swap (gf_view & a, gf_view & b) noexcept { a.swap_impl (b);} - void rebind (gf_view const &X) noexcept { + void rebind(gf_view const &X) noexcept { this->_mesh = X._mesh; this->_symmetry = X._symmetry; this->_data_proxy.rebind(this->_data,X); this->_singularity.rebind(X._singularity); } - gf_view & operator = (gf_view const & rhs) { triqs_gf_view_assign_delegation(*this,rhs); return *this;} + gf_view &operator=(gf_view const &rhs) { + triqs_gf_view_assign_delegation(*this, rhs); + return *this; + } - template gf_view & operator = (RHS const & rhs) { triqs_gf_view_assign_delegation(*this,rhs); return *this;} + template gf_view &operator=(RHS const &rhs) { + triqs_gf_view_assign_delegation(*this, rhs); + return *this; + } }; // class gf_view // delegate = so that I can overload it for specific RHS... @@ -522,60 +480,62 @@ namespace triqs { namespace gfs { // ---------------------------------- slicing ------------------------------------ - // slice - template - gf_view slice_target(gf_view g, Args &&... args) { - static_assert(std::is_same::value, "slice_target only for matrix_valued GF's"); - using arrays::range; - return {g.mesh(), g.data()(range(), std::forward(args)...), - slice_target(g.singularity(), std::forward(args)...), g.symmetry()}; - } + // slice + template + gf_view slice_target(gf_view g, Args &&... args) { + static_assert(std::is_same::value, "slice_target only for matrix_valued GF's"); + using arrays::range; + return {g.mesh(), g.data()(range(), std::forward(args)...), + slice_target(g.singularity(), std::forward(args)...), g.symmetry()}; + } - template - gf_view slice_target(gf & g, Args &&... args) { - return slice_target(g(), std::forward(args)...); - } + template + gf_view slice_target(gf &g, Args &&... args) { + return slice_target(g(), std::forward(args)...); + } - template - gf_const_view slice_target(gf const &g, Args &&... args) { - return slice_target(g(), std::forward(args)...); - } + template + gf_const_view slice_target(gf const &g, Args &&... args) { + return slice_target(g(), std::forward(args)...); + } - // slice to scalar - template - gf_view slice_target_to_scalar(gf_view g, - Args &&... args) { - static_assert(std::is_same::value, "slice_target only for matrix_valued GF's"); - using arrays::range; - return {g.mesh(), g.data()(range(), std::forward(args)...), - slice_target(g.singularity(), range(args, args + 1)...), g.symmetry()}; - } + // slice to scalar + template + gf_view slice_target_to_scalar(gf_view g, + Args &&... args) { + static_assert(std::is_same::value, "slice_target only for matrix_valued GF's"); + using arrays::range; + return {g.mesh(), g.data()(range(), std::forward(args)...), + slice_target(g.singularity(), range(args, args + 1)...), g.symmetry()}; + } - template - gf_view slice_target_to_scalar(gf & g, Args &&... args) { - return slice_target_to_scalar(g(), std::forward(args)...); - } + template + gf_view slice_target_to_scalar(gf &g, Args &&... args) { + return slice_target_to_scalar(g(), std::forward(args)...); + } - template - gf_const_view slice_target_to_scalar(gf const &g, Args &&... args) { - return slice_target_to_scalar(g(), std::forward(args)...); - } + template + gf_const_view slice_target_to_scalar(gf const &g, Args &&... args) { + return slice_target_to_scalar(g(), std::forward(args)...); + } - // a scalar_valued gf can be viewed as a 1x1 matrix - template - gf_view reinterpret_scalar_valued_gf_as_matrix_valued (gf_view g) { - typedef typename gf_view::data_view_t a_t; - auto a = a_t {typename a_t::indexmap_type (join(g.data().shape(),make_shape(1,1))), g.data().storage()}; + // a scalar_valued gf can be viewed as a 1x1 matrix + template + gf_view + reinterpret_scalar_valued_gf_as_matrix_valued(gf_view g) { + typedef typename gf_view::data_view_t a_t; + auto a = a_t{typename a_t::indexmap_type(join(g.data().shape(), make_shape(1, 1))), g.data().storage()}; return {g.mesh(), a, g.singularity(), g.symmetry()}; } - template - gf_view reinterpret_scalar_valued_gf_as_matrix_valued (gf & g) { + template + gf_view reinterpret_scalar_valued_gf_as_matrix_valued(gf &g) { return reinterpret_scalar_valued_gf_as_matrix_valued(g()); } - template - gf_const_view reinterpret_scalar_valued_gf_as_matrix_valued (gf const & g) { + template + gf_const_view + reinterpret_scalar_valued_gf_as_matrix_valued(gf const &g) { return reinterpret_scalar_valued_gf_as_matrix_valued(g()); } @@ -585,12 +545,87 @@ namespace triqs { namespace gfs { return gf_view(g.mesh().slice(args...), g.data()(g.mesh().slice_get_range(args...),arrays::ellipsis()), g.singularity(), g.symmetry()); }*/ + namespace gfs_implementation { // implement some default traits + + // ------------------------- default factories --------------------- + template struct factories, Opt> { + typedef gf, Opt> gf_t; + typedef tqa::mini_vector target_shape_t; + typedef typename gf_t::mesh_t mesh_t; + + static typename gf_t::data_t make_data(mesh_t const &m, target_shape_t shape) { + typename gf_t::data_t A(shape.front_append(m.size())); + A() = 0; + return A; + } + + static typename gf_t::singularity_t make_singularity(mesh_t const &m, target_shape_t shape) { + return typename gf_t::singularity_t(shape); + } + }; + + template struct factories { + typedef gf gf_t; + typedef tqa::mini_vector target_shape_t; + typedef typename gf_t::mesh_t mesh_t; + + static typename gf_t::data_t make_data(mesh_t const &m, target_shape_t shape) { + typename gf_t::data_t A(shape.front_append(m.size())); + A() = 0; + return A; + } + + static typename gf_t::singularity_t make_singularity(mesh_t const &m, target_shape_t shape) { + return typename gf_t::singularity_t(shape); + } + }; + + template struct factories { + typedef gf gf_t; + struct target_shape_t {}; + typedef typename gf_t::mesh_t mesh_t; + + static typename gf_t::data_t make_data(mesh_t const &m, target_shape_t shape) { + typename gf_t::data_t A(m.size()); + A() = 0; + return A; + } + static typename gf_t::singularity_t make_singularity(mesh_t const &m, target_shape_t shape) { + return typename gf_t::singularity_t{1, 1}; + } + }; + + // --------------------- hdf5 --------------------------------------- + // scalar function : just add a _s + template struct h5_name { + static std::string invoke() { return h5_name::invoke() + "_s"; } + }; + + // the h5 write and read of gf members, so that we can specialize it e.g. for block gf + template struct h5_rw { + + static void write(h5::group gr, gf_const_view g) { + h5_write(gr, "data", g._data); + h5_write(gr, "singularity", g._singularity); + h5_write(gr, "mesh", g._mesh); + h5_write(gr, "symmetry", g._symmetry); + } + + template static void read(h5::group gr, gf_impl &g) { + h5_read(gr, "data", g._data); + h5_read(gr, "singularity", g._singularity); + h5_read(gr, "mesh", g._mesh); + h5_read(gr, "symmetry", g._symmetry); + } + }; + } // gfs_implementation + }} // same as for arrays : views can not be swapped by the std::swap. Delete it namespace std { -template -void swap(triqs::gfs::gf_view &a, triqs::gfs::gf_view &b) = delete; + template + void swap(triqs::gfs::gf_view &a, triqs::gfs::gf_view &b) = delete; } #include "./gf_expr.hpp" #endif diff --git a/triqs/gfs/imtime.hpp b/triqs/gfs/imtime.hpp index edab8ab0..828af163 100644 --- a/triqs/gfs/imtime.hpp +++ b/triqs/gfs/imtime.hpp @@ -32,14 +32,14 @@ namespace triqs { namespace gfs { struct imtime {}; // gf_mesh type and its factories - template struct gf_mesh : linear_mesh> { + template struct gf_mesh : linear_mesh> { typedef linear_mesh> B; gf_mesh() = default; gf_mesh(typename B::domain_t d, int n_time_slices, mesh_kind mk = half_bins) : B(d, 0, d.beta, n_time_slices, mk) {} - gf_mesh (double beta, statistic_enum S, int n_time_slices, mesh_kind mk=half_bins): gf_mesh( {beta,S}, n_time_slices, mk){} + gf_mesh(double beta, statistic_enum S, int n_time_slices, mesh_kind mk = half_bins) : gf_mesh({beta, S}, n_time_slices, mk) {} }; - namespace gfs_implementation { + namespace gfs_implementation { // singularity template struct singularity { typedef local::tail type;};