diff --git a/test/triqs/gfs/CMakeLists.txt b/test/triqs/gfs/CMakeLists.txt index 2b4bb98a..4423d27c 100644 --- a/test/triqs/gfs/CMakeLists.txt +++ b/test/triqs/gfs/CMakeLists.txt @@ -1,3 +1,3 @@ link_libraries (triqs) all_tests() - +add_subdirectory(multivar) diff --git a/test/triqs/gfs/g_k_om.cpp b/test/triqs/gfs/g_k_om.cpp index de207437..7554f8d7 100644 --- a/test/triqs/gfs/g_k_om.cpp +++ b/test/triqs/gfs/g_k_om.cpp @@ -23,12 +23,16 @@ int main() { // try to assign to expression placeholder<0> k_; placeholder<1> w_; - auto eps = make_expr( [](k_t const& k) { return -2 * (cos(k(0)) + cos(k(1))); }) ; - G(k_, w_) << 1 / (w_ - eps(k_) - 1 / (w_ + 2)); + auto eps_k = -2 * (cos(k_(0)) + cos(k_(1))); + G(k_, w_) << 1 / (w_ - eps_k - 1 / (w_ + 2)); - // hdf5 - h5::file file("ess_g_k_om.h5", H5F_ACC_TRUNC ); + // same + // auto eps = make_expr( [](k_t const& k) { return -2 * (cos(k(0)) + cos(k(1))); }) ; + // G(k_, w_) << 1 / (w_ - eps(k_) - 1 / (w_ + 2)); + + // hdf5 + h5::file file("ess_g_k_om.h5", H5F_ACC_TRUNC); h5_write(file, "g", G); diff --git a/triqs/clef/clef.c11.hpp b/triqs/clef/clef.c11.hpp index b76fdf99..cb68c854 100644 --- a/triqs/clef/clef.c11.hpp +++ b/triqs/clef/clef.c11.hpp @@ -59,12 +59,19 @@ namespace triqs { namespace clef { * Placeholder and corresponding traits * --------------------------------------------------------------------------------------------------- */ template struct pair; // forward + template struct expr; //forward // a placeholder is an empty struct, labelled by an int. template struct placeholder { static_assert( (N>=0) && (N<64) , "Placeholder number limited to [0,63]"); static constexpr int index = N; template pair operator = (RHS && rhs) { return {std::forward(rhs)};} + template expr...> operator()(T&&... x) const { + return {tags::function{}, *this, std::forward(x)...}; + } + template expr> operator[](T&& x) const { + return {tags::subscript{}, *this, std::forward(x)}; + } }; // placeholder will always be copied (they are empty anyway). diff --git a/triqs/clef/clef.c14.hpp b/triqs/clef/clef.c14.hpp index 21e51589..2bf90a30 100644 --- a/triqs/clef/clef.c14.hpp +++ b/triqs/clef/clef.c14.hpp @@ -58,12 +58,19 @@ namespace triqs { namespace clef { * Placeholder and corresponding traits * --------------------------------------------------------------------------------------------------- */ template struct pair; // forward + template struct expr; //forward // a placeholder is an empty struct, labelled by an int. template struct placeholder { static_assert( (N>=0) && (N<64) , "Placeholder number limited to [0,63]"); static constexpr int index = N; - template pair operator = (RHS && rhs) { return {std::forward(rhs)};} + template pair operator = (RHS && rhs) { return {std::forward(rhs)};} + template expr...> operator()(T&&... x) const { + return {tags::function{}, *this, std::forward(x)...}; + } + template expr> operator[](T&& x) const { + return {tags::subscript{}, *this, std::forward(x)}; + } }; // placeholder will always be copied (they are empty anyway). diff --git a/triqs/lattice/bz_mesh.hpp b/triqs/lattice/bz_mesh.hpp index 60ca61f3..585262ac 100644 --- a/triqs/lattice/bz_mesh.hpp +++ b/triqs/lattice/bz_mesh.hpp @@ -68,6 +68,8 @@ namespace lattice { long index() const { return _index; } bool at_end() const { return (_index == m->size()); } void reset() { _index = 0; } + double operator()(int i) const { return m->index_to_point(_index)(i);} + double operator[](int i) const { return m->index_to_point(_index)(i);} }; /// Accessing a point of the mesh