37#include <itertools/itertools.hpp>
46 using nda::array_const_view;
112 auto res = make_regular(-g(g.mesh().beta()));
114 if constexpr (
requires {
transpose(res); }) {
151 nda::matrix<dcomplex>
density(gf_const_view<mesh::refreq> g,
double beta);
163 dcomplex
density(gf_const_view<mesh::refreq, scalar_valued> g,
double beta);
174 nda::matrix<dcomplex>
density(gf_const_view<mesh::refreq> g);
185 dcomplex
density(gf_const_view<mesh::refreq, scalar_valued> g);
202 template <
typename BGf,
int R>
203 auto density(BGf
const &gin, std::vector<array<dcomplex, R>>
const &known_moments)
207 using mesh_t =
typename BGf::mesh_t;
208 static_assert(std::is_same_v<mesh_t, mesh::imfreq> or std::is_same_v<mesh_t, mesh::refreq>,
209 "Density Function must be called with either an imfreq or a refreq Green Function");
211 using r_t =
decltype(
density(gin[0], known_moments[0]));
212 std::vector<r_t> dens_vec;
214 TRIQS_ASSERT2(gin.size() == known_moments.size(),
"Density: Require equal number of blocks in block_gf and known_moments vector");
216 for (
auto [gin_bl, km_bl] : itertools::zip(gin, known_moments)) dens_vec.push_back(
density(gin_bl, km_bl));
226 TRIQS_CLEF_MAKE_FNT_LAZY(density);
Provides the block Green's function container.
A read-only, non-owning view of a Green's function.
Concept checking that a type behaves like an in-memory Green's function.
Provides a mesh type for the discrete Lehmann representation in imaginary frequency space.
Provides a mesh type for the discrete Lehmann representation in imaginary time.
TRIQS exception hierarchy and related macros.
auto make_gf_dlr(G const &g)
Transform a DLR imaginary-time or DLR Matsubara Green's function to its DLR-coefficient representatio...
nda::matrix< dcomplex > density(gf_const_view< mesh::imfreq > g, array_const_view< dcomplex, 3 > known_moments)
Compute the density from a Green's function.
gf< M, matrix_valued > transpose(gf_view< M, matrix_valued > g)
Transpose the target matrix of a matrix-valued Green's function, returning a new Green's function.
constexpr bool is_block_gf_v
Trait to check whether a type is a block Green's function.
#define TRIQS_ASSERT2(X,...)
Like TRIQS_ASSERT but lets the caller add a custom message.
Provides a mesh type for the discrete Lehmann representation.
Provides a mesh type on the imaginary frequency axis.
Provides a mesh type for Legendre polynomials as basis functions.
Provides a mesh type on the real frequency axis.