Previous topic

GfTools.matrix

This Page

GfTools.pade

The gftools.pade module contains functions to perform analytic continuations using Pade. The implemented scheme focuses on averaging over multiple approximants.

API

Pade analytic continuation for Green’s functions and self-energies.

The main aim of this module is to provide analytic continuation based on averaging over multiple Pade approximates (similar to [1]).

In most cases the following high level function should be used:

averaged, avg_no_neg_imag
Return one-shot analytic continuation evaluated at z.
Averager
Returns a function for repeated evaluation of the continued function.

References

[1]Schött et al. “Analytic Continuation by Averaging Pade Approximants”. Phys Rev B 93, no. 7 (2016): 075104. https://doi.org/10.1103/PhysRevB.93.075104.
gftools.pade.Averager(z_in, coeff, *, valid_pades, kind: gftools.pade.KindSelector)[source]

Create function for averaging Pade scheme.

Parameters:
  • z_in ((N_in,) complex ndarray) – complex mesh used to calculate coeff
  • coeff ((.., N_in) complex ndarray) – coefficients for Pade, calculated from pade.coefficients
  • valid_pades (list_like of bool) – Mask which continuations are correct, all Pades where valid_pades evaluates to false will be ignored for the average.
  • kind ({KindGf, KindSelf}) – Defines the asymptotic of the continued function and the number of minumum and maximum input points used for Pade. For KindGf the function goes like \(1/z\) for large z, for KindSelf the function behaves like a constant for large z.
Returns:

average – The continued function f(z) (z, ) -> Result. f(z).x contains the function values f(z).err the associated variance.

Return type:

function

Raises:
  • TypeError – If valid_pades not of type bool
  • RuntimeError – If all there are none elements of valid_pades that evaluate to True.
gftools.pade.FilterNegImag(threshold=1e-08)[source]

Return function to check if imaginary part is smaller than threshold.

This methods is designed to create valid_pades for Averager. The imaginary part of retarded Green’s functions and self-energies must be negative, this is checked by this filter. A threshold is given as Pade overshoots when the function goes sharply to 0. See for example the semi-circular spectral function of the Bethe lattice with infinite Coordination number as example.

class gftools.pade.KindGf(n_min, n_max)[source]

Filter approximants such that the high-frequency behavior is \(1/ω\).

We denote approximants with the corresponding high frequency behavior as valid. Considers all valid approximants including between n_min and n_max Matsubara frequencies.

class gftools.pade.KindSelector(n_min, n_max)[source]

Abstract filter class to determine high-frequency behavior of Pade.

We denote approximants with the corresponding high frequency behavior as valid. Considers all valid approximants including between n_min and n_max Matsubara frequencies.

islice(iterable)[source]

Return an iterator whose next() method returns valid values from iterable.

slice

Return slice selecting the valid approximants.

class gftools.pade.KindSelf(n_min, n_max)[source]

Filter approximants such that the high-frequency behavior is a constant.

We denote approximants with the corresponding high frequency behavior as valid. Considers all valid approximants including between n_min and n_max Matsubara frequencies.

gftools.pade.averaged(z_out, z_in, *, valid_z=None, fct_z=None, coeff=None, filter_valid=None, kind: gftools.pade.KindSelector)[source]

Return the averaged Pade continuation with its variance.

The output is checked to have an imaginary part smaller than threshold, as retarded Green’s functions and self-energies have a negative imaginary part. This is a helper to conveniently get the continuation, it comes however with overhead.

Parameters:
  • z_out ((N_out,) complex ndarray) – points at with the functions will be evaluated
  • z_in ((N_in,) complex ndarray) – complex mesh used to calculate coeff
  • valid_z ((N_out,) complex ndarray, optional) – The output range according to which the Pade approximation is validated (compared to the threshold).
  • fct_z ((N_z, ) complex ndarray, optional) – Function at points z from which the coefficients will be calculated. Can be omitted if coeff is directly given.
  • coeff ((N_in,) complex ndarray, optional) – Coefficients for Pade, calculated from pade.coefficients. Can be given instead of fct_z.
  • filter_valid (callable) – Function determining which approximants to keep. The signature should be filter_valid(ndarray, iterable) -> bool ndarray. Currently there are the functions {FilterNegImag, } implemented to generate filter functions. Look into the implemented for details to create new filters.
  • kind ({KindGf, KindSelf}) – Defines the asymptotic of the continued function and the number of minumum and maximum input points used for Pade. For KindGf the function goes like \(1/z\) for large z, for KindSelf the function behaves like a constant for large z.
Returns:

  • averaged.x ((N_in, N_out) complex ndarray) – function evaluated at points z
  • averaged.err ((N_in, N_out) complex ndarray) – variance associated with the function values pade.x at points z

gftools.pade.avg_no_neg_imag(z_out, z_in, *, valid_z=None, fct_z=None, coeff=None, threshold=1e-08, kind: gftools.pade.KindSelector)[source]

Average Pade filtering approximants with non-negative imaginary part.

This function wraps averaged, see averaged for the parameters.

Other Parameters:
 threshold (float, optional) – The numerical threshold, how large of an positive imaginary part is tolerated (default: 1e-8). np.infty can be given to accept all.
Returns:
  • averaged.x ((N_in, N_out) complex ndarray) – function evaluated at points z
  • averaged.err ((N_in, N_out) complex ndarray) – variance associated with the function values pade.x at points z
gftools.pade.calc_iterator(z_out, z_in, coeff, *, kind: gftools.pade.KindSelector)[source]

Calculate Pade continuation of function at points z_out.

The continuation is calculated for different numbers of coefficients taken into account, where the number is in [n_min, n_max]. The algorithm is take from [2].

Parameters:
  • z_out (complex ndarray) – points at with the functions will be evaluated
  • z_in ((N_in,) complex ndarray) – complex mesh used to calculate coeff
  • coeff ((.., N_in) complex ndarray) – coefficients for Pade, calculated from pade.coefficients
  • kind ({KindGf, KindSelf}) – Defines the asymptotic of the continued function and the number of minumum and maximum input points used for Pade. For KindGf the function goes like \(1/z\) for large z, for KindSelf the function behaves like a constant for large z.
Returns:

pade_calc – Function evaluated at points z_out for all corresponding (see kind) numbers of Matsubara frequencies between n_min and n_max. The shape of the elements is the same as coeff.shape with the last dimension corresponding to N_in replaced by the shape of z_out: (…, N_in, *z_out.shape).

Return type:

iterator

References

[2]Vidberg, H. J., and J. W. Serene. “Solving the Eliashberg Equations by Means of N-Point Pade Approximants.” Journal of Low Temperature Physics 29, no. 3-4 (November 1, 1977): 179-92. https://doi.org/10.1007/BF00655090.
gftools.pade.coefficients(z, fct_z) → numpy.ndarray[source]

Calculate the coefficients for the Pade continuation.

Parameters:
  • z ((N_z, ) complex ndarray) – Array of complex points
  • fct_z ((.., N_z) complex ndarray) – Function at points z
Returns:

coefficients – Array of Pade coefficients, needed to perform Pade continuation. Has the same same shape as fct_z.

Return type:

(.., N_z) complex ndarray

Raises:

ValueError – If the size of z and the last dimension of fct_z do not match.