From 9583afc6718ba9f89512654b03ed18411fd3d990 Mon Sep 17 00:00:00 2001 From: Olivier Parcollet Date: Wed, 2 Jul 2014 18:16:22 +0200 Subject: [PATCH] Fix #98 - A silly copy paste error : the operator - for matrix expression was defined twice. - second error : a typo in unary method. --- test/triqs/gfs/gf3.cpp | 33 +++++++++++++++++++ test/triqs/gfs/test_gf_triqs.cpp | 8 +++++ .../expression_template/matrix_algebra.hpp | 2 -- triqs/gfs/gf_expr.hpp | 2 +- 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 test/triqs/gfs/gf3.cpp diff --git a/test/triqs/gfs/gf3.cpp b/test/triqs/gfs/gf3.cpp new file mode 100644 index 00000000..75366a52 --- /dev/null +++ b/test/triqs/gfs/gf3.cpp @@ -0,0 +1,33 @@ +#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK +#include +using namespace triqs::gfs; +using namespace triqs::arrays; +namespace h5 = triqs::h5; +#define TEST(X) std::cout << BOOST_PP_STRINGIZE((X)) << " ---> "<< (X) < + + // example + //template using block_gf = gf>; + // block_gf ... + // but not on gcc 4.6 ! + // + +int main() { + try { + + double beta =1; + + auto G = gf{ {beta, Fermion}, {2,2} }; + auto Gc = gf{ {beta, Fermion}, {2,2} }; + auto G3 = gf{ {beta, Fermion}, {2,2} }; + + triqs::clef::placeholder<0> om_; + + G(om_) << om_ + 2 - G3(om_); + + G = -G3; + + } + TRIQS_CATCH_AND_ABORT; + +} diff --git a/test/triqs/gfs/test_gf_triqs.cpp b/test/triqs/gfs/test_gf_triqs.cpp index ef6b9e05..2deb4204 100644 --- a/test/triqs/gfs/test_gf_triqs.cpp +++ b/test/triqs/gfs/test_gf_triqs.cpp @@ -22,6 +22,7 @@ void print_to_file(std::string const s, gf const & gt){ } void test_0(){ + try { int Ntau = 10001; double beta =1; @@ -41,11 +42,15 @@ void test_0(){ TEST(Gt.data()); TEST(Gt.mesh().index_to_point(0)); TEST(Gt.mesh().index_to_point(1)); + } + + catch(std::exception const & e) { std::cout << e.what()<< std::endl;} } void test_1(){ + try { double beta=10; /* ----- Fourier ----- */ @@ -54,6 +59,9 @@ void test_1(){ Gw.singularity()(1) = 1; Gt() = inverse_fourier(Gw); + } +catch(std::exception const & e) { std::cout << e.what()<< std::endl;} + } int main() { diff --git a/triqs/arrays/expression_template/matrix_algebra.hpp b/triqs/arrays/expression_template/matrix_algebra.hpp index 90479704..87391cf9 100644 --- a/triqs/arrays/expression_template/matrix_algebra.hpp +++ b/triqs/arrays/expression_template/matrix_algebra.hpp @@ -105,8 +105,6 @@ namespace triqs { namespace arrays { DEFINE_OPERATOR(plus, +, ImmutableMatrix,ImmutableMatrix); DEFINE_OPERATOR(minus, -, ImmutableMatrix,ImmutableMatrix); - DEFINE_OPERATOR(minus, -, ImmutableMatrix,is_in_ZRC); - DEFINE_OPERATOR(minus, -, is_in_ZRC,ImmutableMatrix); DEFINE_OPERATOR(multiplies, *, is_in_ZRC,ImmutableMatrix); DEFINE_OPERATOR(multiplies, *, ImmutableMatrix,is_in_ZRC); DEFINE_OPERATOR(divides, /, ImmutableMatrix,is_in_ZRC); diff --git a/triqs/gfs/gf_expr.hpp b/triqs/gfs/gf_expr.hpp index d0a74951..f0dfcef3 100644 --- a/triqs/gfs/gf_expr.hpp +++ b/triqs/gfs/gf_expr.hpp @@ -109,7 +109,7 @@ namespace triqs { namespace gfs { auto mesh() const DECL_AND_RETURN(l.mesh()); auto singularity() const DECL_AND_RETURN(l.singularity()); - auto get_data_shape() const DECL_AND_RETURN (get_data_shape(l)); + AUTO_DECL get_data_shape() const RETURN (get_gf_data_shape(l)); template auto operator[](KeyType&& key) const DECL_AND_RETURN( -l[key]); template auto operator()(Args && ... args) const DECL_AND_RETURN( -l(std::forward(args)...));