triqs::gfs::fit_hermitian_tail
#include <triqs/gfs.hpp>
Synopsis
template<int N, typename G, typename A = typenameG::>std::pair<typename A::regular_type, double> fit_hermitian_tail (G const & g,A const & known_moments = {}) template<int N, typename BG, typename A = std::vector<typenameBG::g_t::data_t::regular_type>std::pair<std::vector<typename BG::g_t::data_t::regular_type>, double> fit_hermitian_tail (BG const & bg,A const & known_moments = {})
Documentation
- 1) Fit the tail of a Green function using a least-squares fitting procedure
imposing the symmetry \(G[i\omega](i,j) = G[-i\omega](j,i)^*\)
- 2) Fit the tail of a Block Green function using a least-squares fitting procedure
imposing the symmetry \(G[i\omega](i,j) = G[-i\omega](j,i)^*\) for each block
Template parameters
N The position of the frequency mesh in case of a product mesh [default: 0]
G The type of the Green function object
A The type of the high-frequency moments
BG The type of the Block Green function (block_gf, block_gf_view, block_gf_const_view)
AG The type of the high-frequecy moments for Block Green functions (e.g. std::vector<array>)
Parameters
g The Green function object to fit the tail for
known_moments The object containing the known high-frequency moments
bg The Block Green function object to fit the tail for
Returns
A pair of the tail object and the fitting error
Example
#include <triqs/gfs.hpp>
#include <triqs/mesh.hpp>
#include <iomanip>
using namespace triqs::gfs;
using namespace triqs;
nda::clef::placeholder<0> iw_;
int main() {
double beta = 1.0;
int n_iw = 100;
auto g = gf<imfreq>{{beta, Fermion, n_iw}, {1, 1}};
g[iw_] << 1.0 / iw_;
auto [tail, err] = fit_hermitian_tail(g);
std::cout << std::setprecision(2) << "Error: " << err << "\nTail: " << tail;
}
Output
Error: 4.9e-19
Tail: [(5.6e-18,0),(1,0),(6.3e-12,0),(9.3e-10,0),(2.1e-06,0),(-0.00068,0),(0.24,0)]