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 type | Fermion | Boson |
---|---|---|
total no. frequencies | 2N | 2N-1 |
range of Matsubara index | -N: N-1 | -N+1:N-1 |
definition | (2n+1)πT | 2nπ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.AbstractMatsubaraGrid
— Typeabstract type AbstractMatsubaraGrid
MatsubaraFunctions.MatsubaraGrid
— Typestruct MatsubaraGrid{PT <: AbstractParticle} <: AbstractMatsubaraGrid
MatsubaraGrid type with fields:
T :: Float64
: temperaturedata :: OffsetVector{MatsubaraFrequency{PT}, Vector{MatsubaraFrequency{PT}}}
: list of MatsubaraFrequency objects
Functions
Base.firstindex
— Functionfunction firstindex(
grid :: AbstractMatsubaraGrid
) :: Int64
Returns the index of the first Matsubara frequency in grid
Base.lastindex
— Functionfunction lastindex(
grid :: AbstractMatsubaraGrid
) :: Int64
Returns the index of the last Matsubara frequency in grid
Base.axes
— Functionfunction axes(grid :: AbstractMatsubaraGrid)
Returns range of valid indices for Matsubara grid
function axes(f :: MatsubaraFunction)
Returns a tuple of valid index ranges for f.data
function axes(f :: MatsubaraFunction, idx :: Int64)
Returns the range of valid indices along dimension idx
of f.data
MatsubaraFunctions.is_inbounds
— Functionfunction is_inbounds(
w :: MatsubaraFrequency{PT},
grid :: MatsubaraGrid{PT}
) :: Bool where {PT <: AbstractParticle}
Checks if w
is contained in grid
function is_inbounds(
x :: MatsubaraIndex{PT},
grid :: MatsubaraGrid{PT}
) :: Bool where {PT <: AbstractParticle}
Checks if x
is contained in grid
function is_inbounds(
w :: Float64,
grid :: AbstractMatsubaraGrid
) :: Bool
Checks if w
lies within grid bounds
MatsubaraFunctions.N
— Functionfunction N(
grid :: AbstractMatsubaraGrid
) :: Int64
Returns that value N
used to construct the grid
MatsubaraFunctions.firstvalue
— Functionfunction firstvalue(
grid :: AbstractMatsubaraGrid
) :: Float64
Returns the value of the first Matsubara frequency in grid
MatsubaraFunctions.lastvalue
— Functionfunction lastvalue(
grid :: AbstractMatsubaraGrid
) :: Float64
Returns the value of the last Matsubara frequency in grid
MatsubaraFunctions.indices
— Functionfunction indices(grid :: AbstractMatsubaraGrid)
Returns list of indices for Matsubara frequencies in grid
Base.values
— FunctionBase.:values(grid :: AbstractMatsubaraGrid)
Returns list of values for Matsubara frequencies in grid
MatsubaraFunctions.info
— Functionfunction info(
grid :: MatsubaraGrid{PT}
) :: Nothing where {PT <: AbstractParticle}
Prints summary of grid properties
function info(
f :: MatsubaraFunction{GD, SD, DD, Q}
) :: Nothing where {GD, SD, DD, Q <: Number}
Prints summary of function properties
MatsubaraFunctions.save_matsubara_grid!
— Functionfunction save_matsubara_grid!(
h :: HDF5.File,
l :: String,
g :: AbstractMatsubaraGrid
) :: Nothing
Save MatsubaraGrid g
with label l
to file h
MatsubaraFunctions.load_matsubara_grid
— Functionfunction load_matsubara_grid(
h :: HDF5.File,
l :: String
) :: AbstractMatsubaraGrid
Load MatsubaraGrid with label l
from file h