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:
parent
2d1dec4c3d
commit
1811d53179
@ -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);
|
||||
|
@ -69,7 +69,10 @@ 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) {
|
||||
|
||||
auto sh = gl.data().shape().front_pop();
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user