67 template <
typename G,
typename... XS>
69 auto operator()(G
const &g, XS &&...xs)
const {
70 auto l = [&g](
auto &&...ys) ->
decltype(
auto) {
return g.operator[](ys...); };
71 using r_t = std::decay_t<
decltype(make_regular(evaluate(g.mesh(), l, std::forward<XS>(xs)...)))>;
72 if constexpr (nda::Array<r_t> or nda::is_scalar_v<r_t>) {
74 if (detail::eval_to_zero(g.mesh(), xs...)) {
return r_t{nda::zeros<typename G::target_t::scalar_t>(g.target_shape())}; }
76 return make_regular(evaluate(g.mesh(), l, std::forward<XS>(xs)...));
83 template <>
struct gf_evaluator<mesh::imfreq> {
86 template <
typename G>
auto operator()(G
const &g, matsubara_freq
const &f)
const {
88 using r_t = std::decay_t<
decltype(make_regular(g[0]))>;
90 if (g.mesh().is_index_valid(f.n))
return r_t{g[f.n]};
91 if (g.mesh().positive_only()) {
92 int sh = (g.mesh().statistic() == Fermion ? 1 : 0);
93 if (g.mesh().is_index_valid(-f.n - sh))
return r_t{
conj(g[-f.n - sh])};
94 TRIQS_RUNTIME_ERROR <<
" ERROR: Cannot evaluate Green function with positive only mesh outside grid ";
97 auto [tail, err] = fit_tail_no_normalize(g);
98 dcomplex x = std::abs(g.mesh().w_max()) / f;
99 auto res =
r_t{nda::zeros<dcomplex>(g.target_shape())};
102 for (
int n : range(tail.extent(0))) {
103 res += tail(n, ellipsis()) * z;
111 template <
typename G>
decltype(
auto)
operator()(G
const &g,
int n)
const {
return g(matsubara_freq(n, g.mesh().beta(), g.mesh().statistic())); }
const_view_type operator()() const
Make a const view of *this.
Provides common type aliases, forward declarations and internal helpers for the Green's function cont...
Provides tail fitting, slicing, inversion, reality and matrix-multiplication functions for Green's fu...
Provides the Green's function class.
G::regular_type conj(G const &g)
Complex-conjugate a Green's function, returning a new Green's function.
constexpr bool is_gf_v
Trait to check whether a type models the Green's function concept.
nda::vector< double > r_t
Real space vector type.
many_body_operator_generic< T > n(IndexTypes... indices)
Create a number operator .
#define TRIQS_RUNTIME_ERROR
Throw a triqs::runtime_error with the current source location.
std::complex< double > dcomplex
Convenience alias for std::complex<double>.
Provides a mesh type on the imaginary frequency axis.
Default evaluator of a Green's function at arbitrary points of its mesh.