Mundy: Multibody Nonlocal Dynamics Version of the Day
Loading...
Searching...
No Matches
ClenshawCurtis.hpp File Reference

Clenshaw-Curtis quadrature, with the number of points fixed at compile time or chosen at run time. More...

Classes

class  mundy::ClenshawCurtis< Scalar, N >
 The N-point Clenshaw-Curtis rule on [-1, 1], exact for polynomials of degree at most N - 1 (N for odd N). More...

Namespaces

namespace  mundy

Functions

template<class Scalar>
void mundy::clenshaw_curtis_rule (unsigned n, std::vector< Scalar > &nodes, std::vector< Scalar > &weights)
 The n-point Clenshaw-Curtis rule on [-1, 1] for a run-time n, into std::vectors.
template<class NodesView, class WeightsView>
void mundy::clenshaw_curtis_rule (unsigned n, NodesView &nodes, WeightsView &weights)
 The n-point Clenshaw-Curtis rule on [-1, 1] for a run-time n, into rank-1 Kokkos views.

Detailed Description

The n-point rule integrates over [-1, 1] at the Chebyshev extreme points -cos(pi i / (n - 1)), endpoints included, with the weights of Trefethen's clencurt (Spectral Methods in MATLAB, SIAM 2000; see also Waldvogel, BIT 46, 2006). It is exact for polynomials of degree at most n - 1, and n for odd n.

ClenshawCurtis<Scalar, N> mirrors GaussLegendre<Scalar, N>: the compiler builds the table, which is constexpr and usable on the host or device. clenshaw_curtis_rule(n, nodes, weights) builds the same rule, bit for bit, for a run-time n. Both cost O(n^2) work.