ElementwiseMaxEnt

This is a list of the implemented elementwise continuation methods for matrix-valued Green functions.

class triqs_maxent.elementwise_maxent.ElementwiseMaxEnt(use_hermiticity=True, use_complex=False, **kwargs)[source]

Bases: object

Perform MaxEnt for a matrix, element-wise

Parameters:
use_hermiticitybool

whether matrix elements ij with i>j shall be taken from the complex conjugate of the element ji

use_complexbool

whether complex numbers are used (i.e., whether the \(G(\tau)\) data contains imaginary parts)

Attributes:
maxent_diagonale.g. TauMaxEnt

the MaxEnt worker for the diagonal elements Note that setting this to a new object will influence all the variables that are derived from the maxent instance, e.g. omega, K, D, etc. Be sure to ensure compatibility of maxent_diagonal and maxent_offdiagonal and maxent_result!

maxent_offdiagonale.g. TauMaxEnt

the MaxEnt worker for the off-diagonal elements

set_G_elementfunction, lambda

function with arguments maxent, G_mat, elem, re that calls one of the set_G_*** functions of maxent to set its Green function to the element elem of the matrix G_mat

determine_shapefunction, lambda

function with arguments G_mat that returns the shape of the Green function matrix

maxent_resultMaxEntResult

the result of the calculation; set this to None in order to delete the preceding results

Methods

get_error(elem)

Get the error of a matrix element

get_tau()

Get the data variable (e.g., tau)

prepare_maxent_result([overwrite])

Create a MaxEntResult object to hold the results

run()

Run elementwise MaxEnt for all the matrix elements

run_diagonal()

Run MaxEnt for all diagonal elements

run_element(element[, re])

Run MaxEnt for a matrix element

run_offdiagonal()

Run MaxEnt for all off-diagonal elements

set_G(G_mat, set_G_element, determine_shape)

Set Green function matrix

set_G_iw(G_iw, *args, **kwargs)

Set matrix-valued \(G(i\omega_n)\) as TRIQS GfImFreq

set_G_tau(G_tau, *args, **kwargs)

Set matrix-valued \(G(\tau)\) as TRIQS GfImTime

set_G_tau_data(tau, G_tau, *args, **kwargs)

Set matrix-valued \(G(\tau)\) from array

set_G_tau_filename_pattern(filename, dimension)

Set matrix-valued \(G(\tau)\) from files

set_G_tau_filenames(filenames[, tau_col, ...])

Set matrix-valued \(G(\tau)\) from files

set_cov(cov)

Set the covariance matrix of \(G(\tau)\)

set_error(error)

Set the error of \(G(\tau)\)

set_tau

get_error(elem)[source]

Get the error of a matrix element

elemtuple

a tuple of two elements giving the 0-based index of the matrix element

get_tau()[source]

Get the data variable (e.g., tau)

prepare_maxent_result(overwrite=False)[source]

Create a MaxEntResult object to hold the results

This is called by the respective routines; there is usually no need for the user to call this. In order to discard the current results and start with a new one, either set maxent_result to None or call this method with overwrite=True.

Parameters:
overwritebool

whether the current result should be overwritten if already present

run()[source]

Run elementwise MaxEnt for all the matrix elements

First, the diagonal elements, then the off-diagonal elements are calculated

Returns:
maxent_resultMaxEntResult

the result of the calculation; it has the correct matrix shape

run_diagonal()[source]

Run MaxEnt for all diagonal elements

Returns:
maxent_resultMaxEntResult

the result of the calculation; it has the correct matrix shape, with NaNs for the elements that were not calculated (yet)

run_element(element, re=True)[source]

Run MaxEnt for a matrix element

This method fetches the element from the G matrix that was set using one of the set_G... methods and passes it to the correct MaxEnt worker (i.e., either the diagonal or off-diagonal MaxEnt).

Parameters:
elementtuple

a tuple of two elements giving the 0-based index of the matrix element to analytically continue

rebool

whether the real (True) or imaginary (False) part should be continued

Returns:
maxent_resultMaxEntResult

the result of the calculation; it has the correct matrix shape, with NaNs for the elements that were not calculated (yet)

run_offdiagonal()[source]

Run MaxEnt for all off-diagonal elements

If use_hermiticity is True, half of the off-diagonal elements are not calculated, but inferred by using the hermiticity of the spectral function.

Returns:
maxent_resultMaxEntResult

the result of the calculation; it has the correct matrix shape, with NaNs for the elements that were not calculated (yet)

set_G(G_mat, set_G_element, determine_shape)[source]

Set Green function matrix

Set the Green function matrix together with the function to feed one of its element to the underlying maxent object and the function to determine its shape.

Consider using ElementwiseMaxEnt.set_G_tau(), ElementwiseMaxEnt.set_G_iw(), ElementwiseMaxEnt.set_G_tau_data() or ElementwiseMaxEnt.set_G_tau_filenames().

Parameters:
G_matwhatever

Green function matrix

set_G_elementfunction, lambda

function with arguments maxent, G_mat, elem, re that calls one of the set_G_*** functions of maxent to set its Green function to the element elem of the matrix G_mat

determine_shapefunction, lambda

function with arguments G_mat that returns the shape of the Green function matrix

set_G_iw(G_iw, *args, **kwargs)[source]

Set matrix-valued \(G(i\omega_n)\) as TRIQS GfImFreq

The extra arguments are passed on to the set_G_iw() method of maxent_diagonal and maxent_offdiagonal.

Parameters:
G_iwGfImFreq

The Green function

set_G_tau(G_tau, *args, **kwargs)[source]

Set matrix-valued \(G(\tau)\) as TRIQS GfImTime

The extra arguments are passed on to the set_G_tau() method of maxent_diagonal and maxent_offdiagonal.

Parameters:
G_tauGfImTime

The Green function

set_G_tau_data(tau, G_tau, *args, **kwargs)[source]

Set matrix-valued \(G(\tau)\) from array

The extra arguments are passed on to the set_G_tau_data() method of maxent_diagonal and maxent_offdiagonal.

Parameters:
tauarray

a one-dimensional array of tau-values

G_tauarray

a three-dimensional array; the first two dimensions are the matrix dimensions, the last dimension is the tau grid

set_G_tau_filename_pattern(filename, dimension, tau_col=0, G_col_re=1, G_col_im=2, *args, **kwargs)[source]

Set matrix-valued \(G(\tau)\) from files

For each matrix element, read the Green function from a file. The name of the files is given as a pattern.

The extra arguments are passed on to the set_G_tau_file() method of maxent_diagonal and maxent_offdiagonal.

Parameters:
filenamestr

the filename pattern. It must contain {i} and {j}, placeholders which will be replaced by the index of the matrix element using the python format function.

dimensiontuple of two ints

the matrix dimension (shape)

tau_colint

the 0-based column number of the \(\tau\)-grid

G_col_reint

the 0-based column number of the \(G(\tau)\)-data (real part)

G_col_imint

the 0-based column number of the \(G(\tau)\)-data (imaginary part)

set_G_tau_filenames(filenames, tau_col=0, G_col_re=1, G_col_im=2, *args, **kwargs)[source]

Set matrix-valued \(G(\tau)\) from files

For each matrix element, read the Green function from a file.

The extra arguments are passed on to the set_G_tau_file() method of maxent_diagonal and maxent_offdiagonal.

Parameters:
filenamestwo-dimensional array of str

for each matrix element, the name of the file from which the Green function should be read

tau_colint

the 0-based column number of the \(\tau\)-grid

G_col_reint

the 0-based column number of the \(G(\tau)\)-data (real part)

G_col_imint

the 0-based column number of the \(G(\tau)\)-data (imaginary part)

set_cov(cov)[source]

Set the covariance matrix of \(G(\tau)\)

Parameters:
covarray

If the cov matrix is the same for every element, just the matrix can be given; else, an array with dimensions MxNxTxT is expected, where MxN is the matrix dimension of \(G(\tau)\) and T is the number of tau-points

set_error(error)[source]

Set the error of \(G(\tau)\)

Parameters:
errorfloat or array

If the error is the same for every tau-point and matrix element, a float can be given. If it is the same for every matrix element, a one-dimensional array can be given. Else, an array with dimensions MxNxT is expected, where MxN is the matrix dimension of \(G(\tau)\) and T is the number of tau-points.

property shape

The shape of the Green function matrix

property tau

Get the data variable (e.g., tau)

class triqs_maxent.elementwise_maxent.PoormanMaxEnt(analyzer_offdiag_D='LineFitAnalyzer', D_add_constant=1e-06, *args, **kwargs)[source]

Bases: ElementwiseMaxEnt

Perform poor man’s MaxEnt for a matrix, element-wise.

After calculating the diagonal elements, the off-diagonal elements are calculated using a default model derived from the diagonals: For element i, j, we use

\[D_{ij} = \sqrt{A_{ii} A_{jj}} + \varepsilon\]

where \(\varepsilon\) is a small additive constant to avoid that the default model becomes zero.

This usually gives better results than just performing the ElementwiseMaxEnt for the off-diagonals.

Parameters:
analyzer_offdiag_DAnalyzer

the name of the analyzer that should be used to get the spectral function of the diagonals for calculating the default model

D_add_constantfloat

small constant that is added to the default model to ensure it is not zero

Attributes:
maxent_diagonal
maxent_offdiagonal
shape

The shape of the Green function matrix

tau

Get the data variable (e.g., tau)

Methods

get_error(elem)

Get the error of a matrix element

get_tau()

Get the data variable (e.g., tau)

prepare_maxent_result([overwrite])

Create a MaxEntResult object to hold the results

run()

Run elementwise MaxEnt for all the matrix elements

run_diagonal()

Run MaxEnt for all diagonal elements

run_element(element[, re])

Run MaxEnt for a matrix element

run_offdiagonal()

Run MaxEnt for all off-diagonal elements

set_G(G_mat, set_G_element, determine_shape)

Set Green function matrix

set_G_iw(G_iw, *args, **kwargs)

Set matrix-valued \(G(i\omega_n)\) as TRIQS GfImFreq

set_G_tau(G_tau, *args, **kwargs)

Set matrix-valued \(G(\tau)\) as TRIQS GfImTime

set_G_tau_data(tau, G_tau, *args, **kwargs)

Set matrix-valued \(G(\tau)\) from array

set_G_tau_filename_pattern(filename, dimension)

Set matrix-valued \(G(\tau)\) from files

set_G_tau_filenames(filenames[, tau_col, ...])

Set matrix-valued \(G(\tau)\) from files

set_cov(cov)

Set the covariance matrix of \(G(\tau)\)

set_error(error)

Set the error of \(G(\tau)\)

set_tau

run()[source]

Run elementwise MaxEnt for all the matrix elements

First, the diagonal elements, then the off-diagonal elements are calculated using the default model of the poor man’s method

Returns:
maxent_resultMaxEntResult

the result of the calculation; it has the correct matrix shape

run_offdiagonal()[source]

Run MaxEnt for all off-diagonal elements

In the poor man’s method, this requires the result of the diagonal elements. Make sure to call run_diagonal first.

If use_hermiticity is True, half of the off-diagonal elements are not calculated, but inferred by using the hermiticity of the spectral function.

Returns:
maxent_resultMaxEntResult

the result of the calculation; it has the correct matrix shape, with NaNs for the elements that were not calculated (yet)

class triqs_maxent.elementwise_maxent.DiagonalMaxEnt(use_hermiticity=True, use_complex=False, **kwargs)[source]

Bases: ElementwiseMaxEnt

Perform MaxEnt for a matrix, element-wise for the diagonals.

Attributes:
maxent_diagonal
maxent_offdiagonal
shape

The shape of the Green function matrix

tau

Get the data variable (e.g., tau)

Methods

get_error(elem)

Get the error of a matrix element

get_tau()

Get the data variable (e.g., tau)

prepare_maxent_result([overwrite])

Create a MaxEntResult object to hold the results

run()

Run MaxEnt for all the diagonal elements of the matrix

run_diagonal()

Run MaxEnt for all diagonal elements

run_element(element[, re])

Run MaxEnt for a matrix element

run_offdiagonal()

Run MaxEnt for all off-diagonal elements

set_G(G_mat, set_G_element, determine_shape)

Set Green function matrix

set_G_iw(G_iw, *args, **kwargs)

Set matrix-valued \(G(i\omega_n)\) as TRIQS GfImFreq

set_G_tau(G_tau, *args, **kwargs)

Set matrix-valued \(G(\tau)\) as TRIQS GfImTime

set_G_tau_data(tau, G_tau, *args, **kwargs)

Set matrix-valued \(G(\tau)\) from array

set_G_tau_filename_pattern(filename, dimension)

Set matrix-valued \(G(\tau)\) from files

set_G_tau_filenames(filenames[, tau_col, ...])

Set matrix-valued \(G(\tau)\) from files

set_cov(cov)

Set the covariance matrix of \(G(\tau)\)

set_error(error)

Set the error of \(G(\tau)\)

set_tau

run()[source]

Run MaxEnt for all the diagonal elements of the matrix

run_offdiagonal()[source]

Run MaxEnt for all off-diagonal elements

If use_hermiticity is True, half of the off-diagonal elements are not calculated, but inferred by using the hermiticity of the spectral function.

Returns:
maxent_resultMaxEntResult

the result of the calculation; it has the correct matrix shape, with NaNs for the elements that were not calculated (yet)