MatsubaraGrid

A MatsubaraGrid{PT} is a sorted (symmetric) set of MatsubaraFrequency{PT} objects and can be constructed by

T  = 1.0
N  = 128
g1 = MatsubaraGrid(T, N, Fermion) # total no. frequencies is 2N 
g2 = MatsubaraGrid(T, N, Boson)   # total no. frequencies is 2N - 1

where $N$ is the number of non-negative frequencies defined as follows:

Particle typeFermionBoson
total no. frequencies2N2N-1
range of Matsubara index-N: N-1-N+1:N-1
definition(2n+1)πT2nπT

MatsubaraGrid{PT} instances are iterable

T = 1.0
N = 128
g = MatsubaraGrid(T, N, Fermion)

for v in g
  println(value(v)) 
  println(index(v))
end

and can be evaluated using either a MatsubaraFrequency{PT}, MatsubaraIndex{PT} or Float64. As long as the input argument is in bounds, this will return the corresponding linear index of the grid in the two former cases and the linear index of the closest frequency in the latter case

T   = 1.0
N   = 128
g   = MatsubaraGrid(T, N, Fermion)
idx = rand(eachindex(g))
@assert g(g[idx]) == idx 
@assert g(value(g[idx])) == idx 

MatsubaraGrid{PT} objects can be saved in HDF5 file format as

using MatsubaraFunctions 
using HDF5

file = h5open("test.h5", "w")
T    = 1.0
N    = 128
g    = MatsubaraGrid(T, N, Fermion)

save_matsubara_grid!(file, "grid", g) 
gp = load_matsubara_grid(file, "grid")
close(file)

Types

MatsubaraFunctions.MatsubaraGridType
struct MatsubaraGrid{PT <: AbstractParticle} <: AbstractMatsubaraGrid

MatsubaraGrid type with fields:

  • T :: Float64 : temperature
  • data :: OffsetVector{MatsubaraFrequency{PT}, Vector{MatsubaraFrequency{PT}}} : list of MatsubaraFrequency objects
source

Functions

Base.firstindexFunction
function firstindex(
    grid :: AbstractMatsubaraGrid
    )    :: Int64

Returns the index of the first Matsubara frequency in grid

source
Base.lastindexFunction
function lastindex(
    grid :: AbstractMatsubaraGrid
    )    :: Int64

Returns the index of the last Matsubara frequency in grid

source
Base.axesFunction
function axes(grid :: AbstractMatsubaraGrid)

Returns range of valid indices for Matsubara grid

source
function axes(f :: MatsubaraFunction)

Returns a tuple of valid index ranges for f.data

source
function axes(f :: MatsubaraFunction, idx :: Int64)

Returns the range of valid indices along dimension idx of f.data

source
MatsubaraFunctions.is_inboundsFunction
function is_inbounds(
    w    :: MatsubaraFrequency{PT},
    grid :: MatsubaraGrid{PT}
    )    :: Bool where {PT <: AbstractParticle}

Checks if w is contained in grid

source
function is_inbounds(
    x    :: MatsubaraIndex{PT},
    grid :: MatsubaraGrid{PT}
    )    :: Bool where {PT <: AbstractParticle}

Checks if x is contained in grid

source
function is_inbounds(
    w    :: Float64,
    grid :: AbstractMatsubaraGrid
    )    :: Bool

Checks if w lies within grid bounds

source
MatsubaraFunctions.NFunction
function N(
    grid :: AbstractMatsubaraGrid
    )    :: Int64

Returns that value N used to construct the grid

source
Base.valuesFunction
Base.:values(grid :: AbstractMatsubaraGrid)

Returns list of values for Matsubara frequencies in grid

source
MatsubaraFunctions.infoFunction
function info(
    grid :: MatsubaraGrid{PT}
    )    :: Nothing where {PT <: AbstractParticle}

Prints summary of grid properties

source
function info(
    f :: MatsubaraFunction{GD, SD, DD, Q}
    ) :: Nothing where {GD, SD, DD, Q <: Number}

Prints summary of function properties

source