Porting

For porting codes from irbasis, version 2, to sparse_ir, you have two options:

  • using the sparse_ir.adapter module (easier)

  • porting to the new sparse_ir API (cleaner)

In both cases, please note that sparse_ir now computes the basis on-the-fly rather than loading it from a file. This has some important consequences:

  • Singular values and basis functions may slightly differ from the old code, and may also slightly differ from platform to platform, but should be consistent within a few units in the last place (2e-16).

  • The sampling times and frequencies are chosen in an improved fashion and thus differ from the old code and may also differ slightly between versions and platforms.

In transferring persistent data, please therefore either directly transfer the basis coefficients or store the sampling points together with the data.

Adapter module

For ease of porting, we provide the sparse_ir.adapter module. This module is API-compatible with the irbasis package, version 2. This means you simply have to replace:

import irbasis

with the following:

import sparse_ir.adapter as irbasis

and everything should work as expected.

class sparse_ir.adapter.Basis(statistics, Lambda, sve_result)
property Lambda

Dimensionless parameter of IR basis

compute_unl(n, whichl=None)

Compute transformation matrix from IR to Matsubara frequencies

d_ulx(l, x, order, section=None)

Return (higher-order) derivatives of u_l(x)

d_vly(l, y, order)

Return (higher-order) derivatives of v_l(y)

dim()

Return dimension of basis

num_sections_x()

Number of sections of piecewise polynomial representation of u_l(x)

num_sections_y()

Number of sections of piecewise polynomial representation of v_l(y)

sampling_points_matsubara(whichl)

Computes sampling points in Matsubara domain for given basis

sampling_points_x(whichl)

Computes “optimal” sampling points in x space for given basis

sampling_points_y(whichl)

Computes “optimal” sampling points in y space for given basis

property section_edges_x

End points of sections for u_l(x)

property section_edges_y

End points of sections for v_l(y)

sl(l=None)

Return the singular value for the l-th basis function

property statistics

Statistics, either “F” for fermions or “B” for bosons

ulx(l, x)

Return value of basis function for x

vly(l, y)

Return value of basis function for y