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

#include <triqs/mesh/refreq_pts.hpp>

Detailed Description

Real frequency mesh type from arbitrary sorted frequency points.

A real frequency mesh is defined by its size \( N \geq 0 \) and a sorted vector of frequency values \( \{\omega_0, \omega_1, \ldots, \omega_{N-1}\} \).

It 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.
  • An index \( n \) is mapped to its corresponding value \( \omega_n \).
  • An arbitrary value \( \omega \in [\omega_0, \omega_{N-1}] \) is mapped to the closest mesh point using binary search.

Green's function containers that are based on this mesh store the function values at the discrete frequency points \( \omega(n) \), i.e. \( f_n = f(\omega(n)) \), and use linear interpolation to evaluate the function at an arbitrary frequency \( \omega \).

Definition at line 68 of file refreq_pts.hpp.

Classes

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

Public Types

using data_index_t = long
 Data index type.
using index_t = long
 Index type.
using value_t = double
 Value type.

Public Member Functions

 refreq_pts ()=default
 Default constructor creates an empty mesh.
 refreq_pts (std::initializer_list< double > l)
 Construct a real frequency mesh from an initializer list of frequency points.
 refreq_pts (std::vector< double > pts)
 Construct a real frequency mesh from a sorted vector of frequency points.
auto begin () const
 Get an iterator to the beginning of the mesh.
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.
bool is_value_valid (double w) const noexcept
 Check if a value \( \omega \) is within the mesh range.
uint64_t mesh_hash () const noexcept
 Get the hash value of the mesh.
mesh_point_t operator() (index_t n) const noexcept
 Function call operator to access a mesh point by its index.
bool operator== (refreq_pts const &) const =default
 Equal-to comparison operator.
mesh_point_t operator[] (closest_mesh_point_t< double > const &cmp) const noexcept
 Subscript operator to access the mesh point closest to a given value.
mesh_point_t operator[] (long d) const noexcept
 Subscript operator to access a mesh point by its data index.
std::vector< double > const & points () const noexcept
 Get the vector of frequency point values.
void serialize (auto &ar) const
 Serialize the mesh to a generic archive.
long size () const noexcept
 Get the size \( N \) of the mesh, i.e. the number of mesh points.
data_index_t to_data_index (closest_mesh_point_t< double > const &cmp) const noexcept
 Map a value to the closest mesh point and return its data index.
data_index_t to_data_index (index_t n) const noexcept
 Map an index \( n \) to its corresponding data index \( d(n) = n \).
index_t to_index (closest_mesh_point_t< double > const &cmp) const noexcept
 Map a value to the closest mesh point and return its index using binary search.
index_t to_index (data_index_t d) const noexcept
 Map a data index \( d \) to the corresponding index \( n(d) = d \).
double to_value (index_t n) const noexcept
 Map an index \( n \) to its corresponding value \( \omega_n \).

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, refreq_pts &m)
 Read a triqs::mesh::refreq_pts mesh from HDF5.
void h5_write (h5::group g, std::string const &name, refreq_pts const &m)
 Write a triqs::mesh::refreq_pts mesh to HDF5.
std::ostream & operator<< (std::ostream &sout, refreq_pts const &m)
 Write a triqs::mesh::refreq_pts mesh to a std::ostream.

Constructor & Destructor Documentation

◆ refreq_pts() [1/2]

triqs::mesh::refreq_pts::refreq_pts ( std::vector< double > pts)
inline

Construct a real frequency mesh from a sorted vector of frequency points.

Parameters
ptsSorted vector of frequency values.

Definition at line 150 of file refreq_pts.hpp.

◆ refreq_pts() [2/2]

triqs::mesh::refreq_pts::refreq_pts ( std::initializer_list< double > l)
inline

Construct a real frequency mesh from an initializer list of frequency points.

Parameters
lInitializer list of frequency values.

Definition at line 162 of file refreq_pts.hpp.

Member Function Documentation

◆ deserialize()

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

Deserialize the mesh from a generic archive.

Parameters
arArchive to deserialize from.

Definition at line 317 of file refreq_pts.hpp.

◆ is_index_valid()

bool triqs::mesh::refreq_pts::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 173 of file refreq_pts.hpp.

◆ is_value_valid()

bool triqs::mesh::refreq_pts::is_value_valid ( double w) const
inlinenodiscardnoexcept

Check if a value \( \omega \) is within the mesh range.

Parameters
wValue to check.
Returns
True if \( \omega_0 \leq \omega \leq \omega_{N-1} \), false otherwise.

Definition at line 181 of file refreq_pts.hpp.

◆ operator()()

mesh_point_t triqs::mesh::refreq_pts::operator() ( index_t n) const
inlinenodiscardnoexcept

Function call operator to access a mesh point by its index.

Parameters
nIndex of the mesh point.
Returns
mesh_point_t at the given index.

Definition at line 259 of file refreq_pts.hpp.

◆ operator[]() [1/2]

mesh_point_t triqs::mesh::refreq_pts::operator[] ( closest_mesh_point_t< double > const & cmp) const
inlinenodiscardnoexcept

Subscript operator to access the mesh point closest to a given value.

Parameters
cmptriqs::mesh::closest_mesh_point_t containing the value.
Returns
mesh_point_t of the closest mesh point.

Definition at line 251 of file refreq_pts.hpp.

◆ operator[]() [2/2]

mesh_point_t triqs::mesh::refreq_pts::operator[] ( long d) const
inlinenodiscardnoexcept

Subscript operator to access a mesh point by its data index.

Parameters
dData index of the mesh point.
Returns
mesh_point_t at the given data index.

Definition at line 243 of file refreq_pts.hpp.

◆ serialize()

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

Serialize the mesh to a generic archive.

Parameters
arArchive to serialize to.

Definition at line 311 of file refreq_pts.hpp.

◆ to_data_index() [1/2]

data_index_t triqs::mesh::refreq_pts::to_data_index ( closest_mesh_point_t< double > const & cmp) const
inlinenodiscardnoexcept

Map a value to the closest mesh point and return its data index.

Parameters
cmptriqs::mesh::closest_mesh_point_t containing the value to map.
Returns
Data index of the closest mesh point.

Definition at line 200 of file refreq_pts.hpp.

◆ to_data_index() [2/2]

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

Map an index \( n \) to its corresponding data index \( d(n) = n \).

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

Definition at line 189 of file refreq_pts.hpp.

◆ to_index() [1/2]

index_t triqs::mesh::refreq_pts::to_index ( closest_mesh_point_t< double > const & cmp) const
inlinenodiscardnoexcept

Map a value to the closest mesh point and return its index using binary search.

Parameters
cmptriqs::mesh::closest_mesh_point_t containing the value to map.
Returns
Index of the closest mesh point.

Definition at line 221 of file refreq_pts.hpp.

◆ to_index() [2/2]

index_t triqs::mesh::refreq_pts::to_index ( data_index_t d) const
inlinenodiscardnoexcept

Map a data index \( d \) to the corresponding index \( n(d) = d \).

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

Definition at line 210 of file refreq_pts.hpp.

◆ to_value()

double triqs::mesh::refreq_pts::to_value ( index_t n) const
inlinenodiscardnoexcept

Map an index \( n \) to its corresponding value \( \omega_n \).

Parameters
nIndex to map.
Returns
Value of the mesh point \( \omega_n \).

Definition at line 270 of file refreq_pts.hpp.

◆ h5_read

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

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

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

Definition at line 342 of file refreq_pts.hpp.

◆ h5_write

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

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

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

Definition at line 329 of file refreq_pts.hpp.

◆ operator<<

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

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

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

Definition at line 303 of file refreq_pts.hpp.


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