DiFfRG
Loading...
Searching...
No Matches
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=powr< 10 >(2), 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=powr< 10 >(2), const int vacuum_quad_size=48, const int precision_factor=1)
 Update the quadrature rule with new parameters.
 
const std::vector< NT > & nodes () const
 Get the nodes of the quadrature rule.
 
const std::vector< NT > & weights () const
 Get the weights of the quadrature rule.
 
int 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.
 
const NT * device_nodes ()
 Return the device-side nodes of the quadrature rule.
 
const NT * device_weights ()
 Return the device-side weights of the quadrature rule.
 

Private Member Functions

void move_device_data ()
 Move the nodes and weights to the device, if they are not already there.
 
void reinit_0 ()
 Construct a quadrature rule for T=0.
 

Private Attributes

NT T
 
NT typical_E
 
std::vector< NT > x
 Nodes of the quadrature rule.
 
std::vector< NT > w
 Weights of the quadrature rule.
 
int m_size
 The number of nodes in the quadrature rule.
 
thrust::device_vector< NT > device_x
 Device-side nodes of the quadrature rule.
 
thrust::device_vector< NT > device_w
 Device-side weights of 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 = powr< 10 >(2),
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

◆ device_nodes()

template<typename NT >
const NT * DiFfRG::MatsubaraQuadrature< NT >::device_nodes ( )

Return the device-side nodes of the quadrature rule.

Returns
const NT*

◆ device_weights()

template<typename NT >
const NT * DiFfRG::MatsubaraQuadrature< NT >::device_weights ( )

Return the device-side weights of the quadrature rule.

Returns
const NT*

◆ 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.

◆ move_device_data()

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

Move the nodes and weights to the device, if they are not already there.

◆ nodes()

template<typename NT >
const std::vector< NT > & DiFfRG::MatsubaraQuadrature< NT >::nodes ( ) const

Get the nodes of the quadrature rule.

Returns
The nodes of the quadrature rule.

◆ 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 = powr< 10 >(2),
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 >
int 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 >
const std::vector< NT > & DiFfRG::MatsubaraQuadrature< NT >::weights ( ) const

Get the weights of the quadrature rule.

Returns
The weights of the quadrature rule.

Member Data Documentation

◆ device_w

template<typename NT >
thrust::device_vector<NT> DiFfRG::MatsubaraQuadrature< NT >::device_w
private

Device-side weights of the quadrature rule.

◆ device_x

template<typename NT >
thrust::device_vector<NT> DiFfRG::MatsubaraQuadrature< NT >::device_x
private

Device-side nodes of the quadrature rule.

◆ 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

◆ w

template<typename NT >
std::vector<NT> DiFfRG::MatsubaraQuadrature< NT >::w
private

Weights of the quadrature rule.

◆ x

template<typename NT >
std::vector<NT> DiFfRG::MatsubaraQuadrature< NT >::x
private

Nodes of the quadrature rule.


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