TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
triqs::utility::time_pt

#include <triqs/utility/time_pt.hpp>

Detailed Description

A point in imaginary time, \( \tau_n \in [0, \beta] \), stored on a very fine integer grid.

Each time point is identified by an integer position \( n \in [0, N_\mathrm{max}] \) of type uint64_t and the inverse temperature \( \beta \). Its floating-point value is \( \beta * n / N_\mathrm{max} \).

Comparing two time points reduces to integer comparison, which avoids the well-known pitfalls of floating-point equality.

Various arithmetic operations are defined between time points and between time points and scalar double values.

Definition at line 60 of file time_pt.hpp.

Public Member Functions

 time_pt ()=default
 Default constructor creates the point \( \tau_0 \) for \( \beta = 0 \).
 time_pt (uint64_t n_, double beta_)
 Construct a point \( \tau_n \) from an integer grid position and the inverse temperature.
 operator double () const
 Explicit cast of \( \tau_n \) to the corresponding double value.
auto operator<=> (time_pt const &tp) const
 Three-way comparison operator compares the integer grid positions of two time points.
time_ptoperator= (double v)=delete
 Assigning a double is deleted to avoid accidental loss of precision.
bool operator== (time_pt const &tp) const
 Equal-to operator compares the integer grid positions of two time points.

Static Public Member Functions

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

Static Public Attributes

static constexpr uint64_t Nmax = std::numeric_limits<uint64_t>::max()
 Largest possible grid position.

Friends

time_pt div_by_int (time_pt const &tp, size_t a)
 Divide a time point by an integer.
size_t floor_div (time_pt const &tp1, time_pt const &tp2)
 Perform floor division between two time points.
void h5_read (h5::group g, std::string const &name, time_pt &tp)
 Read a time_pt from HDF5.
void h5_write (h5::group g, std::string const &name, time_pt const &tp)
 Write a time_pt to HDF5.
time_pt mult_by_int (time_pt const &tp, size_t a)
 Multiply a time point by an integer.
time_pt operator+ (time_pt const &tp1, time_pt const &tp2)
 Addiditon operator performs cyclic addition on \( [0, \beta] \).
time_pt operator- (time_pt const &tp)
 Unary minus operator performs cyclic negation \( [0, \beta] \).
time_pt operator- (time_pt const &tp1, time_pt const &tp2)
 Subtraction operator performs cyclic subtraction on \( [0, \beta] \).
std::ostream & operator<< (std::ostream &out, time_pt const &p)
 Write a time_pt to an output stream.

(Note that these are not member symbols.)

double operator* (time_pt const &tp1, time_pt const &tp2)
 Multiplication between two time points.
double operator/ (time_pt const &tp1, time_pt const &tp2)
 Division between two time points.

Constructor & Destructor Documentation

◆ time_pt()

triqs::utility::time_pt::time_pt ( uint64_t n_,
double beta_ )
inline

Construct a point \( \tau_n \) from an integer grid position and the inverse temperature.

Parameters
n_Integer position \( n \in [0, N_\text{max}] \) on the grid.
beta_Inverse temperature \( \beta \).

Definition at line 75 of file time_pt.hpp.

Member Function Documentation

◆ operator double()

triqs::utility::time_pt::operator double ( ) const
inlineexplicit

Explicit cast of \( \tau_n \) to the corresponding double value.

Returns
Floating-point value \( \beta * n / N_\mathrm{max} \).

Definition at line 162 of file time_pt.hpp.

◆ operator<=>()

auto triqs::utility::time_pt::operator<=> ( time_pt const & tp) const
inline

Three-way comparison operator compares the integer grid positions of two time points.

Parameters
tpRight-hand side time point.
Returns
Ordering of the two integer grid positions.

Definition at line 86 of file time_pt.hpp.

◆ operator==()

bool triqs::utility::time_pt::operator== ( time_pt const & tp) const
inline

Equal-to operator compares the integer grid positions of two time points.

Parameters
tpRight-hand side time point.
Returns
True if both points share the same grid position.

Definition at line 94 of file time_pt.hpp.

◆ div_by_int

time_pt div_by_int ( time_pt const & tp,
size_t a )
friend

Divide a time point by an integer.

Parameters
tpTime point \( \tau_n \).
aInteger divisor \( a \).
Returns
Time point with grid position \( n / a \).

Definition at line 138 of file time_pt.hpp.

◆ floor_div

size_t floor_div ( time_pt const & tp1,
time_pt const & tp2 )
friend

Perform floor division between two time points.

Parameters
tp1Left-hand side time point \( \tau_l \).
tp2Right-hand side time point \( \tau_r \).
Returns
Time point with grid position \( \lfloor l / r \rfloor \).

Definition at line 156 of file time_pt.hpp.

◆ h5_read

void h5_read ( h5::group g,
std::string const & name,
time_pt & tp )
friend

Read a time_pt from HDF5.

Parameters
gh5::group to be read from.
nameName of the subgroup.
tpTime point to read into.

Definition at line 203 of file time_pt.hpp.

◆ h5_write

void h5_write ( h5::group g,
std::string const & name,
time_pt const & tp )
friend

Write a time_pt to HDF5.

Parameters
gh5::group to be written to.
nameName of the subgroup.
tpTime point to be written.

Definition at line 188 of file time_pt.hpp.

◆ mult_by_int

time_pt mult_by_int ( time_pt const & tp,
size_t a )
friend

Multiply a time point by an integer.

Parameters
tpTime point \( \tau_n \).
aInteger factor \( a \).
Returns
Time point with grid position \( n * a \).

Definition at line 147 of file time_pt.hpp.

◆ operator+

time_pt operator+ ( time_pt const & tp1,
time_pt const & tp2 )
friend

Addiditon operator performs cyclic addition on \( [0, \beta] \).

Parameters
tp1Left-hand side operand \( \tau_l \).
tp2Right-hand side operand \( \tau_r \).
Returns
Time point corresponding to the floating-point value \( (\tau_l + \tau_r) \mod \beta \).

Definition at line 103 of file time_pt.hpp.

◆ operator- [1/2]

time_pt operator- ( time_pt const & tp)
friend

Unary minus operator performs cyclic negation \( [0, \beta] \).

Parameters
tpTime point \( \tau_n \) to negate.
Returns
Time point corresponding to the floating-point value \( \beta - \tau_n \) on the grid.

Definition at line 129 of file time_pt.hpp.

◆ operator- [2/2]

time_pt operator- ( time_pt const & tp1,
time_pt const & tp2 )
friend

Subtraction operator performs cyclic subtraction on \( [0, \beta] \).

Parameters
tp1Left-hand side operand \( \tau_l \).
tp2Right-hand side operand \( \tau_r \).
Returns
Time point corresponding to the floating-point value \( (\tau_l - \tau_r) \mod \beta \).

Definition at line 118 of file time_pt.hpp.

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
time_pt const & p )
friend

Write a time_pt to an output stream.

Parameters
outOutput stream to write to.
pPoint to print.
Returns
Reference to the output stream.

Definition at line 171 of file time_pt.hpp.


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