3
0
mirror of https://github.com/triqs/dft_tools synced 2024-10-31 19:23:45 +01:00

Added density for scalar_valued gf (and test thereof)

This commit is contained in:
tayral 2014-01-20 14:31:02 +00:00 committed by Olivier Parcollet
parent 2d1dec4c3d
commit 1811d53179
3 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,6 @@
//#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
#include <triqs/gfs.hpp>
#include <triqs/gfs/local/functions.hpp>
using namespace triqs::gfs;
#define TEST(X) std::cout << BOOST_PP_STRINGIZE((X)) << " ---> "<< (X) <<std::endl<<std::endl;
@ -12,6 +13,9 @@ int main() {
triqs::clef::placeholder<0> om_;
G(om_) << 1/(om_ + 2.3);
auto n = triqs::gfs::density(G);
TEST(n);
// test hdf5
H5::H5File file("gf_scalar.h5", H5F_ACC_TRUNC);
h5_write(file, "g", G);

View File

@ -69,6 +69,9 @@ namespace triqs { namespace gfs {
return res;
}
double density(gf_view<imfreq, scalar_valued> const & g){
return density(reinterpret_scalar_valued_gf_as_matrix_valued(g))(0,0);
}
arrays::matrix<double> density( gf_view<legendre> const & gl) {

View File

@ -33,6 +33,7 @@ namespace triqs {
// ------------------------------------------------------
arrays::matrix<double> density(gf_view<imfreq> const & g);
double density(gf_view<imfreq, scalar_valued> const & g);
arrays::matrix<double> density(gf_view<legendre> const & g);