63 void reinit(
const NT
T,
const NT
typical_E = 1.,
const int step = 2,
const int min_size = 0,
71 const std::vector<NT> &
nodes()
const;
102 template <
typename F>
auto sum(
const F &f)
const
104 auto sum =
T * f(
static_cast<NT
>(0));
105 for (
int i = 0; i <
m_size; ++i)
106 sum +=
w[i] * (f(
x[i]) + f(-
x[i]));
A quadrature rule for (bosonic) Matsubara frequencies, based on the method of Monien [1]....
Definition matsubara.hh:26
int m_size
The number of nodes in the quadrature rule.
Definition matsubara.hh:141
std::vector< NT > w
Weights of the quadrature rule.
Definition matsubara.hh:136
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.
std::vector< NT > x
Nodes of the quadrature rule.
Definition matsubara.hh:131
auto sum(const F &f) const
Compute a matsubara sum of a given function.
Definition matsubara.hh:102
int size() const
Get the size of the quadrature rule.
thrust::device_vector< NT > device_x
Device-side nodes of the quadrature rule.
Definition matsubara.hh:147
NT get_T() const
Get the temperature of the quadrature rule.
const std::vector< NT > & weights() const
Get the weights of the quadrature rule.
thrust::device_vector< NT > device_w
Device-side weights of the quadrature rule.
Definition matsubara.hh:152
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.
void move_device_data()
Move the nodes and weights to the device, if they are not already there.
int precision_factor
Definition matsubara.hh:166
NT T
Definition matsubara.hh:127
const std::vector< NT > & nodes() const
Get the nodes of the quadrature rule.
int vacuum_quad_size
Definition matsubara.hh:165
void reinit_0()
Construct a quadrature rule for T=0.
const NT * device_nodes()
Return the device-side nodes of the quadrature rule.
NT typical_E
Definition matsubara.hh:127
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.
NT get_typical_E() const
Get the typical energy scale of the quadrature rule.
const NT * device_weights()
Return the device-side weights of the quadrature rule.
Definition complex_math.hh:14
constexpr __forceinline__ __host__ __device__ NumberType powr(const NumberType x)
A compile-time evaluatable power function for whole number exponents.
Definition math.hh:45