Quadrature rules
The online encylopedia of quadrature rules is a reference website that lists a number of quadrature rules.
Quadrature rules are sets of points and weights that are used to approximate integrals. If ${p_0,\dots,p_{n-1}}\subset\mathbb{R}^d$ and ${w_0,\dots,w_{n-1}}\subset\mathbb{R}$ are the points and weights (repectively) of the quadrature rule for a single integral, then:
$$\int f(x),\mathrm{d}x \approx \sum_{i=0}^{n-1}f(p_i)w_i$$
Website
Before building the online encylopedia of quadrature rules, you must first install qrtools from the python directory:
The online encylopedia of quadrature rules website can then be built by running:
Libraries
All of the quadrature rules included in the online encylopedia of quadrature rules are included in the quadraturerules library, which is available in the following languages:
| Language | Badges |
|---|---|
| C | |
| C++ | |
| Fortran | |
| FORTRAN 77 | |
| Julia | |
| Python | |
| Rust |
Before building any of the libraries, you must first install qrtools from the python directory:
You can then build the libraries using the build.py script in the library directory. For example, to build the python library, you can run:
and to build the rust library, you can run:
C++ library
The source code of the quadraturerules C++ library can be downloaded from the latest release on GitHub. It can be installed by running:
Once the library is installed, you can run the tests by running:
Or you can run individual tests:
}
Usage
The library's function single_integral_quadrature can be used to get the points and weights
of quadrature rules for a single integral. For example the following snippet will create an
order 3 Xiao--Gimbutas rule on a triangle:
using quadraturerules;
auto = ;
Note that the points returned by the library are represented using barycentric coordinates.
Generating the library
The C++ quadraturerules library can be generated from the templates in the online encyclopedia of quadrature rules GitHub repo. First clone the repo and move into the library directory:
The C++ library can then be generated by running:
This will create a directory called cpp.build containing the C++ source code.