TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
triqs::mesh::legendre

#include <triqs/mesh/legendre.hpp>

Detailed Description

Legendre mesh type.

A Legendre mesh is defined by the number of Legendre polynomials \( N \) used in the series expansion, an inverse temperature \( \beta > 0 \) and its particle statistics.

A Legendre mesh is an index-only mesh (no value attached to each point) and has the following properties:

  • Each mesh point is identified by a unique index \( n \in \{0, 1, \ldots, N-1\} \).
  • An index \( n \) is mapped to the corresponding data index \( d \) by the identity function \( d(n) = n \) and vice versa.
  • There is no explicit value associated with a mesh point, i.e. it carries no value at each mesh point.

Green's function containers that are based on a Legendre mesh store the coefficients \( f_n \) of the generalized Fourier series expansion of a function \( f(\tau) \) in terms of Legendre polynomials, which is defined on the imaginary time axis. To evaluate the function at an arbitrary imaginary time \( \tau \in [0, \beta] \), the GF container sums up the Fourier series to the maximum degree \( N-1 \):

\[ f(\tau) \approx \sum_{n=0}^{N-1} \frac{\sqrt{2n + 1}}{\beta} f_n P_n(x(\tau)) \; , \]

where \( P_n \) denotes the Legendre polynomial of degree \( n \), \( x(\tau) = 2\tau / \beta - 1 \) is a linear map from \( [0, \beta] \) to \( [-1, 1] \) and

\[ f_n = \sqrt{2n + 1} \int_0^\beta d\tau \, f(\tau) P_n(x(\tau)) \; , \]

are the expansion coefficients.

Definition at line 76 of file legendre.hpp.

Classes

class  mesh_point_t
 Mesh point of a triqs::mesh::legendre mesh. More...

Public Types

using data_index_t = long
 Data index type.
using index_t = long
 Index type.

Public Member Functions

 legendre ()=default
 Default constructor constructs an empty mesh.
 legendre (double beta, statistic_enum statistic, long max_n)
 Construct a mesh of Legendre polynomials with degrees \( n = 0, 1, \ldots, N - 1 \) on the interval \([0, \beta] \) and the given particle statistics.
auto begin () const
 Get an iterator to the beginning of the mesh.
double beta () const noexcept
 Get the inverse temperature \( \beta \).
auto cbegin () const
 Get a const iterator to the beginning of the mesh.
auto cend () const
 Get a const iterator to the end of the mesh.
void deserialize (auto &ar)
 Deserialize the mesh from a generic archive.
auto end () const
 Get an iterator to the end of the mesh.
bool is_index_valid (index_t n) const noexcept
 Check if an index \( n \) is valid.
uint64_t mesh_hash () const
 Get the hash value of the mesh.
mesh_point_t operator() (long n) const
 Function call operator to access a mesh point by its index \( n \in \{0, 1, \ldots, N-1\} \).
bool operator== (legendre const &) const =default
 Equal-to comparison operator compares \( N \), \( \beta \) and the particle statistics.
mesh_point_t operator[] (long d) const
 Subscript operator to access a mesh point by its data index \( d \in \{0, 1, \ldots, N-1\} \).
void serialize (auto &ar) const
 Serialize the mesh to a generic archive.
long size () const
 Get the size \( N \) of the mesh, i.e. the number of mesh points or polynomials in the series expansion.
auto statistic () const noexcept
 Get the particle statistics.
data_index_t to_data_index (index_t n) const noexcept
 Map an index \( n \in \{0, 1, \ldots, N-1\} \) to its corresponding data index \( d(n) \).
index_t to_index (long d) const noexcept
 Map a data index \( d \in \{0, 1, \ldots, N-1\} \) to the corresponding index \( n(d) \).

Static Public Member Functions

static std::string hdf5_format ()
 Get the HDF5 format tag.

Friends

void h5_read (h5::group g, std::string const &name, legendre &m)
 Read a triqs::mesh::legendre mesh from HDF5.
void h5_write (h5::group g, std::string const &name, legendre const &m)
 Write a triqs::mesh::legendre mesh to HDF5.
std::ostream & operator<< (std::ostream &sout, legendre const &m)
 Write a triqs::mesh::legendre mesh to a std::ostream.

Constructor & Destructor Documentation

◆ legendre()

triqs::mesh::legendre::legendre ( double beta,
statistic_enum statistic,
long max_n )
inline

Construct a mesh of Legendre polynomials with degrees \( n = 0, 1, \ldots, N - 1 \) on the interval \([0, \beta] \) and the given particle statistics.

Parameters
betaInverse temperature \( \beta > 0 \).
statisticParticle statistics.
max_nSize of the mesh, i.e. the number of Legendre polynomial used in the series expansion.

Definition at line 133 of file legendre.hpp.

Member Function Documentation

◆ deserialize()

void triqs::mesh::legendre::deserialize ( auto & ar)
inline

Deserialize the mesh from a generic archive.

Parameters
arArchive to deserialize from.

Definition at line 233 of file legendre.hpp.

◆ is_index_valid()

bool triqs::mesh::legendre::is_index_valid ( index_t n) const
inlinenodiscardnoexcept

Check if an index \( n \) is valid.

Parameters
nIndex \( n \) to check.
Returns
True if \( 0 \leq n < N \), false otherwise.

Definition at line 147 of file legendre.hpp.

◆ operator()()

mesh_point_t triqs::mesh::legendre::operator() ( long n) const
inlinenodiscard

Function call operator to access a mesh point by its index \( n \in \{0, 1, \ldots, N-1\} \).

Parameters
nIndex \( n \) of the mesh point.
Returns
mesh_point_t with the index \( n \), data index \( d(n) = n \) and hash value of the current mesh.

Definition at line 185 of file legendre.hpp.

◆ operator[]()

mesh_point_t triqs::mesh::legendre::operator[] ( long d) const
inlinenodiscard

Subscript operator to access a mesh point by its data index \( d \in \{0, 1, \ldots, N-1\} \).

Parameters
dData index \( d \) of the mesh point.
Returns
mesh_point_t with the index \( n(d) = d \), data index \( d \) and hash value of the current mesh.

Definition at line 177 of file legendre.hpp.

◆ serialize()

void triqs::mesh::legendre::serialize ( auto & ar) const
inline

Serialize the mesh to a generic archive.

Parameters
arArchive to serialize to.

Definition at line 227 of file legendre.hpp.

◆ to_data_index()

data_index_t triqs::mesh::legendre::to_data_index ( index_t n) const
inlinenodiscardnoexcept

Map an index \( n \in \{0, 1, \ldots, N-1\} \) to its corresponding data index \( d(n) \).

Parameters
nIndex \( n \) to map.
Returns
Data index \( d(n) = n \).

Definition at line 155 of file legendre.hpp.

◆ to_index()

index_t triqs::mesh::legendre::to_index ( long d) const
inlinenodiscardnoexcept

Map a data index \( d \in \{0, 1, \ldots, N-1\} \) to the corresponding index \( n(d) \).

Parameters
dData index \( d \) to map.
Returns
Index \( n(d) = d \).

Definition at line 166 of file legendre.hpp.

◆ h5_read

void h5_read ( h5::group g,
std::string const & name,
legendre & m )
friend

Read a triqs::mesh::legendre mesh from HDF5.

Parameters
gh5::group to be read from.
nameName of the subgroup.
mMesh object to be read into.

Definition at line 260 of file legendre.hpp.

◆ h5_write

void h5_write ( h5::group g,
std::string const & name,
legendre const & m )
friend

Write a triqs::mesh::legendre mesh to HDF5.

Parameters
gh5::group to be written to.
nameName of the subgroup.
mMesh object to be written.

Definition at line 245 of file legendre.hpp.

◆ operator<<

std::ostream & operator<< ( std::ostream & sout,
legendre const & m )
friend

Write a triqs::mesh::legendre mesh to a std::ostream.

Parameters
soutstd::ostream object.
mMesh to be written.
Returns
Reference to std::ostream object.

Definition at line 218 of file legendre.hpp.


The documentation for this class was generated from the following file: