//#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK #include #include #include namespace tql= triqs::clef; namespace tqa= triqs::arrays; using tqa::range; using triqs::arrays::make_shape; using triqs::gf::Fermion; using triqs::gf::imfreq; using triqs::gf::imtime; using triqs::gf::make_gf; #define TEST(X) std::cout << BOOST_PP_STRINGIZE((X)) << " ---> "<< (X) < using block_gf = gf>; // block_gf ... // but not on gcc 4.6 ! // int main() { triqs::gf::freq_infty inf; double beta =1; auto G = make_gf (beta, Fermion, make_shape(2,2)); auto Gc = make_gf (beta, Fermion, make_shape(2,2)); auto G3 = make_gf (beta, Fermion, make_shape(2,2)); auto Gt = make_gf (beta, Fermion, make_shape(2,2)); auto Gv = G(); TEST( G( 0) ) ; Gv.on_mesh(0) = 20; TEST( Gv( 0) ) ; TEST( G( 0) ) ; Gv.on_mesh(0) = 0; auto Gv2 = slice_target(G,range(0,1),range(0,1)); TEST( Gv2( 0) ) ; Gv2.on_mesh(0) = 10; TEST( Gv2( 0) ) ; TEST( G( 0) ) ; triqs::clef::placeholder<0> om_; TEST( G(om_) ) ; TEST( tql::eval(G(om_), om_=0) ) ; TEST( Gv(om_) ) ; TEST( tql::eval(Gv(om_), om_=0) ) ; std::cout <<"-------------lazy assign 1 ------------------"< t2 = t + 2.4; TEST(t.order_min()); TEST( t( 2) ) ; TEST( Gv2(inf)( 2) ) ; // copy Gc = G; TEST( G( 0) ) ; TEST( Gc( 0) ) ; // operations on gf G3 = G +2* Gc; G3 = G + Gc; // TEST( G3( 0) ) ; // G3 = G3 /2.0; // TEST( G3( 0) ) ; // does not compile : ok // G3 = G + Gt; // std::cout <<"----------------- 4 --------------------"< A(1,2,3,4,5,6,7,8,9); A()=0; //auto x = local::impl::gf_impl::wrap_infty (G.tail_view()) + 2.0; // test hdf5 H5::H5File file("ess_gf.h5", H5F_ACC_TRUNC ); h5_write(file, "g", G); }