コード例 #1
0
ファイル: pade.cpp プロジェクト: EBRUDU1/triqs
 void pade (gf_view<refreq> &gr, gf_view<imfreq> const &gw, int n_points, double freq_offset) {

  // make sure the GFs have the same structure
  //assert(gw.shape() == gr.shape());

  // copy the tail. it doesn't need to conform to the pade approximant
  gr.singularity() = gw.singularity();

  auto sh = gw.data().shape().front_pop();
  int N1 = sh[0], N2 = sh[1];
  for (int n1=0; n1<N1; n1++) {
    for (int n2=0; n2<N2; n2++) {

      arrays::vector<dcomplex> z_in(n_points); // complex points
      arrays::vector<dcomplex> u_in(n_points); // values at these points
      arrays::vector<dcomplex> a(n_points);    // corresponding Pade coefficients

      for (int i=0; i < n_points; ++i) z_in(i) = gw.mesh()[i];
      for (int i=0; i < n_points; ++i) u_in(i) = gw.on_mesh(i)(n1,n2);

      triqs::utility::pade_approximant PA(z_in,u_in);

      gr() = 0.0;
      for (auto om : gr.mesh()) {
        dcomplex e = om + dcomplex(0.0,1.0)*freq_offset;
        gr[om](n1,n2) = PA(e);
      }

    }
  }

 }
コード例 #2
0
ファイル: pade.cpp プロジェクト: panaceamee/TRIQS
void pade(GF_Bloc_ImFreq const & Gw, GF_Bloc_ReFreq & Ge, int N_Matsubara_Frequencies, double Freq_Offset)
{
    check_have_same_structure (Gw,Ge,false,true);
    assert (Gw.mesh.index_min==0);
    assert (Ge.mesh.index_min==0);

    double Beta = Gw.Beta;
    double omegaShift = (Gw.Statistic==Fermion ? 1 : 0);

    Array<COMPLEX,1> z_in(N_Matsubara_Frequencies);
    firstIndex i;
    z_in = I*Pi/Beta*(2*i+omegaShift);

    // Just copy the tail. It doesn't need to conform to the Pade approximant.
    Gw.tail = Ge.tail;

    int N1 = Gw.N1, N2 = Gw.N2;
    for (int n1=1; n1<=N1;n1++)
        for (int n2=1; n2<=N2;n2++){
            int N = Gw.mesh.len();

            Array<COMPLEX,1> u_in(N_Matsubara_Frequencies);     // Values at the Matsubara frequencies
            Array<COMPLEX,1> a(N_Matsubara_Frequencies);        // Pade coefficients

            for(int i=0; i < N_Matsubara_Frequencies; ++i){
                u_in(i) = (i < N ? Gw.data_const(n1,n2,i) : Gw.tail.eval(z_in(i))(n1,n2));
            }

            Pade_approximant PA(z_in,u_in);

            int Ne = Ge.mesh.len();
            Ge.zero();
            for (int i=0; i < Ne; ++i) {
                COMPLEX e = Ge.mesh[i] + I*Freq_Offset;
                Ge.data(n1,n2,i) = PA(e);
            }
        }
}