Mundy: Multibody Nonlocal Dynamics Version of the Day
Loading...
Searching...
No Matches
mundy::GaussLegendre< Scalar, N > Class Template Reference

The N-point Gauss-Legendre rule on [-1, 1], exact for polynomials of degree at most 2N - 1. More...

#include <GaussLegendre.hpp>

Public Types

using value_type = Scalar

Static Public Member Functions

static constexpr Kokkos::Array< Scalar, N > nodes ()
 The N nodes in ascending order. Node N - 1 - i is minus node i.
static constexpr Kokkos::Array< Scalar, N > weights ()
 The N weights, in the order of nodes().
template<class Function>
static constexpr auto integrate (const Function &f)
 sum_i w_i f(x_i), approximating the integral of f over [-1, 1].

Static Public Attributes

static constexpr unsigned num_points = N

Detailed Description

template<class Scalar, unsigned N>
class mundy::GaussLegendre< Scalar, N >

The nodes and weights are correctly rounded to Scalar and computed by the compiler, so every member is a constant expression and works on the device. Like Boost's rule, it integrates on [-1, 1]; map other intervals affinely.

Member Typedef Documentation

◆ value_type

template<class Scalar, unsigned N>
using mundy::GaussLegendre< Scalar, N >::value_type = Scalar

Member Function Documentation

◆ nodes()

template<class Scalar, unsigned N>
constexpr Kokkos::Array< Scalar, N > mundy::GaussLegendre< Scalar, N >::nodes ( )
inlinestaticconstexpr

◆ weights()

template<class Scalar, unsigned N>
constexpr Kokkos::Array< Scalar, N > mundy::GaussLegendre< Scalar, N >::weights ( )
inlinestaticconstexpr

◆ integrate()

template<class Scalar, unsigned N>
template<class Function>
constexpr auto mundy::GaussLegendre< Scalar, N >::integrate ( const Function & f)
inlinestaticconstexpr

Member Data Documentation

◆ num_points

template<class Scalar, unsigned N>
unsigned mundy::GaussLegendre< Scalar, N >::num_points = N
staticconstexpr