# Hilbert Transform¶

TRIQS comes with a Hilbert transform. Let us look at an example:

from pytriqs.lattice.tight_binding import *
from pytriqs.dos import HilbertTransform
from pytriqs.gf import GfImFreq

# Define a DOS (here on a square lattice)
BL = BravaisLattice(units = [(1,0,0) , (0,1,0) ], orbital_positions= [(0,0,0)] )
t   = -1.00                # First neighbour Hopping
tp  =  0.0*t               # Second neighbour Hopping
hop= {  (1,0) :  [[ t]],
(-1,0):  [[ t]],
(0,1) :  [[ t]],
(0,-1):  [[ t]],
(1,1) :  [[ tp]],
(-1,-1):  [[ tp]],
(1,-1):  [[ tp]],
(-1,1):  [[ tp]]}

TB = TightBinding (BL, hop)
d = dos(TB, n_kpts= 500, n_eps = 101, name = 'dos')[0]

#define a Hilbert transform
H = HilbertTransform(d)

#fill a Green function
G = GfImFreq(indices = ['up','down'], beta = 20)
Sigma0 = GfImFreq(indices = ['up','down'], beta = 20); Sigma0.zero()
G << H(Sigma = Sigma0,mu=0.)

---Output:---
Starting on 1 Nodes at : 2018-12-04 18:15:45.440762
/home/build/triqs/pytriqs/gf/gf.py:655: UserWarning: g.N1 is deprecated and not generic. Use g.target_shape[0] instead
warnings.warn("g.N1 is deprecated and not generic. Use g.target_shape[0] instead")
/home/build/triqs/pytriqs/gf/gf.py:661: UserWarning: g.N2 is deprecated and not generic. Use g.target_shape[1] instead
warnings.warn("g.N2 is deprecated and not generic. Use g.target_shape[1] instead")


Given a density of states d (here for a tight-binding model), the Hilbert transform H is defined is defined in the following way:

H = HilbertTransform(d)


To construct a Green’s function:

G = GfImFreq(indices = ['up','down'], beta = 20)
Sigma0 = GfImFreq(indices = ['up','down'], beta = 20); Sigma0.zero()
G << H(Sigma = Sigma0, mu=0.)

class pytriqs.dos.HilbertTransform(rho)[source]

Computes the Hilbert Transform from a DOS object

$\int_{-\infty}^\infty d \epsilon \rho(\epsilon) \Bigl( (\omega + \mu + I\eta)\mathbf{1} - \hat\varepsilon(\epsilon) - \text{field} - \Sigma(\epsilon) \Bigr)^{-1}$
Parameters: rho – a DOS object.
__call__(Sigma, mu=0, eta=0, field=None, epsilon_hat=None, result=None, n_points_integral=None, test_convergence=None)[source]

Compute the Hilbert Transform

Parameters: mu: float : eta: float : Sigma: a GFBloc or a function epsilon-> GFBloc : field: anything that can added to the GFBloc Sigma, e.g.: : an Array_with_GFBloc_Indices (same size as Sigma) a GBloc epsilon_hat: a function that takes a 1d array eps[i] and returns 3d-array eps[i,:,:] : where the:,: has the matrix structure of Sigma. Default: eps[i] * Identity_Matrix Used only when DOS is a DOSFromFunction: n_points_integral: How many points to use. If None, use the Npts of construction : test_convergence: If defined, it will refine the grid until CV is reached : starting from n_points_integral and multiplying by 2 Returns the result. If provided, use result to compute the result locally. :