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: FiniteTempBasis, sampling_points=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 reprensenting a propagator with the given number of basis functions (number between 0 and 1).

property basis: FiniteTempBasis

Underlying basis

property beta

Inverse temperature

default_matsubara_sampling_points(**kwargs)

Default sampling points on the imaginary frequency axis

Parameters:
  • npoints (int) –

    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 Matsubura 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) –

Minimum number of sampling points to return.

from_IR(gl: ndarray, axis=0) ndarray

From IR to DLR

gl:

Expansion coefficients in IR

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 a 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

g_dlr:

Expansion coefficients in DLR

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 basis, use:

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

Note that u supports vectorization both over l and tau. In particular, omitting the subscript yields a vector with all basis functions, evaluated at that position:

basis.u(tau) == [basis.u[l](tau) for l in range(basis.size)]

Similarly, supplying a vector of tau points yields a matrix A, where A[l,n] corresponds to the l-th basis function evaluated at tau[n]:

tau = [0.5, 1.0]
basis.u(tau) == \
    [[basis.u[l](t) for t in tau] for l in range(basis.size)]
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:

\[\hat u(n) = \int_0^\beta d\tau \exp(i\pi n \tau/\beta) u(\tau)\]

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

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

uhat supports vectorization both over l and wn. In particular, omitting the subscript yields a vector with all basis functions, evaluated at that position:

basis.uhat(wn) == [basis.uhat[l](wn) for l in range(basis.size)]

Similarly, supplying a vector of wn points yields a matrix A, where A[l,n] corresponds to the l-th basis function evaluated at wn[n]:

wn = [1, 3]
basis.uhat(wn) == \\
    [[basis.uhat[l](wi) for wi in wn] for l in range(basis.size)]

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(\tau) \approx \sum_{l=0}^{L-1} g_l U_l(\tau)\]

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:

\[\hat G(n) \approx \sum_{l=0}^{L-1} g_l \hat U_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 reprensenting a propagator with the given number of basis functions (number between 0 and 1).

property beta

Inverse temperature

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

Default sampling points on the imaginary frequency axis

Parameters:
  • npoints (int) –

    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 Matsubura frequency, ghat(w) == ghat(-w).conj(), or, equivalently, real in imaginary time.

default_tau_sampling_points(*, npoints=None)

Default sampling points on the imaginary time axis

Parameters:

npoints (int) –

Minimum number of sampling points to return.

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 a 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)

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 basis, use:

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

Note that u supports vectorization both over l and tau. In particular, omitting the subscript yields a vector with all basis functions, evaluated at that position:

basis.u(tau) == [basis.u[l](tau) for l in range(basis.size)]

Similarly, supplying a vector of tau points yields a matrix A, where A[l,n] corresponds to the l-th basis function evaluated at tau[n]:

tau = [0.5, 1.0]
basis.u(tau) == \
    [[basis.u[l](t) for t in tau] for l in range(basis.size)]
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:

\[\hat u(n) = \int_0^\beta d\tau \exp(i\pi n \tau/\beta) u(\tau)\]

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

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

uhat supports vectorization both over l and wn. In particular, omitting the subscript yields a vector with all basis functions, evaluated at that position:

basis.uhat(wn) == [basis.uhat[l](wn) for l in range(basis.size)]

Similarly, supplying a vector of wn points yields a matrix A, where A[l,n] corresponds to the l-th basis function evaluated at wn[n]:

wn = [1, 3]
basis.uhat(wn) == \\
    [[basis.uhat[l](wi) for wi in wn] for l in range(basis.size)]

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