mirror of
https://github.com/triqs/dft_tools
synced 2025-01-12 14:08:24 +01:00
Added density for scalar_valued gf (and test thereof)
This commit is contained in:
parent
2d1dec4c3d
commit
1811d53179
@ -1,5 +1,6 @@
|
|||||||
//#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
|
//#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
|
||||||
#include <triqs/gfs.hpp>
|
#include <triqs/gfs.hpp>
|
||||||
|
#include <triqs/gfs/local/functions.hpp>
|
||||||
using namespace triqs::gfs;
|
using namespace triqs::gfs;
|
||||||
#define TEST(X) std::cout << BOOST_PP_STRINGIZE((X)) << " ---> "<< (X) <<std::endl<<std::endl;
|
#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_;
|
triqs::clef::placeholder<0> om_;
|
||||||
G(om_) << 1/(om_ + 2.3);
|
G(om_) << 1/(om_ + 2.3);
|
||||||
|
|
||||||
|
auto n = triqs::gfs::density(G);
|
||||||
|
TEST(n);
|
||||||
|
|
||||||
// test hdf5
|
// test hdf5
|
||||||
H5::H5File file("gf_scalar.h5", H5F_ACC_TRUNC);
|
H5::H5File file("gf_scalar.h5", H5F_ACC_TRUNC);
|
||||||
h5_write(file, "g", G);
|
h5_write(file, "g", G);
|
||||||
|
@ -69,6 +69,9 @@ namespace triqs { namespace gfs {
|
|||||||
return res;
|
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) {
|
arrays::matrix<double> density( gf_view<legendre> const & gl) {
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ namespace triqs {
|
|||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
|
|
||||||
arrays::matrix<double> density(gf_view<imfreq> const & g);
|
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);
|
arrays::matrix<double> density(gf_view<legendre> const & g);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user