Esempio n. 1
0
 // This function takes a g(i omega_n) on half mesh (positive omega_n) and returns a gf on the whole mesh
 // using G(-i omega_n) = G(i omega_n)^* for real G(tau) functions.
 template <typename T, typename S, typename E> gf<imfreq, T, S, E> make_gf_from_real_gf(gf_const_view<imfreq, T, S, E> g) {
  if (!g.mesh().positive_only()) TRIQS_RUNTIME_ERROR << "gf imfreq is not for omega_n >0, real_to_complex does not apply";
  auto const &dat = g.data();
  auto sh = dat.shape();
  int is_boson = (g.mesh().domain().statistic == Boson);
  long L = sh[0];
  sh[0] = 2 * sh[0] - is_boson;
  array<dcomplex, std14::decay_t<decltype(dat)>::rank> new_data(sh);
  auto _ = arrays::ellipsis{};
  if (is_boson) new_data(L - 1, _) = dat(0, _);
  int L1 = (is_boson ? L - 1 : L);
  for (int u = is_boson; u < L; ++u) {
   new_data(L1 + u, _) = dat(u, _);
   new_data(L - 1 - u, _) = conj(dat(u, _));
  }
  return {gf_mesh<imfreq>{g.mesh().domain(), L}, std::move(new_data), g.singularity(), g.symmetry(), g.indices(), g.name};
 }
Esempio n. 2
0
 /// Takes the real part of g without check, and returns a new gf with a real target
 template <typename M, typename T, typename S, typename E> gf<M, real_target_t<T>, S> real(gf_const_view<M, T, S, E> g) {
  return {g.mesh(), real(g.data()), g.singularity(), g.symmetry(), {}, {}}; // no indices for real_valued, internal C++ use only
 }