MatsubaraQuadrature< NT > Class Template Reference#

DiFfRG: DiFfRG::MatsubaraQuadrature< NT > Class Template Reference
DiFfRG
DiFfRG::MatsubaraQuadrature< NT > Class Template Reference

A quadrature rule for (bosonic) Matsubara frequencies, based on the method of Monien [1]. This class provides nodes and weights for the summation. More...

#include <matsubara.hh>

Public Member Functions

int predict_size (const NT T, const NT typical_E=1., const int step=2)
 Calculate the number of nodes needed for a given temperature and typical energy scale.
 
 MatsubaraQuadrature (const NT T, const NT typical_E=1., const int step=2, const int min_size=0, const int max_size=256, const int vacuum_quad_size=48, const int precision_factor=1)
 Create a new quadrature rule for Matsubara frequencies.
 
 MatsubaraQuadrature ()
 
void reinit (const NT T, const NT typical_E=1., const int step=2, const int min_size=0, const int max_size=256, const int vacuum_quad_size=48, const int precision_factor=1)
 Update the quadrature rule with new parameters.
 
size_t size () const
 Get the size of the quadrature rule.
 
NT get_T () const
 Get the temperature of the quadrature rule.
 
NT get_typical_E () const
 Get the typical energy scale of the quadrature rule.
 
template<typename F >
auto sum (const F &f) const
 Compute a matsubara sum of a given function.
 
template<typename MemorySpace >
Kokkos::View< const NT *, MemorySpace > nodes () const
 
template<typename MemorySpace >
Kokkos::View< const NT *, MemorySpace > weights () const
 

Private Member Functions

void write_data (const std::vector< NT > &x, const std::vector< NT > &w)
 
void reinit_0 ()
 Construct a quadrature rule for T=0.
 

Private Attributes

NT T
 
NT typical_E
 
Kokkos::View< NT *, GPU_memorydevice_nodes
 
Kokkos::View< NT *, GPU_memorydevice_weights
 
Kokkos::View< NT *, CPU_memoryhost_nodes
 
Kokkos::View< NT *, CPU_memoryhost_weights
 
int m_size
 The number of nodes in the quadrature rule.
 
int vacuum_quad_size
 
int precision_factor
 

Detailed Description

template<typename NT>
class DiFfRG::MatsubaraQuadrature< NT >

A quadrature rule for (bosonic) Matsubara frequencies, based on the method of Monien [1]. This class provides nodes and weights for the summation.

\[ T \sum_{n=\in \mathbb{Z}} f(2\pi n T) \approx \sum_{n=1}^{N} w_i (f(x_i) + f(-x_i)) + T f(0) \]

[1] H. Monien, "Gaussian quadrature for sums: a rapidly convergent summation scheme", Math. Comp. 79, 857 (2010). doi:10.1090/S0025-5718-09-02289-3

Template Parameters
NTnumeric type to be used for all calculations

Constructor & Destructor Documentation

◆ MatsubaraQuadrature() [1/2]

template<typename NT >
DiFfRG::MatsubaraQuadrature< NT >::MatsubaraQuadrature ( const NT T,
const NT typical_E = 1.,
const int step = 2,
const int min_size = 0,
const int max_size = 256,
const int vacuum_quad_size = 48,
const int precision_factor = 1 )

Create a new quadrature rule for Matsubara frequencies.

Parameters
TThe temperature.
typical_EA typical energy scale, which determines the number of nodes in the quadrature rule.
stepThe step size of considered node sizes (e.g. step=2 implies only even numbers of nodes).
min_sizeMinimum number of nodes.
max_sizeMaximum number of nodes.

◆ MatsubaraQuadrature() [2/2]

template<typename NT >
DiFfRG::MatsubaraQuadrature< NT >::MatsubaraQuadrature ( )

Member Function Documentation

◆ get_T()

template<typename NT >
NT DiFfRG::MatsubaraQuadrature< NT >::get_T ( ) const

Get the temperature of the quadrature rule.

◆ get_typical_E()

template<typename NT >
NT DiFfRG::MatsubaraQuadrature< NT >::get_typical_E ( ) const

Get the typical energy scale of the quadrature rule.

◆ nodes()

template<typename NT >
template<typename MemorySpace >
Kokkos::View< const NT *, MemorySpace > DiFfRG::MatsubaraQuadrature< NT >::nodes ( ) const
inline

◆ predict_size()

template<typename NT >
int DiFfRG::MatsubaraQuadrature< NT >::predict_size ( const NT T,
const NT typical_E = 1.,
const int step = 2 )

Calculate the number of nodes needed for a given temperature and typical energy scale.

Parameters
TThe temperature.
typical_EA typical energy scale.
stepThe step size of considered node sizes (e.g. step=2 implies only even numbers of nodes).
Returns
int The number of nodes needed. If the number is negative, the T=0-limit has been reached (usually if typical_E / T > 4.4e+2, which is 64 nodes).

◆ reinit()

template<typename NT >
void DiFfRG::MatsubaraQuadrature< NT >::reinit ( const NT T,
const NT typical_E = 1.,
const int step = 2,
const int min_size = 0,
const int max_size = 256,
const int vacuum_quad_size = 48,
const int precision_factor = 1 )

Update the quadrature rule with new parameters.

Parameters
TThe temperature.
typical_EA typical energy scale, which determines the number of nodes in the quadrature rule.
stepThe step size of considered node sizes (e.g. step=2 implies only even numbers of nodes).
min_sizeMinimum number of nodes.
max_sizeMaximum number of nodes.

◆ reinit_0()

template<typename NT >
void DiFfRG::MatsubaraQuadrature< NT >::reinit_0 ( )
private

Construct a quadrature rule for T=0.

◆ size()

template<typename NT >
size_t DiFfRG::MatsubaraQuadrature< NT >::size ( ) const

Get the size of the quadrature rule.

◆ sum()

template<typename NT >
template<typename F >
auto DiFfRG::MatsubaraQuadrature< NT >::sum ( const F & f) const
inline

Compute a matsubara sum of a given function.

Template Parameters
FThe function type.
Parameters
fThe function to be summed. Must have signature NT f(NT x).
Returns
NT The Matsubara sum of the function.

◆ weights()

template<typename NT >
template<typename MemorySpace >
Kokkos::View< const NT *, MemorySpace > DiFfRG::MatsubaraQuadrature< NT >::weights ( ) const
inline

◆ write_data()

template<typename NT >
void DiFfRG::MatsubaraQuadrature< NT >::write_data ( const std::vector< NT > & x,
const std::vector< NT > & w )
private

Member Data Documentation

◆ device_nodes

template<typename NT >
Kokkos::View<NT *, GPU_memory> DiFfRG::MatsubaraQuadrature< NT >::device_nodes
private

◆ device_weights

template<typename NT >
Kokkos::View<NT *, GPU_memory> DiFfRG::MatsubaraQuadrature< NT >::device_weights
private

◆ host_nodes

template<typename NT >
Kokkos::View<NT *, CPU_memory> DiFfRG::MatsubaraQuadrature< NT >::host_nodes
private

◆ host_weights

template<typename NT >
Kokkos::View<NT *, CPU_memory> DiFfRG::MatsubaraQuadrature< NT >::host_weights
private

◆ m_size

template<typename NT >
int DiFfRG::MatsubaraQuadrature< NT >::m_size
private

The number of nodes in the quadrature rule.

◆ precision_factor

template<typename NT >
int DiFfRG::MatsubaraQuadrature< NT >::precision_factor
private

◆ T

template<typename NT >
NT DiFfRG::MatsubaraQuadrature< NT >::T
private

◆ typical_E

template<typename NT >
NT DiFfRG::MatsubaraQuadrature< NT >::typical_E
private

◆ vacuum_quad_size

template<typename NT >
int DiFfRG::MatsubaraQuadrature< NT >::vacuum_quad_size
private

The documentation for this class was generated from the following file:
  • /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/quadrature/matsubara.hh