gftool.polepade.number_poles

gftool.polepade.number_poles(z, fct_z, *, degree=-1, weight=None, n_poles0: ~typing.Optional[int] = None, vandermond=<function polyvander>) int[source]

Estimate the optimal number of poles for a rational approximation.

The number of poles is determined, such that up to numerical accuracy the solution is unique, corresponding to a null-dimension equal to 1 [ito2018].

Parameters:
z, fct_z(N_z) complex np.ndarray

Variable where function is evaluated and function values.

degreeint, optional

The difference of denominator and numerator degree. (default: -1) This determines how fct_z decays for large abs(z): fct_z → z**degree. For Green’s functions it typically is -1, for self-energies it typically is 0.

weight(N_z) float np.ndarray, optional

Weighting of the data points, for a known error σ this should be weight = 1./σ.

n_poles0int, optional

Starting guess for the number of poles. Can be given to speed up calculation if a good estimate is available.

vandermondCallable, optional

Function giving the Vandermond matrix of the chosen polynomial basis. Defaults to simple polynomials.

Returns:
int

Best guess for optimal number of poles.

References

[ito2018]

Ito, S., Nakatsukasa, Y., 2018. Stable polefinding and rational least-squares fitting via eigenvalues. Numer. Math. 139, 633–682. https://doi.org/10.1007/s00211-018-0948-4