TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
pade.cpp
Go to the documentation of this file.
1// Copyright (c) 2013-2018 Commissariat à l'énergie atomique et aux énergies alternatives (CEA)
2// Copyright (c) 2013-2018 Centre national de la recherche scientifique (CNRS)
3// Copyright (c) 2018-2023 Simons Foundation
4// Copyright (c) 2015 Igor Krivenko
5//
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16// You may obtain a copy of the License at
17// https://www.gnu.org/licenses/gpl-3.0.txt
18//
19// Authors: Michel Ferrero, Igor Krivenko, Olivier Parcollet, Nils Wentzell
20
25
26#include "./pade.hpp"
29
30#include <complex>
31
32namespace triqs::gfs {
33
35
36 if (n_points < 0 || n_points > gw.mesh().last_index() + 1)
37 TRIQS_RUNTIME_ERROR << "Pade argument n_points (" << n_points
38 << ") should be positive and not be greater than the positive number of Matsubara frequencies ("
39 << gw.mesh().last_index() + 1 << ")\n";
40
41 gr() = 0.0;
42
43 nda::vector<dcomplex> z_in(n_points); // complex points
44 nda::vector<dcomplex> u_in(n_points); // values at these points
45
46 for (int i = 0; i < n_points; ++i) {
47 z_in(i) = gw.mesh()(i);
48 u_in(i) = gw[i];
49 }
50
52
53 for (auto om : gr.mesh()) {
54 dcomplex e = om + dcomplex(0.0, 1.0) * freq_offset;
55 gr[om] = PA(e);
56 }
57 }
58
59} // namespace triqs::gfs
A read-only, non-owning view of a Green's function.
mesh_t const & mesh() const
Get the mesh of the Green's function.
A mutable, non-owning view of a Green's function.
Definition gf_view.hpp:48
mesh_t const & mesh() const
Get the mesh of the Green's function.
Definition gf_view.hpp:125
Padé approximant of a complex function sampled at with values .
TRIQS exception hierarchy and related macros.
void pade(gf_view< mesh::refreq, scalar_valued > gr, gf_const_view< mesh::imfreq, scalar_valued > gw, int n_points, double freq_offset)
Analytically continue a scalar Matsubara Green's function to the real-frequency axis via Pade.
Definition pade.cpp:34
#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 the Pade analytic continuation from Matsubara to real frequencies.
Padé approximants for analytic continuation, computed with arbitrary-precision GMP arithmetic.