NiHu  2.0
gaussian_quadrature.hpp File Reference

implementation of Gaussian quadratures More...

#include "quadrature.hpp"
#include "../library/lib_domain.hpp"
#include <stdexcept>
Include dependency graph for gaussian_quadrature.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  NiHu::gaussian_quadrature< Domain >
 
struct  NiHu::quadrature_traits< gaussian_quadrature< Domain > >
 traits of a Gaussian quadrature More...
 
class  NiHu::gaussian_quadrature< line_domain >
 Gaussian quadrature over a line domain. More...
 
class  NiHu::gaussian_quadrature< quad_domain >
 Gaussian quadrature over a quad domain. More...
 
class  NiHu::gaussian_quadrature< tria_domain >
 specialisation of gauss_quadrature for a triangle domain More...
 
struct  NiHu::gauss_family_tag
 tag for the family of Gaussian quadratures More...
 
struct  NiHu::quadrature_type< gauss_family_tag, Domain >
 specialisation of quadrature_type to Gaussian family on line More...
 
struct  NiHu::quadrature_traits< log_gaussian_quadrature >
 traits of a Log-Gaussian quadrature More...
 
class  NiHu::log_gaussian_quadrature
 Log-Gaussian quadrature over a line domain. More...
 

Functions

template<class scalar_t >
Eigen::Matrix< scalar_t, Eigen::Dynamic, 2 > NiHu::gauss_impl (size_t N)
 return 1D N-point Guassian quadrature More...
 

Detailed Description

implementation of Gaussian quadratures

Definition in file gaussian_quadrature.hpp.

Function Documentation

◆ gauss_impl()

template<class scalar_t >
Eigen::Matrix<scalar_t, Eigen::Dynamic, 2> NiHu::gauss_impl ( size_t  N)

return 1D N-point Guassian quadrature

Template Parameters
scalar_tthe scalar type
Parameters
[in]Nnumber of Gaussian points
Returns
matrix containing the Gaussian locations and weights

The Gaussian locations are roots of the Legendre polynomials \(\varphi_n(x)\). The polynomials obey the recurrence relation

\(\varphi_{0}(x) = 1\)

\(\varphi_{1}(x) = x\)

\(\varphi_{n+1}(x) = x\varphi_{n}(x) - b_n \varphi_{n-1}(x)\), where \(b_n = \frac{n^2}{4n^2-1}\)

so the Legendre polynomials are the characteristic polynomial of the tridiagonal Jacobi matrix

\(J = \begin{pmatrix} 0 & \sqrt{b_1} \\ \sqrt{b_1} & 0 & \sqrt{b_2} \\ & \ddots & & \ddots \\ & & \sqrt{b_{N-2}} & 0 & \sqrt{b_{N-1}} \\ & & & \sqrt{b_{N-1}} & 0 \end{pmatrix}\)

and therefore the quadrature locations are the eigenvalues of \(J\)

Definition at line 62 of file gaussian_quadrature.hpp.