Other bases

Aside from the intermediate representation (IR), sparse-ir allows to work with any bases derived from sparse_ir.abstract.AbstractBasis.

In particular, we allow working we offer a variant of the Discrete Lehmann Representation: sparse_ir.dlr.DiscreteLehmannRepresentation.

class sparse_ir.dlr.DiscreteLehmannRepresentation(basis: AbstractBasis, poles=None)

Discrete Lehmann representation (DLR), with poles being extrema of IR.

This class implements a variant of the discrete Lehmann representation (DLR). Instead of a truncated singular value expansion of the analytic continuation kernel K like the IR, the discrete Lehmann representation is based on a “sketching” of K. The resulting basis is a linear combination of discrete set of poles on the real-frequency axis, continued to the imaginary-frequency axis:

G(iv) == sum(a[i] / (iv - w[i]) for i in range(L))

Warning

The poles on the real-frequency axis selected for the DLR are based on a rank-revealing decomposition, which offers accuracy guarantees. Here, we instead select the pole locations based on the zeros of the IR basis functions on the real axis, which is a heuristic. We do not expect that difference to matter, but please don’t blame the DLR authors if we were wrong :-)

property accuracy

Accuracy of the basis.

Upper bound to the relative error of representing a propagator with the given number of basis functions (number between 0 and 1).

property basis: AbstractBasis

Underlying basis

property beta

Inverse temperature

default_matsubara_sampling_points(**kwargs)

Default sampling points on the imaginary frequency axis

Parameters:
  • npoints (int, optional) – Minimum number of sampling points to return.

  • positive_only (bool) – Only return non-negative frequencies. This is useful if the object to be fitted is symmetric in Matsubara frequency, ghat(w) == ghat(-w).conj(), or, equivalently, real in imaginary time.

default_tau_sampling_points()

Default sampling points on the imaginary time axis

Parameters:

npoints (int, optional) – Minimum number of sampling points to return.

from_IR(gl: ndarray, axis=0) ndarray

From IR to DLR

Convert expansion coefficients from IR basis to DLR basis.

Parameters:
  • gl (array_like) – Expansion coefficients in IR

  • axis (int, optional) – Axis along which to convert

Returns:

Expansion coefficients in DLR

Return type:

array_like

property is_well_conditioned

Returns True if the sampling is expected to be well-conditioned

property lambda_

Basis cutoff parameter, Λ = β * wmax, or None if not present

property shape

Shape of the basis function set

property significance

Significances of the basis functions

Vector of significance values, one for each basis function. Each value is a number between 0 and 1 which is an a-priori bound on the (relative) error made by discarding the associated coefficient.

property size

Number of basis functions / singular values

property statistics

Quantum statistic (“F” for fermionic, “B” for bosonic)

to_IR(g_dlr: ndarray, axis=0) ndarray

From DLR to IR

Convert expansion coefficients from DLR basis to IR basis.

Parameters:
  • g_dlr (array_like) – Expansion coefficients in DLR

  • axis (int, optional) – Axis along which to convert

Returns:

Expansion coefficients in IR

Return type:

array_like

property u

Basis functions on the imaginary time axis.

Set of IR basis functions on the imaginary time (tau) axis, where tau is a real number between zero and beta. To get the l-th basis function at imaginary time tau of some basis, use:

ultau = basis.u[l](tau) # l-th basis function at time tau

Note that u supports vectorization both over l and tau.

property uhat

Basis functions on the reduced Matsubara frequency (wn) axis.

Set of IR basis functions reduced Matsubara frequency (wn) axis, where wn is an integer. These are related to u by the following Fourier transform:

û(n) = ∫₀^β dτ exp(iπnτ/β) u(τ)

To get the l-th basis function at some reduced frequency wn of some basis, use:

uln = basis.uhat[l](wn) # l-th basis function at freq wn

Note

Instead of the value of the Matsubara frequency, these functions expect integers corresponding to the prefactor of pi over beta. For example, the first few positive fermionic frequencies would be specified as [1, 3, 5, 7], and the first bosonic frequencies are [0, 2, 4, 6]. This is also distinct to an index!

property wmax

Real frequency cutoff or None if not present

Base classes

class sparse_ir.abstract.AbstractBasis

Abstract base class for bases on the imaginary-time axis.

This class stores a set of basis functions. We can then expand a two-point propagator G(τ), where τ is imaginary time:

G(τ) ≈ Σ_{l=0}^{L-1} g_l U_l(τ)

where U is now the l-th basis function, stored in u and g denote the expansion coefficients. Similarly, the Fourier transform Ĝ(n), where n is a reduced Matsubara frequency, can be expanded as follows:

Ĝ(n) ≈ Σ_{l=0}^{L-1} g_l Û_l(n)

where Û is the Fourier transform of the l-th basis function, stored in uhat.

Assuming that basis is an instance of some abstract basis, g is a vector of expansion coefficients, tau is some imaginary time and n some frequency, we can write this in the library as follows:

G_tau = basis.u(tau).T @ gl G_n = basis.uhat(n).T @ gl

property accuracy

Accuracy of the basis.

Upper bound to the relative error of representing a propagator with the given number of basis functions (number between 0 and 1).

abstract property beta

Inverse temperature

abstractmethod default_matsubara_sampling_points(*, npoints=None, positive_only=False)

Default sampling points on the imaginary frequency axis

Parameters:
  • npoints (int, optional) – Minimum number of sampling points to return.

  • positive_only (bool) – Only return non-negative frequencies. This is useful if the object to be fitted is symmetric in Matsubara frequency, ghat(w) == ghat(-w).conj(), or, equivalently, real in imaginary time.

abstractmethod default_tau_sampling_points(*, npoints=None)

Default sampling points on the imaginary time axis

Parameters:

npoints (int, optional) – Minimum number of sampling points to return.

property is_well_conditioned

Returns True if the sampling is expected to be well-conditioned

abstract property lambda_

Basis cutoff parameter, Λ = β * wmax, or None if not present

property shape

Shape of the basis function set

abstract property significance

Significances of the basis functions

Vector of significance values, one for each basis function. Each value is a number between 0 and 1 which is an a-priori bound on the (relative) error made by discarding the associated coefficient.

abstract property size

Number of basis functions / singular values

abstract property statistics

Quantum statistic (“F” for fermionic, “B” for bosonic)

abstract property u

Basis functions on the imaginary time axis.

Set of IR basis functions on the imaginary time (tau) axis, where tau is a real number between zero and beta. To get the l-th basis function at imaginary time tau of some basis, use:

ultau = basis.u[l](tau) # l-th basis function at time tau

Note that u supports vectorization both over l and tau.

abstract property uhat

Basis functions on the reduced Matsubara frequency (wn) axis.

Set of IR basis functions reduced Matsubara frequency (wn) axis, where wn is an integer. These are related to u by the following Fourier transform:

û(n) = ∫₀^β dτ exp(iπnτ/β) u(τ)

To get the l-th basis function at some reduced frequency wn of some basis, use:

uln = basis.uhat[l](wn) # l-th basis function at freq wn

Note

Instead of the value of the Matsubara frequency, these functions expect integers corresponding to the prefactor of pi over beta. For example, the first few positive fermionic frequencies would be specified as [1, 3, 5, 7], and the first bosonic frequencies are [0, 2, 4, 6]. This is also distinct to an index!

property wmax

Real frequency cutoff or None if not present