A lightweight, simple, fast, and cross-platform double precision C++11 routine that computes the abscissas (nodes) and weights for an N-point Gauss-Legendre rule over an arbitrary interval (a,b). See the unit tests in the folder test/ for examples.
Travis CI: Linux (gcc) and OS X (clang)
- Boost is used for the unit tests.
- CMake is used for the builds.
- Doxygen is used to create documentation.
If your intentions are to simply use the code, the above dependencies don't apply. You only need GassLegendreRule.cpp and the corresponding header file.
The API reference can be found in the folder doc/latex/refman.pdf
Newton's method is used to compute the abscissas, which are the roots of an Nth order Legendre polynomial. Although alternative methods exist, direct root finding is typically faster by a factor of 3 to 5 [Press et al., Numerical Recipes 3rd ed. (2007)]. For further efficiency, pre-computed abscissas/weights correct to 25 decimal places for the orders = 2-20,32,64,96,100,128,256,512,1024 are used, otherwise abscissas/weights are computed on the fly.
This code is a modified version of the GNU Scientific Library function glfixed. The original project can be found at Pavel Holoborodko.