# [GfLegendre] Matsubara Green’s function with Legendre polynomials¶

## Reference¶

class triqs.gf.GfLegendre(**kw)[source]
mesh: MeshLegendre, optional
The mesh of the Green function If not present, it will be constructed from the parameters beta, indices, [n_points], [statistic]
data: numpy.array, optional
The data of the Gf. Must be of dimension mesh.rank + target_rank. Incompatible with target_shape
target_shape: list of int, optional
Shape of the target space. Incompatible with data
is_real: bool
Is the Green function real valued ? If true, and target_shape is set, the data will be real. No effect with the parameter data.
indices: GfIndices or list of str or list of list of str, Optional
Optional string indices for the target space, to allow e.g g[‘eg’, ‘eg’] list of list of str: the list of indices for each dimension. list of str: all indices are assumed to be the same for all dimensions.
name: str
The name of the Green function. For plotting.
density(*args, **kwargs)

Compute the density matrix of the Greens function

Parameters: beta (float, optional) – Used for finite temperature density calculation with MeshReFreq. density_matrix – Single particle density matrix with shape target_shape. ndarray

Notes

Only works for single mesh Greens functions with a, Matsubara, real-frequency, or Legendre mesh.

enforce_discontinuity(*args, **kw)

Signature : (gf_view<triqs::gfs::legendre,matrix_valued> gl, matrix_view<double> disc) -> None Modify the coefficient to adjust discontinuity

Warning

Arguments of __init__() must be documented.

### HDF5 data scheme¶

The GfLegendre (Format= “GfLegendre”) is decomposed in the following objects:

Name Type Meaning
Mesh MeshGf The mesh
Data 3d numpy of complex
Data[n,i1,i2] is the element of the Green function where:
• n is the Legendre coefficient index
• i1, i2 are the indices
IndicesL, IndicesR string The Python repr of the indices, e.g. (1,2), or (1,) repr(this_string) reproduces the indices
Name string Name of the Green’s function block
Note string Note

## Example¶

from triqs.gf import *
from triqs.plot.mpl_interface import oplot,plt

# A Green's function on the Matsubara axis set to a semicircular
gw = GfImFreq(indices = [1], beta = 50)
gw << SemiCircular(half_bandwidth = 1)

# Create a Legendre Green's function with 40 coefficients
# and initialize it from gw
gl = GfLegendre(indices = [1], beta = 50, n_points = 40)
gl << MatsubaraToLegendre(gw)

# Plot the Legendre Green's function
oplot(gl, '-o')